Repository navigation
Security in shared environments
By default, helm-secrets follow symlinks or accept relative paths for values. In shared environments like Jenkins or ArgoCD, is can be a problem. Users can use helm-secrets to gain access to other files outside their own build directory.
To restrict access to file outside the build directory, certain restrictions can be enabled to prevent illegal access to other files.
Symlinks can be abused to gain access to file outside the directory. To prevent this, set the environment variable
HELM_SECRETS_VALUES_ALLOW_SYMLINKS=falseto through an error, if a referenced value file is a symlink.
Throw an error, if the path of the value file is an absolute path. To prevent this, set the environment variable
HELM_SECRETS_VALUES_ALLOW_ABSOLUTE_PATH=falseA path traversal attack (also known as directory traversal) aims to access files and directories that are stored outside the web root folder. By manipulating variables that reference files with “dot-dot-slash (../)” sequences and its variations or by using absolute file paths, it may be possible to access arbitrary files and directories stored on file system including application source code or configuration and critical system files.
To prevent this, set the environment variable
HELM_SECRETS_VALUES_ALLOW_PATH_TRAVERSAL=falseThe ArgoCD integration required to mount the gpg/age keys on a specific location. By default, helm-secrets accept all locations of a gpg key. To restrict the locations of keys, set an environment variable
HELM_SECRETS_KEY_LOCATION_PREFIX=/secrets/To allow only gpg/age keys from the path /secrets/.
A secret backend can be selected per value file with the backend! prefix, for example secrets://vals!secrets.yaml.
In shared environments that prefix is controlled by whoever writes the Application manifest or the value file reference.
Out-of-tree backends are shell scripts that get sourced by helm-secrets. For that reason, a file path is only accepted
in the backend! prefix when it is listed explicitly in HELM_SECRETS_ALLOWED_BACKENDS. The --backend option and the
HELM_SECRETS_BACKEND environment variable still accept any path, because they are set by the operator.
To additionally restrict which in-tree backends can be selected, set the environment variable
HELM_SECRETS_ALLOWED_BACKENDS=sops,valsBackends that are not listed are rejected, regardless of how they are selected.
vals resolves every ref+<provider>:// expression it finds. Some of its providers are always built in and work on
the machine that runs helm, not on an external secret store:
-
ref+exec://runs an arbitrary command, for exampleref+exec://sh?args=-c,id(recent vals versions) -
ref+file://reads an arbitrary file -
ref+envsubst://reads environment variables
Warning
Whoever controls content that vals processes can run commands and read files and credentials with the privileges of the process running helm, for example the Argo CD repo-server.
That content includes:
- value files, if vals is the default backend
- value references that select vals through the
backend!prefix, for examplesecrets://vals!values.yamlorsecrets+literal://vals!ref+exec://... - rendered chart templates, if
--evaluate-templatesorHELM_SECRETS_EVALUATE_TEMPLATES=trueis used. This always runs vals, regardless of the selected backend.
If the authors of value files, value references or Git repositories are not fully trusted, do not allow vals:
HELM_SECRETS_BACKEND=sops
HELM_SECRETS_ALLOWED_BACKENDS=sops
HELM_SECRETS_EVALUATE_TEMPLATES=falseNot installing the vals binary has the same effect. If vals is required, only render content from trusted authors, or run it in an isolated environment that holds no credentials beyond the ones needed for that content.
This wiki is synced with the docs folder from the code repository! To improve the wiki, create a pull request against the code repository with the suggested changes.