Repository navigation
[FSSDK-13475] Do not persist GitHub credentials in checkout steps - #359
Esra Kartal (esrakartalOpt) wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Alex Yong (alexjoeyyong)
left a comment
There was a problem hiding this comment.
Verdict: approve with comments. The change is correct and small, and I confirmed from the real CI logs that it works for react.yml. One thing the description claims isn't actually exercised by this PR's CI: the integration workflow change (below). Nothing blocks merge.
TL;DR
react.ymlfix works. In this PR's CI run the unit-test job's checkout showspersist-credentials: falseand the runner then logsRemoving auth. No later step in that job uses git.integration_test.ymlfix is not exercised by this PR's CI.react.ymlcalls that workflow asoptimizely/react-sdk/.github/workflows/integration_test.yml@master, i.e. master's copy. In the same run the integration job's checkout loggedpersist-credentials: true(the old value). So the description's "The CI run on this PR checks that both workflows still work" holds for one of the two files. It takes effect on the first run after merge.- I checked the one risk statically, instead. The step that follows runs
trigger-script-with-status-update.shfromoptimizely/travisci-tools@master, which sourcesgeneric-trigger.sh. I read both: they only callcurl -u "$TOKEN"with the token from env. Nogitcommand, no read of.git/config. So dropping the stored credential can't break it. - Coverage is now complete: all four
actions/checkoutsteps in the repo setpersist-credentials: false(the other two,react_release.ymlandghr_backfill.yml, already did).
CI: 10 pass, 1 skipped, none failing.
Proof
Details
PR CI run (React SDK CI), unit-test job (react.yml change):
Run actions/checkout@v4 with: persist-credentials: false ... then "Removing auth"
PR CI run, "Run integration tests / test" job (integration_test.yml, called @master):
Run actions/checkout@v4 with: token: *** repository: optimizely/travisci-tools ... persist-credentials: true <- master's version
travisci-tools@master:
trigger-script-with-status-update.sh -> source generic-trigger.sh -> curl -X POST ... -u "$TOKEN" (no git)
actionlint on both changed files: identical findings on this head and on master
(SC2086 info notes, and `inputs.FULLSTACK_TEST_REPO` undefined because workflow_call declares no inputs). None from this PR.
Findings
Blockers: none. Should-fix: none.
Nit: after merge, watch the first master run of "Run integration tests" once (it is the first run with persist-credentials: false on that checkout). I read the scripts it runs and expect no change, but CI hasn't shown it.
Ponytail
Lean already: six lines, two files, each with a one-line reason. Ship.
net: 0 lines possible.
Principles (installed principles plugin v0.5.0, org layer; no repo-level checks)
Applied by hand, not the full recorded run. SEC-6.S1 pass (this clears the two artipacked findings from the scanner). CODE-1.S1 pass (added comments explain behaviour, not history). FUN-2.S1 pass (CI green). Other checks don't apply to a workflow-only change.
| ref: 'master' | ||
| # Don't leave the PAT on disk. The trigger script calls the GitHub API | ||
| # with curl and the token from env, not through git. | ||
| persist-credentials: false |
There was a problem hiding this comment.
Nit (not a code change). This line isn't exercised by this PR's CI. react.yml calls this workflow as ...integration_test.yml@master, and in the PR run this job's checkout logged persist-credentials: true, the old value. I read the step that follows (trigger-script-with-status-update.sh -> generic-trigger.sh in travisci-tools@master): it only runs curl -u "$TOKEN" with the token from env, no git, so I expect no change. Please glance at the first master run of "Run integration tests" after merge. I'm not attaching a suggestion block because there is nothing to change.
Summary
Fixes the 2 Arnica artipacked findings on
masterfrom FSSDK-13475:actions/checkoutleft the GitHub token in.git/config..github/workflows/react.yml: addedpersist-credentials: false. No later step uses git..github/workflows/integration_test.yml: addedpersist-credentials: falseto thetravisci-toolscheckout, which uses theCI_USER_TOKENpersonal access token. The trigger script calls the GitHub API with curl and the token from env, not through git. This is the same change already made in the other SDK repos.The other 16 findings in the ticket are in
examples/v4-bug-bash, which is only on the unmerged branchjunaed/fssdk-12471-react-bug-bash, not onmaster. They are not part of this PR.Test plan
gitor needs stored credentials.Issues
🤖 Generated with Claude Code