Repository navigation
fix(perception): stop flagging typeids as high-entropy secrets - #63
Merged
Merged
Conversation
A TypeID with a prefix of five or more letters is 32 characters or longer, so high_entropy checked it like any other token and often flagged it. Loomplane's release review stopped about 1 run in 20 because a tool result held atask_01m71vem2ge808nc95ad4hj3bq. The suffix is a UUID in base32, and UUIDs are already skipped, so TypeIDs now are too. Tokens close to the format (upper case, a first suffix character past 7, a letter outside Crockford base32, a prefix starting with '_') are still checked.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
GO-2026-6865 (a panic on two-block frames) reaches shield through the mongo store's Migrate, so govulncheck fails the Security job. v1.20.2 fixes it.
Contributor
Author
|
Added a second commit: govulncheck started failing Security on GO-2026-6865, a new advisory in klauspost/compress that the mongo store reaches through Migrate. It isn't from the typeid change, and main will hit it on its next run too. The bump to v1.20.2 clears it (govulncheck on go1.26.10, the Go CI runs: 0 vulnerabilities). |
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.
high_entropyno longer flags TypeIDs. You'll see this when an agent's tool result carries an ID likeatask_01m71vem2ge808nc95ad4hj3bq: with a prefix of five or more letters the ID is 32 characters long, so the detector checked it and, depending on the characters it happened to get, scored it as a secret at 0.6. In Loomplane that stopped the release review agent about 1 run in 20, because cortex's publication gate scans tool results with shield.The suffix of a TypeID is a UUID written in Crockford base32, and we already skip UUIDs, so
isTypeIDsits right next toisUUIDinentropyToken. It follows the TypeID spec: a prefix of up to 63 lower-case letters and_that starts and ends with a letter, then_, then 26 characters of the base32 alphabet with the first one 0 to 7. Shield's own IDs (scan_…,pol_…) have this shape too.Anything close to that shape still gets checked. The new test pins four near-misses that are flagged today and stay flagged: upper case in the prefix, a first suffix character past 7, a
u(not in the alphabet), and a prefix that starts with_.What this doesn't cover
A path that joins IDs with
/, such asaorg_<id>/provider-keys/aikey_<id>, is still flagged. The detector only splits a token on/when it also holds a., because standard base64 holds/. Changing that is its own decision, so it's left out of this PR.Checked
TestTypeIDsAreNotSecretsfails on main (all three IDs flagged) and passes hereGOWORK=off go test -race -count=1 ./...go vet,gofmt -l,goimports -l -local github.com/xraph/shield .golangci-lint run --max-same-issues=0 --max-issues-per-linter=0 ./awareness/...: 0 issuesgosec -exclude=G115 ./awareness/perception/...: clean