From 61592f478ffd158c76d5f70e4ff176feb305271a Mon Sep 17 00:00:00 2001 From: Joe Lanford Date: Mon, 30 Nov 2026 12:17:25 -0500 Subject: [PATCH] docs: warn about credentials in proxy env vars proxy.ReadProxyVarsFromEnv returns literal values, and proxy URLs can contain credentials. Document that forwarding these values verbatim into operand pod specs exposes credentials to anyone who can read the operand workload spec, and show how to reference a Secret with valueFrom.secretKeyRef instead. Signed-off-by: Joe Lanford Co-Authored-By: GLM 5.3 --- .../golang/references/proxy-vars.md | 44 ++++++++++++++++++- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/website/content/en/docs/building-operators/golang/references/proxy-vars.md b/website/content/en/docs/building-operators/golang/references/proxy-vars.md index 8b750ffb19d..0fa5489490c 100644 --- a/website/content/en/docs/building-operators/golang/references/proxy-vars.md +++ b/website/content/en/docs/building-operators/golang/references/proxy-vars.md @@ -6,10 +6,21 @@ weight: 20 Proxy-friendly Operators should inspect their environment for the standard proxy variables (`HTTPS_PROXY`, `HTTP_PROXY`, and `NO_PROXY`) -and pass the values to Operands. +and configure Operands to use the appropriate proxy settings. Operator-lib provides a helper function `proxy.ReadProxyVarsFromEnv` -that does this inspection, all you need to do is append the +that does this inspection and returns the values as literal environment variables. + +{{% alert title="Warning" color="warning" %}} +Proxy URLs can contain credentials. `proxy.ReadProxyVarsFromEnv` returns literal +values, including any credentials, even when the Operator received those values +from a Secret. Passing these values directly to Operands stores them in the +Operand workload specification, where users with permission to read that workload +can see them. For proxy settings containing credentials, configure the Operand to +reference a Secret instead, as shown below. +{{% /alert %}} + +If none of the proxy settings contain credentials, you can append the helper's results to the Operand environments. Using the memcached tutorial as an example, add the following to the @@ -41,3 +52,32 @@ containers: - name: "HTTP_PROXY" value: "http_proxy_test" ``` + +## Proxy settings containing credentials + +For proxy settings containing credentials, use `valueFrom.secretKeyRef` in the +Operand container's environment instead of copying the resolved values from the +Operator's environment. For example, configure the Operand Deployment's container +to reference an existing Secret named `proxy-config`: + +```yaml +env: + - name: HTTP_PROXY + valueFrom: + secretKeyRef: + name: proxy-config + key: HTTP_PROXY + - name: HTTPS_PROXY + valueFrom: + secretKeyRef: + name: proxy-config + key: HTTPS_PROXY +``` + +The Secret must exist in the Operand's namespace and contain the referenced keys. +Reading an environment variable does not reveal which Secret, if any, supplied +its value. The Operator therefore needs an explicit way to determine the Secret +name and keys to reference for the Operand. + +Use Secret references instead of literal forwarding for these variables. Do not +also append the helper's literal values for the same variables.