Repository navigation
fix: stop flagging the commit hash in a GitHub link as a secret - #763
Merged
brendt merged 1 commit intoOct 22, 2026
Merged
Conversation
Once a post mentions GitHub, the scanner reads any 40-character hex string as a GitHub OAuth secret, so sharing a commit link raised the "possible secret" warning. A hash that's a segment of a link's path is an address, so it's no longer flagged. A secret in a link's query or before its host, or written outside a link, still is.
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.
Follow-up to @kachelle's comment on #600: sharing a GitHub commit link raises the "Possible secret detected" warning.
Problem
@sanity-labs/secret-scan's rulegithub_oauth2-2matches any 40-character hex string once the text contains "github", with no entropy floor. Every commit hash is exactly that, sohttps://github.com/owner/repo/commit/<hash>(or a/blob/<hash>/…,/tree/<hash>,/pull/1/commits/<hash>link) is flagged as a GitHub OAuth secret, and the draft isn't stashed.Fix
resources/js/lib/sensitive-text.tsskips agithub_oauth2-2match when it's a segment of a link's path: the text right before it, up to the last whitespace, is a host followed by a path ending in/.findSecrets,removeSecretsandstashableBodyall apply it, so the warning, "remove secrets" and the stash agree.Still flagged:
?client_secret=<hash>),https://<hash>@github.com/…,https://user:<hash>@…),No other rule changes. #600 edits the same file for the Docker username rules; whichever merges second needs a small rebase, and I'll do it.
Before and after
production)Tests
tests/Unit/SensitiveText.test.ts: commit and blob links pass throughfindSecrets,removeSecretsandstashableBodyunchanged; a GitHub secret outside a link path, in a clone URL, and beside a commit link is still redacted. Both fail without the fix.bun run test:lint,bun run test:typesandbun run test:unit(103 tests) pass locally.