Skip to content

fix(connections): name the rejected OAuth endpoint on the mint card - #12972

Merged
bolichen97 merged 2 commits into
mainfrom
fix/oauth-endpoint-rejection-surfaces-7765
Sep 23, 2026
Merged

bolichen97 merged 2 commits into
mainfrom
fix/oauth-endpoint-rejection-surfaces-7765

Conversation

@CrysisDeu

@CrysisDeu CrysisDeu commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

What

The Connections card now names WHICH authorization endpoint the credential gate refused when a mint ends in mint_url_rejected, and points at the oauth_endpoints.json remedy — 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 diagnostic sanitized_oauth_endpoint pair. Returns one host/path string only when writing the entry would work — the pair passes the oauth_endpoints.json loader's own host/path rules AND the rejection is one the allowlist can clear; None otherwise.
  • security.oauth_rejection_is_endpoint_exemptible(url) (new): re-runs 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 consults the builtin set or the operator file, so no lookup and no oauth_endpoint_extension_used audit). Default verdicts are unchanged.
  • connections/mint.py: at the terminal rejection, stores the display string as MintState["rejected_endpoint"]; pending_mint_for projects it beside reason.
  • dashboard/handlers/connections.py: GET /api/connections/mint carries rejected_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; the oauth_endpoints.json remedy rides Feedback.detail as its own line (mint_failure_url_rejected_endpoint_detail); the guide's allowlist section rides Feedback.help as the card's existing Documentation link. The unnamed mint_failure_url_rejected copy 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_LEN is 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_rejected and the warm gate returned bare slugs. Without the host+path the user cannot know what to write into oauth_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-disclosure and CodeQL py/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:

  1. A copy-ready string must be one the remedy will accept AND one the remedy will fix. sanitized_oauth_endpoint_display applies the loader's own _OAUTH_EXTENSION_HOST_RE and _valid_oauth_extension_path, then asks oauth_rejection_is_endpoint_exemptible whether the URL would pass with its endpoint approved. So localhost/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.
  2. An over-long host must not be silently chopped. sanitized_oauth_endpoint marks the cap with …; the display helper refuses any capped or redacted component.

How

sanitized_oauth_endpoint_display re-runs the gate (memoized operator-file stat), so mint.py calls it through asyncio.to_thread like the gate itself, before taking the mint lock. Signature table, with verdicts (all pinned in TestSanitizedOAuthEndpointDisplay / TestOAuthRejectionIsEndpointExemptible; Q = a standard front-channel query whose 128-char state trips the long-query heuristic at any endpoint outside the allowlist):

input verdict
https://idp.example.com/authorize + Q idp.example.com/authorize
the operator-extension corpus (generic OIDC, Okta org, tenant-scoped Entra) named verbatim as the corpus's own (host, path)
Okta org / Auth0 tenant / Keycloak realm / Entra tenant path + Q named
uppercase host / mixed-case path host lowercased, path case kept
empty path host/
IDN host A-label form
userinfo, encoded userinfo, credential in host None (diagnostic pair is None)
credential in path (redaction tag) None
path over 200 chars, host over 253 chars (…-capped) None
localhost, IPv4 literal, trailing-dot host, single-label host None (loader host rule)
%, .., \ in path None (loader path rule)
fixed credential in the query (access_token=AKIA…) None (allowlist cannot clear it)
fragment, ;params on the path None (rejected unconditionally)
http://, :8443, :443 None (gate never grants the carve-out)
a URL the gate accepts None (nothing to name)

Counterfactual contract (TestOAuthRejectionIsEndpointExemptible): every corpus URL is rejected today and passes under assume_approved_endpoint=True; each unconditional rule above still rejects under the assumption; the assumption performs no allowlist lookup (spy on _approved_oauth_authorization_endpoint sees zero calls); the default verdict of oauth_url_contains_credential is 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 in mint.py (3 red), drop the handler line (1 red), drop the view projection (4 red).

