Repository navigation
fix(connections): name the rejected OAuth endpoint on the mint card - #12972
Conversation
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsFINDING -- src/kiro_crew/security/init.py:809 -- False positive or not applicable? A repository writer can comment: |
UX Review (Fable 5) — 🟡 CONCERNSUX-level review of UX-Verdict: CONCERNS Copy-ready endpoint renders as wrapping prose with no copy affordance — shot-01 breaks Watch
[UX-REVIEWED] bd55f0c |
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing to check. [DESIGN-REVIEWED] bd55f0c |
First Principles Review (Fable 5) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS The new exemptible check resolves exactly the ambiguity the chat banner's own comment records, yet the banner still advertises remedies the allowlist cannot clear. Not justified as shipped
What this change shipsInventory (10 items) — 9 justifiedIntent: when an OAuth mint fails because the credential gate refused the authorization URL, show the user which endpoint was refused and how to allowlist it — a FIX (linked issue #7765).
[FIRST-PRINCIPLES-REVIEWED] bd55f0c |
Opus 4.8 Review — ✅ no blocking findingsReviewed Review detailsThe diff is a well-scoped, thoroughly tested change. I verified the core logic paths myself:
Nothing survives falsification, and no new grounded defect meets the bar. No findings. [OPUS-REVIEWED] bd55f0c Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
Security Scope Review -- 🟡 CONCERNSWhich legitimate operations does Verdict basis: the reviewer's own judgement; no confirmed regression. Security scope review -- adjudicated candidates
No candidate flipped from allowed to refused. Scope-Verdict: CONCERNS TIGHTENING: ADJUDICATED: 12 candidates, 0 confirmed newly-refused PLATFORM COVERAGE: posix and windows; no UNADJUDICATED: The whole tightening lives outside the shell tool-call composite, so no classifier verdict exists for it. Guard: [SCOPE-REVIEWED] bd55f0c |
…ion card The MCP OAuth chat banner names the sanitized endpoint of a URL the credential gate rejects, but the connections mint surface still reported only the opaque code mint_url_rejected and the warm premint gate only a slug. Without the host+path the user cannot know what to write into oauth_endpoints.json, so the failure reads as unfixable. The endpoint is surfaced on a NON-LOG channel. security gains sanitized_oauth_endpoint_display(url): the copy-ready contract layered on the diagnostic (host, path) pair. It returns one "host/path" string only when the pair would also be accepted by the oauth_endpoints.json loader and honoured by the gate -- host matches _OAUTH_EXTENSION_HOST_RE (so localhost, IP literals and a capped host are refused), path passes _valid_oauth_extension_path and is neither the redaction tag nor capped, scheme is https with no explicit port -- and None otherwise. mint.py stores it as MintState["rejected_endpoint"] beside reason == "mint_url_rejected"; pending_mint_for and GET /api/connections/mint carry it to the Connections card, which renders a new mint_failure_url_rejected_endpoint string and falls back to the unnamed message on None. The warning log and the audit line stay slug-only by decision, so the credential-disclosure scanners have no logger sink to flag and no suppression or barrier model is needed. sanitized_oauth_endpoint itself now marks a capped host with the same trailing ellipsis the capped path already carries, so a chopped host can no longer read as a whole hostname. warm._credential_bearing_slugs keeps its release semantics: a refused slug's claim is released, the card asks for a cold mint, and that mint names the endpoint through the surface above. Documented in docs/system-specs/modules/security.md. Tests: the display helper's signature table (nameable / unnameable, one row per rule), the mint view naming and its four unnameable controls, the log-and-audit exclusion, the wire arrival and omission, and the warm hand-off coherence. A capture harness renders the named and fallback card states from the built SPA. Closes #7765
8deac6a to
7c589f5
Compare
|
Round 2 (head UX CONCERNS (advisory) — addressed in this push
Frames from the rebuilt SPA via Named endpoint (error line + remedy line + Documentation link): Fallback when the endpoint cannot be named safely: Security Scope Review CONCERNS (advisory) — candidate inputs mapped to testsThe lane notes the display gate lives outside the shell-command classifier, so its candidates cannot be adjudicated by script. Each prose candidate is pinned by a row in
Every unnamed row falls back to the base message, so no input is refused that base accepted: the credential gate ( CodeQL on
|
…ar the rejection
Naming an endpoint and pointing at oauth_endpoints.json is only honest when
adding that entry makes the URL pass. The allowlist relaxes just the
query-entropy heuristics on standard front-channel parameters; a URL refused
for a fixed credential, userinfo, a fragment, path parameters, heavy
percent-encoding, http or an explicit port is refused again after the entry
is added.
security.oauth_rejection_is_endpoint_exemptible(url) answers that question by
re-running the real gate with the endpoint treated as approved:
diagnose_oauth_url_credential gains assume_approved_endpoint and
_exfil_url_warning gains assume_oauth_endpoint, both default-off, neither
consulting the builtin set or the operator file (so no allowlist lookup and
no extension-used audit event). sanitized_oauth_endpoint_display requires it,
which replaces its own scheme/port check. mint.py runs the display helper off
the event loop like the gate, since the counterfactual can stat the operator
file.
Card copy: the error line is one sentence in the card's own vocabulary
("approval address"); the oauth_endpoints.json remedy rides Feedback.detail as
its own line and names whoever runs the server rather than an owner; the guide
section rides Feedback.help as the existing Documentation link. Same fallback
when no copy-ready endpoint exists.
Tests: the operator-extension corpus is the positive set (rejected today,
passes under the assumption, named verbatim); unconditional rules still reject
under the assumption; the display table's nameable rows carry the long-state
query and the fixed-credential / fragment / path-params rows move to unnamed;
the mint and warm naming tests use the corpus URL and the fixed-credential URL
becomes an unnamed control.
7c589f5 to
bd55f0c
Compare
bolichen97
left a comment
There was a problem hiding this comment.
Approved after verified readiness: passed, PR Readiness success on this head, mergeable, no open change requests. [operator: bolichen97 batch review 2026-09-23]
…irodotdev#12972) * fix(connections): name the rejected OAuth endpoint on the mint rejection card The MCP OAuth chat banner names the sanitized endpoint of a URL the credential gate rejects, but the connections mint surface still reported only the opaque code mint_url_rejected and the warm premint gate only a slug. Without the host+path the user cannot know what to write into oauth_endpoints.json, so the failure reads as unfixable. The endpoint is surfaced on a NON-LOG channel. security gains sanitized_oauth_endpoint_display(url): the copy-ready contract layered on the diagnostic (host, path) pair. It returns one "host/path" string only when the pair would also be accepted by the oauth_endpoints.json loader and honoured by the gate -- host matches _OAUTH_EXTENSION_HOST_RE (so localhost, IP literals and a capped host are refused), path passes _valid_oauth_extension_path and is neither the redaction tag nor capped, scheme is https with no explicit port -- and None otherwise. mint.py stores it as MintState["rejected_endpoint"] beside reason == "mint_url_rejected"; pending_mint_for and GET /api/connections/mint carry it to the Connections card, which renders a new mint_failure_url_rejected_endpoint string and falls back to the unnamed message on None. The warning log and the audit line stay slug-only by decision, so the credential-disclosure scanners have no logger sink to flag and no suppression or barrier model is needed. sanitized_oauth_endpoint itself now marks a capped host with the same trailing ellipsis the capped path already carries, so a chopped host can no longer read as a whole hostname. warm._credential_bearing_slugs keeps its release semantics: a refused slug's claim is released, the card asks for a cold mint, and that mint names the endpoint through the surface above. Documented in docs/system-specs/modules/security.md. Tests: the display helper's signature table (nameable / unnameable, one row per rule), the mint view naming and its four unnameable controls, the log-and-audit exclusion, the wire arrival and omission, and the warm hand-off coherence. A capture harness renders the named and fallback card states from the built SPA. Closes kirodotdev#7765 * fix(connections): name the endpoint only when the allowlist would clear the rejection Naming an endpoint and pointing at oauth_endpoints.json is only honest when adding that entry makes the URL pass. The allowlist relaxes just the query-entropy heuristics on standard front-channel parameters; a URL refused for a fixed credential, userinfo, a fragment, path parameters, heavy percent-encoding, http or an explicit port is refused again after the entry is added. security.oauth_rejection_is_endpoint_exemptible(url) answers that question by re-running the real gate with the endpoint treated as approved: diagnose_oauth_url_credential gains assume_approved_endpoint and _exfil_url_warning gains assume_oauth_endpoint, both default-off, neither consulting the builtin set or the operator file (so no allowlist lookup and no extension-used audit event). sanitized_oauth_endpoint_display requires it, which replaces its own scheme/port check. mint.py runs the display helper off the event loop like the gate, since the counterfactual can stat the operator file. Card copy: the error line is one sentence in the card's own vocabulary ("approval address"); the oauth_endpoints.json remedy rides Feedback.detail as its own line and names whoever runs the server rather than an owner; the guide section rides Feedback.help as the existing Documentation link. Same fallback when no copy-ready endpoint exists. Tests: the operator-extension corpus is the positive set (rejected today, passes under the assumption, named verbatim); unconditional rules still reject under the assumption; the display table's nameable rows carry the long-state query and the fixed-credential / fragment / path-params rows move to unnamed; the mint and warm naming tests use the corpus URL and the fixed-credential URL becomes an unnamed control.


What
The Connections card now names WHICH authorization endpoint the credential gate refused when a mint ends in
mint_url_rejected, and points at theoauth_endpoints.jsonremedy — the same information the MCP OAuth chat banner already gives. The endpoint travels on a card field, never through a log or audit line.security.sanitized_oauth_endpoint_display(url)(new): the copy-ready contract layered on the diagnosticsanitized_oauth_endpointpair. Returns onehost/pathstring only when writing the entry would work — the pair passes theoauth_endpoints.jsonloader's own host/path rules AND the rejection is one the allowlist can clear;Noneotherwise.security.oauth_rejection_is_endpoint_exemptible(url)(new): re-runs the real gate with the endpoint treated as approved.diagnose_oauth_url_credentialgainsassume_approved_endpointand_exfil_url_warninggainsassume_oauth_endpoint(both default-off; neither consults the builtin set or the operator file, so no lookup and nooauth_endpoint_extension_usedaudit). Default verdicts are unchanged.connections/mint.py: at the terminal rejection, stores the display string asMintState["rejected_endpoint"];pending_mint_forprojects it besidereason.dashboard/handlers/connections.py:GET /api/connections/mintcarriesrejected_endpoint.ConnectionsPage.tsx+client.ts+ 12 locale catalogs +en-XA: the error line (mint_failure_url_rejected_endpoint) names the endpoint in the card's own "approval address" vocabulary; theoauth_endpoints.jsonremedy ridesFeedback.detailas its own line (mint_failure_url_rejected_endpoint_detail); the guide's allowlist section ridesFeedback.helpas the card's existing Documentation link. The unnamedmint_failure_url_rejectedcopy stays the fallback when no copy-ready endpoint exists (no remedy line, no link).connections/warm.py: comment-only. The warm premint gate keeps its release semantics; the ensuing cold mint names the endpoint.sanitized_oauth_endpoint: a host over_SANITIZED_OAUTH_HOST_MAX_LENis now capped WITH the trailing…the capped path already carries (before: chopped silently).docs/system-specs/modules/security.md: records the per-site scanner decision and the display contract.Why
Closes #7765. After the chat banner learned to name the sanitized endpoint, the two sibling connection-flow rejection surfaces still reported opaquely: the cold mint set only
reason=mint_url_rejectedand the warm gate returned bare slugs. Without the host+path the user cannot know what to write intooauth_endpoints.json, so the failure reads as unfixable.The issue parked on a scanner decision: threading the endpoint through the warning log trips Semgrep
python-logger-credential-disclosureand CodeQLpy/clear-text-logging-sensitive-data. This PR picks the third option the issue lists — a non-log channel — so no inline suppression or CodeQL barrier model is needed: the log and audit lines stay slug-only and the card field is not a sink either scanner models.Two advisory findings from the earlier attempt (PR #9128, closed unmerged) are folded in rather than left to a reviewer:
sanitized_oauth_endpoint_displayapplies the loader's own_OAUTH_EXTENSION_HOST_REand_valid_oauth_extension_path, then asksoauth_rejection_is_endpoint_exemptiblewhether the URL would pass with its endpoint approved. Solocalhost/authorize, an IP literal or a%-escaped path (loader refuses) and a fixed credential in the query, a fragment, path parameters,http://…or:8443(gate refuses regardless of the allowlist) all fall back to the unnamed message instead of advertising an entry that would leave the URL rejected.sanitized_oauth_endpointmarks the cap with…; the display helper refuses any capped or redacted component.How
sanitized_oauth_endpoint_displayre-runs the gate (memoized operator-file stat), somint.pycalls it throughasyncio.to_threadlike the gate itself, before taking the mint lock. Signature table, with verdicts (all pinned inTestSanitizedOAuthEndpointDisplay/TestOAuthRejectionIsEndpointExemptible;Q= a standard front-channel query whose 128-charstatetrips the long-query heuristic at any endpoint outside the allowlist):https://idp.example.com/authorize+ Qidp.example.com/authorize(host, path)host/None(diagnostic pair isNone)None…-capped)Nonelocalhost, IPv4 literal, trailing-dot host, single-label hostNone(loader host rule)%,..,\in pathNone(loader path rule)access_token=AKIA…)None(allowlist cannot clear it);paramson the pathNone(rejected unconditionally)http://,:8443,:443None(gate never grants the carve-out)None(nothing to name)Counterfactual contract (
TestOAuthRejectionIsEndpointExemptible): every corpus URL is rejected today and passes underassume_approved_endpoint=True; each unconditional rule above still rejects under the assumption; the assumption performs no allowlist lookup (spy on_approved_oauth_authorization_endpointsees zero calls); the default verdict ofoauth_url_contains_credentialis unchanged.Mutation checks (each run locally, each turned the named tests red): drop the exemptible check in the display helper (8 red), ignore the assumption in
diagnose_oauth_url_credential(1 red), ignore it in_exfil_url_warning(17 red), drop the rejected-today precondition (2 red), drop the loader host/path guard (8 red), drop the redacted/capped-path guard (1 red), cap the host without the marker (2 red), never store the endpoint inmint.py(3 red), drop the handler line (1 red), drop the view projection (4 red).Red on base:
test_security.pyfails to import onorigin/main(sanitized_oauth_endpoint_display/oauth_rejection_is_endpoint_exemptibleabsent); the 4 mint/warm naming tests fail on base (rejected_endpointnever stored/served); the 6 fallback controls pass on base by construction (they assert absence).Tests
Only the changed test files were run locally, by path:
test/test_security.py(TestSanitizedOAuthEndpoint,TestSanitizedOAuthEndpointDisplay),test/test_connections_mint.py,test/test_connections_handoff.py,test/test_connections_warm.py(new test + neighbours),test/test_security_facade.py. Static gates: black / isort / flake8 / mypy on changed files,check_black_formatting.py,check_comment_history.py,check_subprocess_encoding.py,check_agent_sdk_boundary.py,check_sync_io_in_async.py;tsc -b, eslint,i18n-check.mjs,check-i18n-keys.mjs, the per-locale style tests +catalogParity+qa+glossary.test_security.py:TestOAuthRejectionIsEndpointExemptible(corpus positive set, 7 unconditional-rule negatives, accepted-URL negative, no-lookup spy, default-unchanged);TestSanitizedOAuthEndpointDisplay: nameable table (8 rows), corpus named verbatim (3 rows), unnameable table (23 rows), loader round-trip (the display string split back into(host, path)is exactly what_validate_operator_oauth_entriesaccepts), raw-URL exclusion, redacted-pair refusal;test_overlong_host_is_capped_with_a_marker+test_a_host_at_the_cap_is_not_marked.test_connections_mint.py: the terminal rejection of the corpus URL carriesrejected_endpoint(host+path only) and neither the warning log nor the audit line carries any URL-derived text; six unnameable controls (credential-in-host, credential-in-path, loader-refuses-host, explicit-port, fixed-credential-in-query, fragment) leave the view unnamed — the existing fixed-credential rejection test now pins the unnamed outcome; the projection is present-when-stored / absent-when-not.test_connections_handoff.py: the field arrives on the wire besidereason, with exactly{slug, state, token, reason, rejected_endpoint}; omitted when not stored.test_connections_warm.py: a refused corpus premint releases the row (card pollsidle), the warm warning and audit stay slug-only, and the same URL is allowlist-exemptible and yields the copy-ready endpoint under the display contract the cold mint applies.Screenshots from the built SPA at this head via
website/scripts/capture-connections-mint-rejected-endpoint.mjs(real Connect click;/api/**stubbed; asserts the error line, the remedy line, the Documentation link href, no dialog over the card, and no scheme/query/token text on the card):Named endpoint — error line, remedy on its own line, Documentation link:
Fallback when the endpoint cannot be named safely — unnamed message, no remedy line, no link:
Pattern harvest
Rule candidate: review-prompt — a helper that produces text meant to be pasted into a config file must run the config file's own validators before returning it, and return nothing rather than a partial value — otherwise the UI advertises a remedy that the loader will refuse. Enforced here by
test_the_display_string_is_exactly_what_the_loader_would_accept.Not generalizable: the non-log channel is right for this site because a card field exists; a CLI-only surface would still have to choose between a suppression and a barrier model.
Other
sanitized_oauth_endpointnow appends…to a host it caps at 253 chars. The chat banner is the only other consumer; it never sees such a host from a real IdP, and the existingtest_overlong_host_is_cappedwas rewritten to pin the marker._exfil_url_warninganddiagnose_oauth_url_credentialeach gain one default-off keyword for the counterfactual. With the default, both are byte-for-byte the previous verdict (pinned bytest_the_default_verdict_is_unchangedand the untouched gate suites).chat_runner.py's banner text and the existingmint_failure_url_rejectedcopy. The banner shows the diagnostic pair (host + self-redacting path) as a diagnosis and spells the entry shape itself; converting it to the display/exemptible contract would change its output for redacted paths and non-exemptible rejections and is a separate decision.test_a_url_carrying_a_credential_is_refused_rather_than_stored.