Skip to content

Fix GitHub refresh token detection - #319

Open
danielgaskins wants to merge 1 commit into
betterleaks:mainfrom
danielgaskins:fix/github-refresh-token-length
Open

Fix GitHub refresh token detection#319
danielgaskins wants to merge 1 commit into
betterleaks:mainfrom
danielgaskins:fix/github-refresh-token-length

Conversation

@danielgaskins

Copy link
Copy Markdown

What changed

  • Match the documented 76-character body used by ghr_ refresh tokens
  • Require a delimiter or end of input so longer values are not partially matched
  • Extract only the token and exclude any trailing delimiter
  • Add coverage for delimiter and EOF cases, plus incorrect lengths

Testing

  • GOMAXPROCS=2 go test -p 1 ./...

Fixes #305

@greptile-apps

greptile-apps Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Updates GitHub refresh-token detection to require a 76-character body and a trailing boundary while extracting only the token.

  • Synchronizes the generated rule and bundled configuration.
  • Adds delimiter, EOF, and invalid-length coverage.

Confidence Score: 5/5

The PR appears safe to merge.

The rule source, generated configuration, extraction group, and boundary tests are aligned, with no concrete blocking or non-blocking defect identified.

Important Files Changed

Filename Overview
cmd/generate/config/rules/github.go Updates the refresh-token regex, extraction group, and validation samples consistently.
cmd/generate/config/rules/github_test.go Covers delimiter and EOF matches plus rejected token lengths.
config/betterleaks.toml Keeps the bundled generated rule aligned with its Go source.

Reviews (1): Last reviewed commit: "Fix GitHub refresh token detection" | Re-trigger Greptile

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.

github-refresh-token rule truncates current GitHub.com refresh tokens

1 participant