Red on base: test_security.py fails to import on origin/main (sanitized_oauth_endpoint_display / oauth_rejection_is_endpoint_exemptible absent); the 4 mint/warm naming tests fail on base (rejected_endpoint never 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_entries accepts), 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 carries rejected_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 beside reason, with exactly {slug, state, token, reason, rejected_endpoint}; omitted when not stored.
  • test_connections_warm.py: a refused corpus premint releases the row (card polls idle), 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:

Connections card: the approval address from the named endpoint was rejected; remedy line names oauth_endpoints.json; Documentation link to the allowlist guide

Fallback when the endpoint cannot be named safely — unnamed message, no remedy line, no link:

Connections card with the unnamed rejection message

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

  • Declared behaviour change outside the issue's two surfaces: sanitized_oauth_endpoint now 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 existing test_overlong_host_is_capped was rewritten to pin the marker.
  • Declared touch outside the issue's two surfaces: _exfil_url_warning and diagnose_oauth_url_credential each gain one default-off keyword for the counterfactual. With the default, both are byte-for-byte the previous verdict (pinned by test_the_default_verdict_is_unchanged and the untouched gate suites).
  • Deliberately NOT changed: chat_runner.py's banner text and the existing mint_failure_url_rejected copy. 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.
  • The warm gate is not converted into a terminal failure; the release-then-cold-mint hand-off is what makes the warm refusal actionable, and it is pinned by test_a_url_carrying_a_credential_is_refused_rather_than_stored.
  • No logger line changed, so the Semgrep/CodeQL credential-logging rules are not in play.

@CrysisDeu
CrysisDeu requested review from a team and iamwhatever September 23, 2026 02:01
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 23, 2026
@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of bd55f0c1301783660e026b507b0c46efd6af06a8 and found no blocking issues.

This comment is updated in place on each push.

Review details

FINDING -- src/kiro_crew/security/init.py:809 -- return f"{host}{path}" advertises normalized IDN/empty-path entries that the gate’s raw key never matches, so adding them leaves the mint rejected -> Fix: return None unless the displayed pair exactly matches the gate key.
[GPT-REVIEWED] bd55f0c

False positive or not applicable? A repository writer can comment:
/ai-review override gpt bd55f0c1301783660e026b507b0c46efd6af06a8: <one-sentence reason>

@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Fable 5) — 🟡 CONCERNS

UX-level review of bd55f0c1301783660e026b507b0c46efd6af06a8 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

UX-Verdict: CONCERNS

Copy-ready endpoint renders as wrapping prose with no copy affordance — shot-01 breaks auth.example-idp.com at its own hyphen, inviting mistranscription into oauth_endpoints.json.

Watch

  • The PR's whole value is a "copy-ready host/path" the user writes into oauth_endpoints.json, but {{endpoint}} is interpolated into plain red prose (mint_failure_url_rejected_endpoint / _detail); in shot-01 the line wraps mid-host at the real hyphen ("auth.example- / idp.com"), so a user hand-transcribing cannot tell the hyphen from a line break and writes an entry the loader refuses — silent, and they land back on the same rejection. Every user on this path × task failure × every occurrence. Smallest fix: render the endpoint in monospace/<code> with overflow-wrap that never splits it (or a copy affordance).
  • Blind reader on the remedy line: "no idea how I would actually do this… I would not dare follow the instruction on my own" — the layering holds only because the Documentation link sits at the card's bottom edge, two lines away from the instruction that cites it. Low frequency × friction × persistent. Smallest fix: put the Documentation link inline at the end of the detail line instead of referring to it parenthetically ("the Documentation link shows where and how").

[UX-REVIEWED] bd55f0c

@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

Design-level review of bd55f0c1301783660e026b507b0c46efd6af06a8 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Nothing to check.

[DESIGN-REVIEWED] bd55f0c

@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — 🟡 CONCERNS

