Skip to content

fix: stop flagging urls as secrets in posts that mention "tru" - #846

Closed
crusadev wants to merge 1 commit into
dev-null-sh:productionfrom
crusadev:fix/secret-scan-url-false-positive
Closed

crusadev wants to merge 1 commit into
dev-null-sh:productionfrom
crusadev:fix/secret-scan-url-false-positive

Conversation

@crusadev

Copy link
Copy Markdown

Summary

Posting https://dev.to/iacobandrei/how-i-documented-a-broken-codebase-without-losing-my-mind-74m in a commit that also said something like "true" or "restructuring" showed the detected-secret warning on https://dev.to/iacobandrei.

The cause is the tru-2 rule in @sanity-labs/secret-scan 1.1.0 (the latest release):

  • Its regex \b([0-9a-zA-Z.-_]{26})\b treats .-_ as a range from . to _, which includes /, : and @. Any 26-character run of URL characters matches; https://dev.to/iacobandrei is exactly 26.
  • Its only keyword is tru, matched as a substring, so "true", "trust" or "structure" anywhere in the post turns it on.

sensitive-text.ts now ignores tru-2 findings. removeSecrets and stashableBody use the same filtered list, so the redact button and the draft stash leave the URL alone too. Every other rule still applies, and tru-2 is the only rule with this pattern bug.

Test plan

  • New tests in tests/Unit/SensitiveText.test.ts: the reported post is no longer flagged, and a real GitHub token in a post containing "true" is still found and redacted. Both fail before the fix.
  • bun run test:unit (102 passing), bun run test:types, bun run test:lint
  • Manual: paste the URL plus the word "true" into the composer and check that no warning appears

🤖 Generated with Claude Code

The secret scanner's tru-2 rule uses `[0-9a-zA-Z.-_]{26}`, whose `.-_` range includes `/` and `:`, and it is switched on by any post containing "tru" ("true", "structure"). Any 26-character URL run, like https://dev.to/iacobandrei, was then reported as a secret. Ignore that rule's findings and redact only the findings that remain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants