Skip to content

ci: stop lending the checkout token to PR code - #3

Closed
letientai299 wants to merge 2 commits into
mainfrom
tai/blossom
Closed

ci: stop lending the checkout token to PR code#3
letientai299 wants to merge 2 commits into
mainfrom
tai/blossom

Conversation

@letientai299

Copy link
Copy Markdown
Collaborator

CodeRabbit reviewed !354, the back-port of #1, and flagged the
workflows that MR carried across unchanged. Addressing it here rather than
there, because .github/** is authored on this side and syncs out. Three of
the four findings hold.

  • Checkout credentials outlive their reader. ci.yml and wheel.yml
    check out with credentials so git lfs pull can fetch the CUBIN packs by
    pattern, and every step after that — setup.py, the test suite — is code a
    pull request controls. actions/checkout clears the auth header only in its
    post step, which runs after all of it, so an untrusted step had a usable
    token sitting in .git/config for the length of the job. The drop goes in
    .github/actions/cubin-packs, next to the pull that is the only reader,
    rather than being repeated in both callers.

  • Vulnerability-scan held a scope it never used. It is the one job in
    blossom-ci.yml that checks out unreviewed contributor code, and it
    inherited pull-requests: write from the workflow — the comment back is
    Upload-Log's job. A job-level block replaces the inherited set with what
    blossom-action demonstrably needs. The remaining jobs keep the
    workflow-level set: blossom-ci is an opaque binary on the self-hosted
    runner, and narrowing it further before a run has named what it uses would be
    the speculation that file already warns against.

Not applied: CodeRabbit also wanted github.actor == 'blossom-jenkins-bot' on
Upload-Log. That login is not published anywhere, and a wrong guess fails
closed and silent — the run goes green and the Jenkins log link never posts.
NVIDIA/spark-rapids and NVIDIA-BioNeMo/nvMolKit both gate on github.event_name
alone, so the && github.event.inputs.args already here is the stricter check.
Left as a comment naming the condition to pin it under.

Verified: all four files parse; the effective permission set per job is
Vulnerability-scan -> {contents: read, statuses: write} with the other three
inheriting. The credential drop was exercised under bash -eo pipefail both
with the header present (removed, verified gone) and absent (step reports and
exits 0, so a caller using persist-credentials: false does not fail). prek
is clean on the changed files.

Back-ports to GitLab once merged.

CodeRabbit on !354, the back-port of #1, flagged the workflows the MR
carried across unchanged. Three of the four findings hold.

`ci.yml` and `wheel.yml` check out with credentials so the CUBIN packs
can be pulled, and every step after that -- `setup.py`, the test suite --
is code a pull request controls. actions/checkout only clears the auth
header in its post step, which runs last, so an untrusted step had a
usable token in `.git/config` for the length of the job. The drop goes in
the cubin-packs action rather than in each caller, next to the pull that
is the only reader.

`Vulnerability-scan` is the one job in blossom-ci.yml that checks out
unreviewed contributor code, and it inherited `pull-requests: write` from
the workflow with nothing to use it; a job-level block replaces the
inherited set with what blossom-action demonstrably needs.

The fourth asked for `github.actor == 'blossom-jenkins-bot'` on
Upload-Log. That login is not published, and a wrong guess fails silent
-- the run goes green and the log link never posts. spark-rapids and
nvMolKit both gate on `github.event_name` alone, so the `args` check here
is already stricter. Left as a comment naming when to pin it.

Signed-off-by: Tai Le <taile@nvidia.com>
@letientai299
letientai299 requested a review from a team as a code owner August 20, 2026 06:35
The first attempt at this was a no-op. It unset
`http.https://github.com/.extraheader` in `.git/config`, which is where
checkout v5 and earlier put the token -- v7 writes it to a file under
RUNNER_TEMP and points `.git/config` at that file with `includeIf.gitdir:`.
The step reported "no checkout auth header to drop" and passed while the
credential stayed readable for the rest of the job, which is the failure
CodeRabbit and zizmor were pointing at in the first place.

Clear both shapes, and remove the RUNNER_TEMP file rather than only
unlinking it from the config, since that file is what holds the secret.

Then assert it: plain `git config --get-all` reads the effective
configuration, following any `includeIf` still in place, so the step now
fails if either branch missed. A checkout bump that moves the credential
again turns this back into a no-op otherwise -- exercised against the v5
layout, the v7 layout, a caller with no credentials at all, and a
credentials file the cleanup does not recognise, which fails the step.

Signed-off-by: Tai Le <taile@nvidia.com>
@letientai299

Copy link
Copy Markdown
Collaborator Author

/build-ci

@letientai299
letientai299 deleted the tai/blossom branch September 9, 2026 17:53
@NVIDIA-BioNeMo NVIDIA-BioNeMo locked as resolved and limited conversation to collaborators Sep 9, 2026
@letientai299 letientai299 changed the title [BNMTRT-485] ci: stop lending the checkout token to PR code ci: stop lending the checkout token to PR code Sep 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant