Skip to content

Keep the job token out of a tree the PR author controls - #105

Merged
kwsantiago merged 1 commit into
mainfrom
harden-guard-workflow
Aug 1, 2026
Merged

Keep the job token out of a tree the PR author controls#105
kwsantiago merged 1 commit into
mainfrom
harden-guard-workflow

Conversation

@kwsantiago

@kwsantiago kwsantiago commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds persist-credentials: false to the rng-hygiene job's checkout in ci.yml.

Why

The job checks out a PR branch and then executes a script from itscripts/check-rng-hygiene.sh, which any PR author can edit. actions/checkout writes GITHUB_TOKEN into .git/config by default, leaving it readable by that PR-authored code. The job performs no git operations needing credentials.

Found in a CodeRabbit comment on #104 that I merged past without reading. The same fix is going to keep and keep-esp32.

CodeRabbit also flagged on #104 that scanner_died could fail open — that one was already fixed before merge (the || scanner_died is at the call sites, not inside the command substitution), verified on current main.

It additionally asked whether rng-hygiene is a required status check in branch protection. It is not: main is unprotected, so the guard is advisory. That is a repo-settings decision rather than a code change, and is worth deciding separately.

Test plan

  • ci.yml parses as YAML
  • scripts/check-rng-hygiene.sh still clean on the tree
  • Takes effect on the next CI run; not verifiable locally

Summary by CodeRabbit

  • Chores
    • Updated the continuous integration checkout process to prevent Git credentials from being persisted.

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 18ad3b11-c07a-431d-aa56-b70442690509

📥 Commits

Reviewing files that changed from the base of the PR and between 30c267f and 2aa0311.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml

Walkthrough

The rng-hygiene CI checkout disables Git credential persistence. The GitHub token is not stored in .git/config after checkout.

Changes

RNG hygiene checkout

Layer / File(s) Summary
Disable checkout credential persistence
.github/workflows/ci.yml
The rng-hygiene checkout sets persist-credentials: false.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Poem

A rabbit checks the workflow bright,
No token lingers out of sight.
The checkout hops with care,
Credentials leave no trace there.
Safe paths through the CI night.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes preventing the job token from being exposed to PR-controlled files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch harden-guard-workflow

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kwsantiago
kwsantiago merged commit b766ecd into main Aug 1, 2026
7 checks passed
@kwsantiago
kwsantiago deleted the harden-guard-workflow branch August 1, 2026 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant