Skip to content

fix: stop flagging ordinary words as secrets in posts that mention Docker - #600

Closed
rohitsasi720 wants to merge 1 commit into
dev-null-sh:productionfrom
rohitsasi720:fix/secret-warning-docker-usernames
Closed

rohitsasi720 wants to merge 1 commit into
dev-null-sh:productionfrom
rohitsasi720:fix/secret-warning-docker-usernames

Conversation

@rohitsasi720

@rohitsasi720 rohitsasi720 commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #572.

Problem

The composer warned that a perfectly normal reply contained a secret, and "Select possible secret" selected the word want.

Two Docker Hub rules in @sanity-labs/secret-scan, dockerhub-v1-1 and dockerhub-v2-1, share this regex, run whenever the text mentions "docker", and have no entropy floor:

/(?:user|usr|-u|id)\S{0,40}?[:=\s]{1,3}[ '"=]?([a-zA-Z0-9]{4,40})\b/im

So the word after any id, user or usr, even inside another word, counts as a secret:

Text Flagged
I didn't want Docker on my Mac want
Our users love Docker compose love
I paid good money for Docker Desktop good
docker login -u rohit -p dckr_pat_… rohit (the username, not the token)

They come from TruffleHog, where they find the username half of a username and token pair. A username isn't a secret, and Docker's tokens have a rule of their own (dockerhub-v2-2).

Fix

resources/js/lib/sensitive-text.ts, the only place that calls the scanner, ignores those two rules: findSecrets leaves their findings out, removeSecrets keeps their text, and stashableBody follows findSecrets, so these drafts are stashed again too.

Only these two of the scanner's 1,115 rules use this pattern. Leaving them out changes nothing else, and is narrower than an entropy floor on every rule, which could also hide real short passwords.

In the composer Before After
I didn't want Docker on my Mac warning, selects want no warning
Our users love Docker compose warning, selects love no warning
docker login -u rohit -p dckr_pat_… warning, selects rohit warning, selects the token

Tests

  • tests/Unit/SensitiveText.test.ts: posts that mention Docker keep their words (no findings, nothing redacted, stashable), and a Docker access token next to docker login -u is still found, without the username. Both tests fail on production and pass here.
  • bun run test:unit (69 tests), bun run test:lint, bun run test:types and the component tests pass.
  • Checked in the composer with Playwright, typing the posts in the table above on production and on this branch.

While checking prose for other false positives, the tru-2 rule also flagged file paths such as resources/js/pages/terminal/show.tsx. That's a separate pattern, so it's not part of this PR.

@rohitsasi720
rohitsasi720 force-pushed the fix/secret-warning-docker-usernames branch from 370b12a to 321c964 Compare October 19, 2026 14:44
@nunomaduro nunomaduro added the bug Something isn't working label Oct 19, 2026
@kachelle

Copy link
Copy Markdown
Contributor

i had same issue with this commit -> https://dev-null.sh/@kachelle/commits/01a15590-b0fa-7136-855c-cba9b2c082a3

It flagged the uuid of the github-commit

@rohitsasi720

Copy link
Copy Markdown
Contributor Author

Thanks @kachelle! That one is a different rule: the scanner reads the 40-character hash in a GitHub commit link as a GitHub OAuth secret. I've opened #763 for it so this one stays small.

@brendt
brendt requested a review from xHeaven October 20, 2026 09:26
…cker

Two Docker Hub rules in the secret scanner look for a username: once a
post mentions Docker, they flag the word after any "id", "user" or "usr",
even inside words, so "I didn't want Docker on my Mac" flagged "want".
A username isn't a secret, and Docker's tokens have a rule of their own,
so the composer now ignores those two rules.

Fixes dev-null-sh#572
@rohitsasi720
rohitsasi720 force-pushed the fix/secret-warning-docker-usernames branch from 321c964 to f5a06cb Compare October 22, 2026 09:53
@xHeaven

xHeaven commented Oct 22, 2026

Copy link
Copy Markdown
Member

Note

This message is generated by gpt-6.1-sol on behalf of xHeaven. It may contain errors—verify important details.

Closing because the secret scanner and all related warnings have been removed in #999, so this scanner-specific fix is no longer needed.

@xHeaven xHeaven closed this Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Detected secret?

4 participants