fix: test fixtures no longer look like real credentials - #75
Merged
Conversation
Checking the security surfaces turned up an open GitHub secret-scanning alert
— Telegram Bot Token, opened today. It is mine: a synthetic fixture I added
this morning, written in the EXACT real shape (9 digits : 35 chars), at
tests/unit_test.py:3236. Not a live credential; nothing to rotate.
It still needs fixing. A false positive on that dashboard is not harmless —
it trains whoever reads it to wave the next one through, and the next one
might be real.
The panel's own patterns are much looser than the real formats
(^\d{5,}:[A-Za-z0-9_-]{20,}$ for Telegram, \d{5,25}/[\w-]{1,120} for a
Discord webhook), so a fixture can be equally valid and obviously fake:
123456789:AAtokenAAtokenAAtokenAAtokenAAtoken -> 12345:TESTONLYnotarealtoken00
.../webhooks/123456789012345678/AbCdEf-_01... -> .../webhooks/12345/TESTONLY-not-a-real-webhook
The webhook one had not tripped an alert yet but was in the same real shape
and would have.
A check now fails on any fixture matching a real Telegram token, Discord
webhook or GitHub token shape, so the next one is caught here rather than on
the security dashboard. Mutation-verified.
The existing alert covers a commit that is already in history, so it will not
close on its own; it is being resolved as used-in-tests separately.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Coverage variation | ✅ -0.01% coverage variation (-1.00%) |
| Diff coverage | ✅ ∅ diff coverage |
Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (c8dfe50) 11965 5894 49.26% Head commit (ae8089c) 11965 (+0) 5893 (-1) 49.25% (-0.01%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>
Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#75) 0 0 ∅ (not applicable) Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
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.
Checking the security surfaces turned up an open GitHub secret-scanning alert — Telegram Bot Token, opened today.
It's mine. A synthetic fixture I added this morning, written in the exact real shape (9 digits : 35 chars), at
tests/unit_test.py:3236. Not a live credential, nothing to rotate.It still needs fixing. A false positive on that dashboard isn't harmless — it trains whoever reads it to wave the next one through, and the next one might be real.
The fix
The panel's own patterns are much looser than the real formats (
^\d{5,}:[A-Za-z0-9_-]{20,}$for Telegram,\d{5,25}/[\w-]{1,120}for a Discord webhook), so a fixture can be equally valid and obviously fake:The webhook one hadn't tripped an alert yet, but it was in the same real shape and would have.
Guarded
A check now fails on any fixture matching a real Telegram token, Discord webhook or GitHub token shape — so the next one is caught here rather than on the security dashboard. Mutation-verified by restoring the old value.
The existing alert covers a commit already in history, so it won't close on its own; resolving it as used-in-tests separately.
unit 889 → 892 · smoke 313 · lint clean.
🤖 Generated with Claude Code