Premise-level review of bd55f0c1301783660e026b507b0c46efd6af06a8 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

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

  • Item 6 — symptom-level: oauth_rejection_is_endpoint_exemptible answers the question _emit_mcp_oauth_request's own comment poses — "Two distinct causes reach this branch and the user cannot tell them apart" — but is wired into only one of the two rejection surfaces. Grepped sanitized_oauth_endpoint consumers: 2 (mint display path; banner at src/kiro_crew/dashboard/chat_runner.py:2661); 1 sibling unfixed — the banner still names the endpoint and spells the oauth_endpoints.json entry for a fixed-credential URL the allowlist would never clear, the harm the description's own folded-in finding test: validate CI workflows on KiroCrew #1 names. The general fix is plausibly larger (banner copy + tests), so this is accepted-and-deferred, not a demand.
    Clears when: the banner path consumes the exemptible/display contract, or a linked issue records the deferral.

What this change ships

Inventory (10 items) — 9 justified

Intent: 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).

  1. A rejected mint's card names the refused endpoint as host/path — justified
  2. The card adds an oauth_endpoints.json remedy line — justified
  3. The card adds a Documentation link to the allowlist guide section — justified
  4. The unnamed rejection copy stays the fallback when no copy-ready endpoint exists — justified
  5. GET /api/connections/mint gains rejected_endpoint (1 consumer: the card) — justified
  6. New gate counterfactual (oauth_rejection_is_endpoint_exemptible, assume_approved_endpoint) decides when naming helps — symptom-level: applied to one of two rejection surfaces; the chat banner sibling is unfixed
  7. An over-long host in any rejection display now ends in … instead of chopping silently — justified
  8. Warm premint refusal unchanged; naming handed to the ensuing cold mint (comment-only) — justified
  9. Screenshot capture harness for both card states (repo convention, ~600 siblings) — justified
  10. security.md records the display contract in the same commit — justified

[FIRST-PRINCIPLES-REVIEWED] bd55f0c

@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Opus 4.8 Review — ✅ no blocking findings

Reviewed bd55f0c1301783660e026b507b0c46efd6af06a8 — this comment is updated in place on each push.

Review details

The diff is a well-scoped, thoroughly tested change. I verified the core logic paths myself:

  • diagnose_oauth_url_credential's new assume_approved_endpoint threads consistently through _oauth_credential_scan_target and _exfil_url_warning; HTTPS/no-port/no-userinfo/fixed-credential/fragment/path-param rejections all fire before or independently of the endpoint assumption (exfil.py:1205-1303), so the counterfactual only relaxes query entropy — matching the documented contract and the test_unconditional_rules_still_reject_under_the_assumption cases.
  • oauth_rejection_is_endpoint_exemptible correctly requires "rejected today AND passes under assumption"; the assumption never calls _approved_oauth_authorization_endpoint, so no spurious oauth_endpoint_extension_used audit.
  • sanitized_oauth_endpoint_display rejects redacted/…-capped components before joining, re-validates host/path against the same loader validators, and only names allowlist-clearable rejections — no query/fragment/port/userinfo can reach the string.
  • mint.py computes rejected_endpoint from the actual rejected oauth_url on the terminal attempt, stores it only beside reason == "mint_url_rejected", keeps every logger/audit sink slug-only, and both pending_mint_for and the handler gate the field behind an explicit key.
  • Frontend/i18n changes are consistent across all locales and the detail/help wiring rebuilds feedback fresh each render, so no stale remedy line survives a reason change.

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 bd55f0c1301783660e026b507b0c46efd6af06a8.

False positive or not applicable? A repository writer can comment:
/ai-review override fable bd55f0c1301783660e026b507b0c46efd6af06a8: <one-sentence reason>

@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Security Scope Review -- 🟡 CONCERNS

Which legitimate operations does bd55f0c1301783660e026b507b0c46efd6af06a8 newly refuse? Updated in place on each push. A script-confirmed regression blocks; the model proposes candidates and never decides a refusal.

Verdict basis: the reviewer's own judgement; no confirmed regression.

Security scope review -- adjudicated candidates

  • macos-latest (platform posix): 8 classified, 0 newly refused, 8 still allowed.
  • ubuntu-latest (platform posix): 8 classified, 0 newly refused, 8 still allowed.
  • windows-latest (platform windows): 4 classified, 0 newly refused, 4 still allowed.

