Skip to content

fix: make secrets inherit an explicit opt-in instead of the default - #153

Merged
joshua-temple merged 1 commit into
mainfrom
fix/secrets-explicit-default
Jun 14, 2026
Merged

joshua-temple merged 1 commit into
mainfrom
fix/secrets-explicit-default

Conversation

@joshua-temple

Copy link
Copy Markdown
Collaborator

Problem

The generator emitted secrets: inherit for every reusable, cross-repo deploy, rollback, callback, and hotfix-build job whenever the manifest secrets field was unset. That insecure default handed every caller secret to each called workflow, including external ones, with no opt-in.

Fix

Make secrets: inherit an explicit opt-in.

  • New default: when the manifest secrets field is unset, no secrets: block is emitted. The called workflow receives only its own GITHUB_TOKEN.
  • inherit remains available as an explicit opt-in, via the scalar secrets: inherit or the mapping secrets: { inherit: true }. Mapping support for inherit: true was added; the scalar form is unchanged.
  • The explicit per-secret map form (secrets: { CALLED: CALLER }) is unchanged.
  • UnmarshalYAML accepts the scalar inherit, { inherit: true }, a secret-name mapping, and bare/null (unset), and rejects a mapping that mixes inherit with secret-name keys.
  • writeSecretsBlock now owns the terminating blank line in all paths, including the no-op case, so job separation stays valid. The hotfix build job, which previously hardcoded secrets: inherit, now routes through writeSecretsBlock and 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 onto main once #152 merges (or merge #152 first).

Verification

  • go build ./... && go test ./...: all unit tests pass.
  • e2e module: go build, go vet, golangci-lint run ./... clean (both modules).
  • New e2e scenarios under e2e/scenarios/orchestrate/: secrets-default-none asserts no secrets: block is generated by default; secrets-opt-in asserts the scalar, mapping, and per-secret forms. Local runs with Docker:
    ```
    --- PASS: TestMultiStepScenarios (0.01s)
    ok github.com/stablekernel/cascade/e2e 20.798s
    ```
  • Representative deploy, promote, and orchestrate scenarios (cascade-promotion, source-image-tag, env-gates) also pass under act:
    ```
    ok github.com/stablekernel/cascade/e2e 84.618s
    ```

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
joshua-temple force-pushed the fix/secrets-explicit-default branch from af4e591 to 6407064 Compare June 14, 2026 03:34
@joshua-temple
joshua-temple changed the base branch from feat/deploy-image-digest to main June 14, 2026 03:35
@joshua-temple joshua-temple reopened this Jun 14, 2026
@joshua-temple
joshua-temple merged commit d3fbd67 into main Jun 14, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant