Repository navigation
Detect Linear API keys - #84
Closed
akgupta2002D wants to merge 3 commits into
Closed
akgupta2002D wants to merge 3 commits into
akgupta2002D wants to merge 3 commits into
Conversation
Reproduces omerbek#63: scan_line_for_secrets returns [] for a lin_api_ key because there is no Linear pattern in SECRET_PATTERNS yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The file-level test fails unless lin_api_ is also in CANDIDATE_LITERALS, since check_file_contents skips lines that has_candidate() rejects. The 39-character case guards against false alarms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add a Linear API key pattern to SECRET_PATTERNS (lin_api_ followed by 40 letters or digits, as in the issue and gitleaks' default rule) and add lin_api_ to CANDIDATE_LITERALS so file scans reach the line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
omerbek
added a commit
that referenced
this pull request
Nov 23, 2026
omerbek
added a commit
that referenced
this pull request
Nov 23, 2026
Merged
Author
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.
Fixes #63
What this changes and why
RepoDx didn't report Linear personal API keys (
lin_api_...). There were two gaps, and this PR fixes both:("Linear API key", r"\blin_api_[A-Za-z0-9]{40}\b")toSECRET_PATTERNS, next to Replicate."lin_api_"toCANDIDATE_LITERALS. Without it,check_file_contentsdrops the line at thehas_candidatechecks (lines 789 and 797) before it reaches the scanner. So the regex alone passes the issue's line-level test but still misses the key in a real file scan.Tests:
test_detects_provider_keys, built withfake(...).test_detects_linear_api_key_in_a_file: one critical "Linear API key" finding atsrc/config.js:2. This test fails if only the regex is added.test_linear_api_key_needs_forty_characters: 39 characters isn't reported. It passes before and after, so it's a false-alarm guard, not proof of the fix.Not changed: severities,
looks_fake,FIXES, the README provider lists, versions, and the CHANGELOG. I followed how #43, #47 and #60 were shaped.On length: Linear doesn't document it. I matched exactly 40, as the issue suggests. That's also gitleaks' default rule (
lin_api_(?i)[a-z0-9]{40}). One third-party page shows a 32-character example, which this pattern won't catch. If you'd rather accept a range, it's a one-character change, and I'm happy to make it.Before and after
Fake keys built at runtime. The full scan is of a folder whose
config.jsreadsprocess.env.FOOand holds a 40-character key.Before (main e845025):
After (this branch):
With
repodx.pyreverted to main, the new tests fail (FAILED (failures=2)). With only the regex added, the file-level test fails (FAILED (failures=1)).Checks
python3 -m unittest discover:Ran 117 tests ... OKon Python 3.13.2 and 3.9.6python3 repodx.py .:100/100 (A), 0 critical, 0 warnings, 0 infoAI use
I used Claude Code (Anthropic) throughout. It helped me:
check_file_contentsand spot theCANDIDATE_LITERALSgapI chose the length and the scope, checked every output above myself, and reviewed the diff line by line.