No candidate flipped from allowed to refused.

Scope-Verdict: CONCERNS

TIGHTENING: sanitized_oauth_endpoint_display / oauth_rejection_is_endpoint_exemptible — a new naming gate on the mint-rejection card that refuses to surface an endpoint unless writing the oauth_endpoints.json entry would actually clear the rejection — the one threat it refuses is echoing credential-bearing or non-actionable endpoint text onto the card: "a URL refused for a fixed credential, userinfo, a fragment, path parameters, heavy percent-encoding, http or an explicit port would be refused again after the entry is added, so it stays unnamed rather than advertise a remedy that cannot work." The enforcement predicate itself is not tightened: the diff's own test pins it — "assume_approved_endpoint defaults off, so the boolean gate every caller uses is byte-for-byte the old one" — and no path fence, sensitive-command tier, exfiltration deny shape, or rule-catalog entry is touched.

ADJUDICATED: 12 candidates, 0 confirmed newly-refused
No confirmed rows were handed back at review time. The candidates probe the boundaries adjacent to the touched code: the exfil-tier neighbours of _exfil_url_warning (a presigned-URL download, an OAuth authorize URL with ordinary short state opened by the user, the localhost mint-state poll), the maintainers' daily operations in the touched area (the sanctioned pytest invocations for test_security.py and test_connections_mint.py, the PR's own screenshot harness, greps and pathspec history over the security tree), and the guide/discovery reads the new card copy sends an operator into.

PLATFORM COVERAGE: posix and windows; no any rows, because every candidate carries a path or an executable name. Executable-bearing operations were written in both spellings — curl and curl.exe, xdg-open and cmd /c start, .venv/bin/python and .venv\Scripts\python.exe, grep and Get-Content, forward-slash and backslash test paths. The diff's own enforcement-side change is pure URL-string logic (hosts, paths, query parameters) with no path-separator, argv-shape, interpreter, or environment-variable assumption, so it assumes no platform the candidates leave unprobed; the dual spellings guard the composite's surrounding tiers rather than anything this diff asserts about a host. Per-leg verdicts are the deterministic fold's to report, not mine.

