Restrict token access in the secret scanning workflow - #6757
Open
albertvillanova wants to merge 1 commit into
Open
Restrict token access in the secret scanning workflow#6757albertvillanova wants to merge 1 commit into
albertvillanova wants to merge 1 commit into
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
qgallouedec
reviewed
Aug 14, 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.
This PR restricts the token access granted to the secret scanning job.
Motivation
The workflow declares no
permissionsblock, so the job takes the repository default, and the checkout keeps the job's token in.git/configbecausepersist-credentialsdefaults totrue.That matters here more than in a normal job: the scan step runs the scanner as a container with the working directory bind-mounted (
docker run -v .:/tmp), so.git/configand the token in it are visible to a third-party image.The scanner only reads the repository, and the checkout only needs the token for its own fetch, so neither the write scopes nor the persisted credential is used.
Solution
Declare the single scope the job needs, and stop persisting the credential into the mounted directory. Both settings match the same workflow in
huggingface/transformers.Changes
permissionsblock grantingcontents: readpersist-credentials: falseon the checkout, with a comment recording whyNote
Low Risk
CI-only hardening with no runtime or application behavior changes; reduces accidental token leakage to the scanner container.
Overview
Tightens secret-scanning CI so the job no longer inherits broad default token permissions or leaves credentials on disk where the TruffleHog container can read them.
Adds
permissions: contents: readat workflow scope and setspersist-credentials: falseon checkout, with a comment that the scan bind-mounts the workspace (including.git/config) into a third-party image.Reviewed by Cursor Bugbot for commit 3f2b861. Bugbot is set up for automated code reviews on this repo. Configure here.