Skip to content

fix(perception): stop flagging typeids as high-entropy secrets - #63

Merged
juicycleff merged 2 commits into
mainfrom
fix/typeid-not-secret
Nov 10, 2026
Merged

juicycleff merged 2 commits into
mainfrom
fix/typeid-not-secret

Conversation

@juicycleff

Copy link
Copy Markdown
Contributor

high_entropy no longer flags TypeIDs. You'll see this when an agent's tool result carries an ID like atask_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 isTypeID sits right next to isUUID in entropyToken. 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 as aorg_<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

  • TestTypeIDsAreNotSecrets fails on main (all three IDs flagged) and passes here
  • GOWORK=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 issues
  • gosec -exclude=G115 ./awareness/perception/...: clean

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

codecov Bot commented Nov 10, 2026

Copy link
Copy Markdown

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.
@juicycleff

Copy link
Copy Markdown
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).

@juicycleff
juicycleff merged commit 16d2c12 into main Nov 10, 2026
13 of 14 checks passed
@juicycleff
juicycleff deleted the fix/typeid-not-secret branch November 10, 2026 21:07
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.

1 participant