fix: make secrets inherit an explicit opt-in instead of the default - #153
Merged
Merged
Conversation
Generate no secrets block when a manifest secrets field is unset, so a
reusable or cross-repo deploy, rollback, callback, and hotfix build job
receives only its own GITHUB_TOKEN by default. secrets: inherit is now an
explicit opt-in, available via the scalar form or a {inherit: true}
mapping, and the per-secret map form is unchanged.
Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
joshua-temple
force-pushed
the
fix/secrets-explicit-default
branch
from
June 14, 2026 03:34
af4e591 to
6407064
Compare
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.
Problem
The generator emitted
secrets: inheritfor every reusable, cross-repo deploy, rollback, callback, and hotfix-build job whenever the manifestsecretsfield was unset. That insecure default handed every caller secret to each called workflow, including external ones, with no opt-in.Fix
Make
secrets: inheritan explicit opt-in.secretsfield is unset, nosecrets:block is emitted. The called workflow receives only its ownGITHUB_TOKEN.inheritremains available as an explicit opt-in, via the scalarsecrets: inheritor the mappingsecrets: { inherit: true }. Mapping support forinherit: truewas added; the scalar form is unchanged.secrets: { CALLED: CALLER }) is unchanged.UnmarshalYAMLaccepts the scalarinherit,{ inherit: true }, a secret-name mapping, and bare/null (unset), and rejects a mapping that mixesinheritwith secret-name keys.writeSecretsBlocknow owns the terminating blank line in all paths, including the no-op case, so job separation stays valid. The hotfix build job, which previously hardcodedsecrets: inherit, now routes throughwriteSecretsBlockand honors the same opt-in.There are no external consumers of generated workflows (only the test fleet), so this behavioral default change is safe.
Stacking
This PR is stacked on #152 (
feat/deploy-image-digest); its base is that branch so the diff shows only this change. The two share the deploy-job generation code and e2e fixtures, so sequencing them avoids conflicts. Rebase ontomainonce #152 merges (or merge #152 first).Verification
go build ./... && go test ./...: all unit tests pass.go build,go vet,golangci-lint run ./...clean (both modules).e2e/scenarios/orchestrate/:secrets-default-noneasserts nosecrets:block is generated by default;secrets-opt-inasserts the scalar, mapping, and per-secret forms. Local runs with Docker:```
--- PASS: TestMultiStepScenarios (0.01s)
ok github.com/stablekernel/cascade/e2e 20.798s
```
```
ok github.com/stablekernel/cascade/e2e 84.618s
```