fix(k8s,scheduled_task): file-type parameter no longer leaks binary as env var#186
Merged
Conversation
This reverts commit dc679d2.
pilundain
approved these changes
Jun 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Deployments with a binary
file-type parameter (e.g. a P12 certificate) failed at pod start with:Investigating that error revealed the underlying bug: file parameters were being exported as env vars alongside
environment-type parameters. For binary files this fails at the runtime layer (NUL bytes are illegal in env var values); for text files it would silently work but is still wrong — file content has no business being in an env var.Fix
The application container loads its env vars via
envFrom: secretRef:, which imports every key in the referenced Secret as an env var. The only reliable way to keep file bytes out of the env block is to put them in a different Secret object.So the deployment now provisions two Secrets:
s-<scope>-d-<deploy>— env-safe values only (env-type params +NP_*). Consumed viaenvFrom.s-<scope>-d-<deploy>-files— binary file content only. Consumed by the volume mount.For each
fileparameter the application container also gets a plainenv:entry (not from any Secret) namedapp-data-<sanitized-param-name>whose value is the file'sdestination_path, so apps can discover where the file was mounted.Same fix applied to
scheduled_task(which reuses the k8s Secret templates).Test plan
bats k8s/deployment/tests/build_deployment.bats— 12/12 pass. New render test exercises a file param with a tricky name ("API P12 Cert!") and a destination path containing YAML metacharacters (/app-data/[2026-05-27] cert.p12) to lock in both the sanitization and the path-quoting.gomplate+kubectl apply --dry-run=client.destination_path.