Repository navigation
fix(sanitizer): URL-userinfo redaction no longer swallows JSON across keys (abilityai/trinity#3769) - #3770
Merged
Conversation
…3769) `redact_url_userinfo` matched `://` up to the next `@`, excluding only `/`, `@` and whitespace. Compact JSON has none of those between a URL value and the next key, so `{"iss":"https://agent.example","sub":"aauth:[email protected]"}` became `{"iss":"https://***@agent.example"}` — the AAuth identity an external verifier echoes back never reached the agent, and the body was no longer valid JSON. The same rule runs on every foreign-text exit (A2A replies, AAuth resource bodies, git and docker errors) on both sides of the boundary. The userinfo span now also stops at `"`, `<`, `>` and an escaped quote `\"`, none of which can appear unencoded in userinfo. A bare backslash still matches, so `CORP\user:pw@proxy` stays redacted. Applied to the backend and agent-server copies alike; a shared table pins both. Co-Authored-By: Claude Opus 5.5 <[email protected]>
vybe
enabled auto-merge (squash)
October 15, 2026 19:55
trinity-ability
approved these changes
Oct 15, 2026
trinity-ability
left a comment
Contributor
There was a problem hiding this comment.
Validated: Lane C, all Tier 1 checks plus journey-smoke/e2e green on the PR; the regression test goes red (13 cases) with the fix reverted.
3 tasks done
dolho
added a commit
that referenced
this pull request
Oct 22, 2026
) Review follow-up on #3876. The name-only suffix rule took secret-bearing URLs out of the exact-value set: capability paths (Slack response URL, private iCal feed), SAS `&sig=` queries, fragments, `;PWD=` connection strings, and userinfo the #3770 regex stops short of. None of those are caught by redact_url_userinfo or the KEY=value pass. A URL-suffixed value now leaves the set only when it parses as a plain http(s)/ws(s) URL with no userinfo, query, fragment, `;`, percent-encoding, or token-shaped/secret-named path segment; anything else stays in (fail-closed). Host/repo/region/team-id names stay name-based. PAT joins the secret name words to match secret_settings._CREDENTIAL_SUFFIXES. Co-Authored-By: Claude Opus 5.5 <[email protected]>
vybe
pushed a commit
that referenced
this pull request
Oct 23, 2026
#3840) (#3876) * fix(sanitizer): keep non-secret config values out of the redaction set (#3840) The vendor prefixes in SENSITIVE_VAR_PATTERNS (FIBERY_.*, GITHUB_.*, TRINITY_MCP.*) put the VALUE of every matching variable into the exact-value set, so FIBERY_HOST=acme.fibery.io erased the hostname from every link an agent replied with (https://***REDACTED***/...). A name ending in a non-secret suffix (_HOST, _URL, _REPO, _TEAM_ID, _REGION, ...) now stays out of the value set unless it also carries a secret word (KEY, TOKEN, SECRET, PASS, AUTH, HOOK, ...), so SLACK_WEBHOOK_URL still redacts. Credentials inside a config URL are still caught by redact_url_userinfo, and the KEY=value pass keeps every vendor prefix. Fixes #3840 Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(sanitizer): pin the #3840 name check as linear and off the hot path Measured linear (0.46ms at 4 KB, 6.3ms at 64 KB, ~100ms at 1 MB) and reached only from the cached value loader; sanitize_text is unchanged (238ms per MB on both dev and this branch). The tests keep it that way. Related to #3840 Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(sanitizer): exempt _URL/_URI/_ENDPOINT values only when plain (#3840) Review follow-up on #3876. The name-only suffix rule took secret-bearing URLs out of the exact-value set: capability paths (Slack response URL, private iCal feed), SAS `&sig=` queries, fragments, `;PWD=` connection strings, and userinfo the #3770 regex stops short of. None of those are caught by redact_url_userinfo or the KEY=value pass. A URL-suffixed value now leaves the set only when it parses as a plain http(s)/ws(s) URL with no userinfo, query, fragment, `;`, percent-encoding, or token-shaped/secret-named path segment; anything else stays in (fail-closed). Host/repo/region/team-id names stay name-based. PAT joins the secret name words to match secret_settings._CREDENTIAL_SUFFIXES. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(sanitizer): exempt _HOST/_REPO/... values only when plain, and any 16+ segment is token-shaped (#3840) Second #3876 review. The non-URL non-secret suffixes were still exempted on the name alone, the class already closed for _URL: DB_HOST=Server=x; Pwd=..., MONGO_HOST=mongodb://app:ab"cd@db/app and DATABASE_PROJECT= Host=db;Password=... left the value set and reached replies verbatim. A _HOST/_REPO/_PROJECT/... value now leaves the set only when it holds none of ;@?#%"', whitespace, backslash or ://. _is_token_shaped no longer requires mixed letters and digits: a 16+ character path segment that is all letters (a capability URL) or all digits (a private feed id) keeps the URL in the set. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
Summary
redact_url_userinfomatched://up to the next@, excluding only/,@and whitespace, so compact JSON pairing a URL with a later@-bearing value was swallowed across keys. The AAuth whoami reply{"iss":"https://agent.example","sub":"aauth:[email protected]"}reached the agent as{"iss":"https://***@agent.example"}.",<,>and an escaped quote\". None of these can appear unencoded in a URL's userinfo, and they delimit JSON strings (nested ones too) and HTML attributes. A bare\still matches, soCORP\user:pw@proxystays redacted.Changes
src/backend/utils/credential_sanitizer.py: the rule now reads://(?:[^/@\s"\\<>]|\\(?!"))+@docker/base-image/agent_server/utils/credential_sanitizer.py: same ruletests/unit/test_3769_url_userinfo_json.py(new): runs both copies against one shared table, plus the AAuth path througha2a_client.sanitize_outbound_textSecurity note
The only credential-bearing input that is no longer redacted is a password containing a raw
",<,>or\". A valid URL must percent-encode these, and the encoded forms still redact. A2A replies are also scrubbed for the exact credential before this rule runs. There is no ReDoS risk: the span cannot contain/, so a match can't run past the next://. A hostile 400 KB input runs in about 3 ms.Test Plan
cd tests && pytest unit/test_3769_url_userinfo_json.py -v(37 passed; 13 fail on the old regex)whoami.aauth.devthroughcall_aauth_resourcesees its fullaauth:<agent>@<issuer-host>identity (not run: no stack available this session)Follow-up, out of scope:
utils/url_validation.py::scrub_url_credentials_in_texthas the same over-match on compact JSON. It runs on skill-source and git paths, not A2A or AAuth.Fixes #3769
🤖 Generated with Claude Code