Skip to content

evetest-pr: harden handling of secrets in the evetest workflow - #7022

Merged
rene merged 2 commits into
lf-edge:masterfrom
milan-zededa:evetest-base-run-suite
Nov 4, 2026
Merged

rene merged 2 commits into
lf-edge:masterfrom
milan-zededa:evetest-base-run-suite

Conversation

@milan-zededa

@milan-zededa milan-zededa commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Description

Security hardening of the evetest-pr workflow, which handles secrets
(Anthropic key, GitHub token) while running code from the PR checkout, which
may be a fork. Two commits:

  1. Run evetest-run-suite from the base branch. After checking out the PR,
    replace .github/actions/evetest-run-suite/ with the base branch's copy, in
    both the discover job and the suite job, so the PR cannot alter the action
    and scripts (watcher, select-tests.sh, pr-diff.sh, ...) that handle the
    secrets.
  2. Keep the secrets away from make and evetest. The "Run evetest" step
    exported ANTHROPIC_API_KEY and GH_TOKEN for the watcher, but the same
    step then ran make -C evetest evetest, i.e. PR code, with that
    environment. Both are now unset once the watcher is started, so only the
    watcher keeps them.

Limits: PR changes to evetest-run-suite only take effect once merged. The
unset removes the secrets from the environment make inherits, but the
suite still executes PR code on the runner as the same user, so this is
defense in depth rather than isolation from a deliberately malicious PR.

How to test and validate this PR

CI workflow change only; not yet run in CI. After merge, open a PR that
modifies a file under .github/actions/evetest-run-suite/ and check in the
workflow run that the base branch's version is the one executed, and that a
failure is still analysed by the watcher (it still has its secrets).

Changelog notes

None. No user-facing changes (CI tooling only).

PR Backports

Checklist

  • I've provided a proper description
  • I've added the proper documentation
  • I've tested my PR on amd64 device
  • I've tested my PR on arm64 device
  • I've written the test verification instructions
  • I've set the proper labels to this PR

And the last but not least:

  • I've checked the boxes above, or I've provided a good reason why I didn't
    check them.

🤖 Generated with Claude Code

The suite jobs run the evetest-run-suite action and its scripts with
secrets (Anthropic key, GitHub token) from the PR checkout, which may
be a fork. After checking out the PR, replace that directory with the
base branch's copy so the PR cannot alter the code that handles them.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Milan Lenco <milan@zededa.com>
@milan-zededa milan-zededa added the testing New test or test framework changes label Nov 3, 2026
@github-actions
github-actions Bot requested a review from europaul November 3, 2026 16:15
@milan-zededa milan-zededa changed the title evetest-pr: run evetest-run-suite from the base branch evetest-pr: harden handling of secrets in the evetest workflow Nov 3, 2026
The "Run evetest" step exports ANTHROPIC_API_KEY and GH_TOKEN so the
live-investigation watcher can use them, but the same step then runs
`make -C evetest evetest`, i.e. PR-controlled code, with the same
environment. Unset both once the watcher has been started; it keeps
its own copy and make and everything it spawns no longer inherit them.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Milan Lenco <milan@zededa.com>
@milan-zededa
milan-zededa force-pushed the evetest-base-run-suite branch from 48164e3 to 72b0275 Compare November 3, 2026 16:39
@rene
rene merged commit 5307aff into lf-edge:master Nov 4, 2026
40 of 41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing New test or test framework changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants