Pass only the secret the test workflow needs - #6269
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6269 +/- ##
==========================================
+ Coverage 72.70% 72.73% +0.02%
==========================================
Files 742 742
Lines 77299 77299
==========================================
+ Hits 56201 56221 +20
+ Misses 17136 17114 -22
- Partials 3962 3964 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
run-on-pr.yml and run-on-main.yml called test.yml and helm-charts-test with secrets: inherit, which hands over every repository secret. Between them those workflows reference exactly one that is not GITHUB_TOKEN. test.yml runs the Go test suite, so it executes repository code and its dependency tree in a job whose secrets context also held every other credential configured on the repository, the large majority of them release-time credentials with no bearing on running tests. It now receives CODECOV_TOKEN and nothing else, declared as an optional workflow_call secret so a fork pull request, which gets no secrets at all, still runs. helm-charts-test.yml references nothing but GITHUB_TOKEN, which is always available to a called workflow, so it needs no secrets block. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ChrisJBurns
force-pushed
the
scope-inherited-secrets
branch
from
August 10, 2026 19:48
69eee80 to
95896a3
Compare
jhrozek
approved these changes
Aug 10, 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
secrets: inherithanded every repository secret to the test workflows.run-on-pr.ymlandrun-on-main.ymlcalledtest.ymlandhelm-charts-test.ymlthat way. Between them, those two workflows reference exactly one secret that is notGITHUB_TOKEN.test.ymlruns the Go test suite — repository code and its whole dependency tree — in a job whosesecretscontext also carried the release signing keys.Between them, those two workflows reference exactly one secret that is not
GITHUB_TOKEN. Every other secret configured on the repository — the large majority of them release-time credentials with no bearing on running tests — was being handed over as well.Pull requests from forks receive no secrets at all, so forks were never the exposure. A pull request from a branch in this repository does receive them, and the workflow definition that runs comes from the pull request head — so this narrows what a compromised dependency or a malicious same-repo branch can reach.
What changed
test.ymldeclaresCODECOV_TOKENas an optionalworkflow_callsecret, so callers can name it. Optional rather than required because fork pull requests pass an empty value, and codecov accepts tokenless uploads for public repositories — an empty token degrades rather than fails.CODECOV_TOKENand nothing else totest.yml.secrets:block forhelm-charts-test.ymlentirely — it references onlyGITHUB_TOKEN, which is always available to a called workflow and is never passed explicitly.secrets-inheritgoes 4 → 0; repo-wide 36 → 32. There is nosecrets: inheritleft in the repository.Part of #6253
Type of change
Test plan
Unit tests (
task test)E2E tests (
task test-e2e)Linting (
task lint-fix)Manual testing (describe below)
Cross-checked every reusable workflow called by the two entry points: for each, the secrets it references, the secrets it declares under
on.workflow_call.secrets, and the secrets each caller passes.test.ymlis the only one with any, and all three sets agree onCODECOV_TOKEN.Confirmed the other called workflows reference no secrets beyond
GITHUB_TOKEN, so dropping theirsecrets:blocks changes nothing.All workflows parse as YAML;
actionlintreports 12 findings before and after, all pre-existing.This pull request exercises the change directly —
run-on-pr.ymlruns on it, so the Tests and Helm Charts jobs here are running under the narrowed secrets.Does this introduce a user-facing change?
No.
Special notes for reviewers
CODECOV_TOKENwere not reachingtest.yml, the codecov step is where it would show. Worth a glance at this pull request's own Tests job before merging.test.ymlis part of this change rather than caller-side only. Anything added totest.ymllater that needs a new secret must declare it and be passed it — that is the intended friction.Generated with Claude Code