UNADJUDICATED: The whole tightening lives outside the shell tool-call composite, so no classifier verdict exists for it. Guard: sanitized_oauth_endpoint_display (src/kiro_crew/security/init.py), backed by oauth_rejection_is_endpoint_exemptible and diagnose_oauth_url_credential(assume_approved_endpoint=True) (src/kiro_crew/security/exfil.py), plus the … cap marker added inside sanitized_oauth_endpoint. Call path: the ACP client returns an oauthUrl → start_oauth_mint (src/kiro_crew/connections/mint.py) refuses it twice via oauth_url_contains_credential → sanitized_oauth_endpoint_display(oauth_url) decides whether MintState["rejected_endpoint"] is set → pending_mint_for → GET /api/connections/mint (src/kiro_crew/dashboard/handlers/connections.py) → the ConnectionsPage card renders either the named remedy or the unnamed fallback; separately, _emit_mcp_oauth_request in chat_runner.py renders the …-marked host in the banner rejection text. Candidate legitimate inputs I would have submitted: a single-label intranet IdP (https://idp/authorize?...), an enterprise IdP on an explicit port (https://sso.corp.example.com:8443/authorize?...), an IDN-host IdP, an Okta org / Auth0 tenant / Keycloak realm / tenant-scoped Entra URL with long opaque state, and a host exactly at the DNS length cap. Reading the base tree against the diff: every case where the helper declines to name is anchored to a refusal the extension loader or the gate already makes at base (the loader would skip localhost/IP/single-label hosts; the gate never exempts ports, fragments, or fixed credentials), and the unnamed fallback is exactly the base behavior — at base the card never named any endpoint — so I can argue, but not confirm, that no legitimate operation is newly refused relative to base. That adjudication gap, not a suspected loss, is what keeps this at CONCERNS rather than PASS.

[SCOPE-REVIEWED] bd55f0c

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 23, 2026
…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
@CrysisDeu
CrysisDeu force-pushed the fix/oauth-endpoint-rejection-surfaces-7765 branch from 8deac6a to 7c589f5 Compare September 23, 2026 02:49
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 23, 2026
@CrysisDeu

Copy link
Copy Markdown
Contributor Author

Round 2 (head 7c589f569) — what changed since 8deac6ad4, and the Security Scope candidate mapping.

UX CONCERNS (advisory) — addressed in this push

  • Vocabulary: the error line now says "approval address", the same term as every sibling mint string: mint_failure_url_rejected_endpoint = "The approval address from {{endpoint}} looked like it carried a credential, so it was not displayed."
  • Paragraph wall: the remedy moved out of the alarm line into Feedback.detail (its own line, new key mint_failure_url_rejected_endpoint_detail), and the guide is now the card's existing Feedback.help "Documentation" link pointing at the guide's allowlist section — no bare docs path in the copy. Fallback (no copy-ready endpoint) is unchanged: unnamed message, no remedy line, no link.

Frames from the rebuilt SPA via website/scripts/capture-connections-mint-rejected-endpoint.mjs (asserts the error line, the remedy line, the link href, no dialog over the card, and no scheme/query/token text on the card):

Named endpoint (error line + remedy line + Documentation link):

Connections card: approval address from the named endpoint rejected, remedy on its own line, Documentation link

Fallback when the endpoint cannot be named safely:

Connections card: unnamed rejection message, no remedy line, no link

Security Scope Review CONCERNS (advisory) — candidate inputs mapped to tests

The 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 TestSanitizedOAuthEndpointDisplay (test/test_security.py):

candidate verdict test row
Okta org https://dev-123456.okta.com/oauth2/default/v1/authorize named okta-org (added this round)
Auth0 tenant https://acme.us.auth0.com/authorize named auth0-tenant (added this round)
Keycloak realm .../realms/dev/protocol/openid-connect/auth named keycloak-realm (added this round) + test_the_display_string_is_exactly_what_the_loader_would_accept
tenant-scoped Entra path named multi-segment-path
IDN host named, A-label idn-host-in-a-label-form
self-hosted IdP on an explicit port https://sso.corp.example:8443/authorize unnamed (gate never grants the carve-out) explicit-port, explicit-default-port; end-to-end control test_a_rejection_the_helper_cannot_name_leaves_the_card_unnamed[explicit-port]
single-label intranet host https://idp/authorize unnamed (loader refuses) single-label-host
IP-literal LAN IdP unnamed (loader refuses) ipv4-literal
localhost unnamed (loader refuses) localhost-no-letter-tld; end-to-end control [loader-refuses-host]

Every unnamed row falls back to the base message, so no input is refused that base accepted: the credential gate (oauth_url_contains_credential) and the warm release path are byte-identical to origin/main in this diff, and the display gate only decides whether to ADD a hint base never showed.

CodeQL on 8deac6ad4

Analyze (python) ended "configuration error": the SARIF upload hit API rate limit exceeded for installation (job 107015195000). No code finding; superseded by this head, no rerun spent.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 23, 2026
…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.
@CrysisDeu
CrysisDeu force-pushed the fix/oauth-endpoint-rejection-surfaces-7765 branch from 7c589f5 to bd55f0c Compare September 23, 2026 03:17
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 23, 2026

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved after verified readiness: passed, PR Readiness success on this head, mergeable, no open change requests. [operator: bolichen97 batch review 2026-09-23]

@bolichen97
bolichen97 merged commit fa3cf77 into main Sep 23, 2026
98 checks passed
@bolichen97
bolichen97 deleted the fix/oauth-endpoint-rejection-surfaces-7765 branch September 23, 2026 04:39
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Sep 23, 2026
wknight1 pushed a commit to wknight1/KiroCrew that referenced this pull request Oct 5, 2026
…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.
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.

Name the rejected OAuth endpoint in the connections mint/warm rejection surfaces

2 participants