Skip to content

fix(security): accept ClickUp's compact-JWS client_id at its OAuth endpoint - #16816

Closed
iamwhatever wants to merge 1 commit into
mainfrom
fix/oauth-jws-client-id-12796
Closed

iamwhatever wants to merge 1 commit into
mainfrom
fix/oauth-jws-client-id-12796

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Let ClickUp's MCP server, whose dynamic client registration issues a compact-JWS client_id, be authorized through the ACP OAuth banner.

The banner-safety gate's fixed-credential signature matches any eyJ-prefixed three-segment base64url run, so ClickUp's consent URL (https://mcp.clickup.com/oauth/authorize, from its RFC 8414 metadata) is refused as carrying a credential and no banner renders.

Why it matters

ClickUp's MCP server cannot be authorized today. A JWS-shaped client_id is indistinguishable by shape from a bearer JWT, so the exemption has to be pinned to the issuer that needs it rather than granted at every approved endpoint.

Not a goal

  • Not a generic compact-JWS exemption: no other built-in endpoint and no operator oauth_endpoints.json entry gains it.
  • Not widening any credential signature or exempting any parameter other than client_id.

What changed (motivation → approach → change)

  • Symptom: a compact-JWS client_id at ClickUp's endpoint is rejected as a credential.
  • Root cause: the JWS credential signature cannot tell that identifier from a bearer token.
  • Change: exfil._blank_clickup_jws_client_id blanks the client_id value before every credential scan, only when the URL is https://mcp.clickup.com/oauth/authorize (no port, no fragment) and the value is pure base64url with two dots, its header (after an optional mcp-client- label, ≤256 chars) is a JOSE object whose alg fixes the signature's exact length, and its payload (≤1024 chars) is a JSON object that is not a dashboard link token. Every segment and the decoded header and payload face the fixed-credential scan; the decoded text faces the bare-secret scan. The decoded header and payload may hold no backslash and no repeated key, and every JSON key and string value is scanned. The signature segment is base64url-decoded and refused if its bytes hold a fixed credential or any 12-byte printable ASCII run. Residual: 32 markerless random bytes in the signature (more for longer algs) cannot be told from a real digest; that slot is not bare-secret scanned because a real HS256 signature trips that heuristic ~25% of the time. ClickUp's endpoint joins the approved list.
  • _PACKAGE_LINE_BUDGET 28,844 → 28,979 (main's own raises since then included) with a justification paragraph (the +75 lines are the pinned carve-out). The security spec (docs/system-specs/modules/security.md) describes the carve-out.

Backwards compatibility

Compatible: only ClickUp's endpoint accepts something it refused before; every other URL gets the same verdict as on main.

Removes nothing: no capability, path, key or validator is removed.

Tests

test/test_mcp_oauth_banner.py::TestJwsClientIdCarveOut:

  • Accepted: the ClickUp JWS client_id, and an opaque one.
  • Refused by endpoint: unapproved host, GitLab and GitHub (approved, but not ClickUp), wrong path, explicit port, http, case-variant param name, and an operator-approved endpoint (assume_approved_endpoint=True).
  • Refused by shape: credential marker, one dot, standard base64, double-encoded, %2E separators, a marker in any segment, a signature that does not fit its alg exactly (short bare secret, 56 KB, NONE, non-string alg), an unknown label, a credential or bare secret inside the decoded payload, a \u-escaped, \/-split, key-position or nested credential, a repeated key or any backslash, and a credential or 12-byte printable run hidden in the decoded signature.
  • Reviewer repros, kept refused: a bearer JWT at GitHub; an alg=none header with a bare secret (GitHub and ClickUp); an unsigned header; a dashboard link token inside client_id (as payload+signature, reordered, or nested in a claim).
  • A marker in state or an unknown param is still caught beside a JWS client_id; a deeply nested header returns a verdict instead of raising.

test/oauth_url_corpus.py — ClickUp regression entry (synthetic JWS, no real credential).

Local: 518 passed across the OAuth/exfil test files, plus test_security_gate_liveness.py.

Manual verification

N/A — unit coverage sufficient; the gate is a pure function of the URL.

Related Issues

Fixes #16815

Pattern harvest

Not generalizable: a one-off identifier form pinned to its single issuer.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Credit: this fix builds on the work of @zachary-povey in #12796 (Co-authored-by: trailer preserved). Supersedes #12796.

@iamwhatever
iamwhatever requested a review from a team as a code owner October 4, 2026 18:32
@iamwhatever
iamwhatever requested a review from kyleseaman October 4, 2026 18:32
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 4, 2026
@github-actions

github-actions Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — 🟡 CONCERNS

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

Design-Verdict: CONCERNS

Nothing shows a real ClickUp-issued client_id passing this predicate. If any one of the strict checks fails on a real one, the banner stays blocked with no error.

Watch

  • Built against synthetic input. The PR's only accepted JWS is made up: the corpus entry says "the segments below are synthetic… the signature is filler", and the description says "Manual verification: N/A — unit coverage sufficient". But _is_clickup_jws_client_id stacks many conjunctive guesses about ClickUp's real format:

    • a header of 256 characters or fewer, and a payload of 1024 or fewer;
    • an alg from _JWS_SIGNATURE_LENGTHS, with the signature exactly the length that alg implies;
    • an mcp-client- label placed on the header segment;
    • no backslash in the decoded JSON;
    • no bare-secret hit on any payload string value.

    The last one matters most. A real payload holding a random client UUID, nonce or hashed tenant id can trip _text_contains_bare_secret. Any of these would leave ClickUp exactly as broken as before, and every test would still pass. A revert or tweak can undo this, but MCP OAuth: a compact-JWS client_id is rejected by the banner-safety gate at an approved endpoint #16815 would be shipped as "fixed" without being fixed.

    Clears when: one of these is in the PR — a test case built from a real ClickUp registration's header and payload (with the signature swapped for random bytes of the same length), or a manual run where the ClickUp banner renders, described in the PR.

[DESIGN-REVIEWED] 11e1c46

Description read

[DESCRIPTION-READ] 1124eb996a4f6a36c1bca5f34c1c14effe4c62846f5dfb743eb7c32ccb97898c

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 11e1c46b4260af6ee200e71f4069465c8b68a8a6 — 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: PASS

At ClickUp's endpoint, the signature segment can still carry 32–512 random-looking bytes chosen by the URL's author; a maintainer should confirm that this stated residual is acceptable.

What this change ships

Inventory (5 items) — 5 justified

Intent: authorize ClickUp's MCP server through the ACP OAuth banner, even though its registration issues a client_id shaped like a JWT. This is a FIX (#16815).

  1. The ClickUp consent URL with a compact-JWS client_id now passes the gate, so the banner renders — justified
  2. mcp.clickup.com/oauth/authorize joins the built-in approved endpoints, so the state and PKCE entropy exemptions apply there — justified
  3. The package line budget rises from 28,864 to 28,979 — justified
  4. The security spec describes the ClickUp carve-out — justified
  5. A ClickUp regression entry is added to the legitimate-URL corpus — justified

[FIRST-PRINCIPLES-REVIEWED] 11e1c46

Description read

[DESCRIPTION-READ] 8857232f0e52c889a06e4891462a0ce0bf8118b94ef042a682a557016a88c802

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

Comment thread src/kiro_crew/security/exfil.py Fixed
@iamwhatever
iamwhatever force-pushed the fix/oauth-jws-client-id-12796 branch from c918053 to ee1f7ac Compare October 4, 2026 18:43
@github-actions

github-actions Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Security Scope Review -- 🟡 CONCERNS

Which legitimate operations does 11e1c46b4260af6ee200e71f4069465c8b68a8a6 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): 10 classified, 0 newly refused, 10 still allowed.
  • ubuntu-latest (platform posix): 10 classified, 0 newly refused, 10 still allowed.
  • windows-latest (platform windows): 3 classified, 0 newly refused, 3 still allowed.

No candidate flipped from allowed to refused.

Scope-Verdict: CONCERNS

TIGHTENING: Nothing in this diff gets stricter. The change loosens the OAuth consent-URL banner gate (diagnose_oauth_url_credential) in two places: ("mcp.clickup.com", "/oauth/authorize") joins _OAUTH_AUTHORIZATION_ENDPOINTS, and url = _blank_clickup_jws_client_id(url) now runs before every scan. The threat the gate keeps refusing is a credential carried inside a consent URL. The new carve-out still refuses that credential when it is hidden in a JWS-shaped client_id. It does this by blanking the client_id only when _is_clickup_jws_client_id holds: an alg-fixed signature length, no 12-byte printable run in the signature (_SIGNATURE_TEXT_RUN_RE = re.compile(rb"[\x20-\x7e]{12}")), no fixed credential or bare secret in any decoded text, and no backslash or repeated key. In every other case it returns the URL unchanged, so no URL is refused that was accepted before.

ADJUDICATED: 13 candidates, 0 confirmed newly-refused. None of the shell deny tiers changed: in exfil.py the endpoint set is read only when allow_oauth_entropy is true, and the only caller that sets it true is diagnose_oauth_url_credential (exfil.py:1776). So these rows probe the boundary as a check only. They cover ClickUp, GitLab and the operator file at the touched surface, plus the test, grep and decode commands maintainers run in this area.

PLATFORM COVERAGE: I wrote posix rows (curl to the ClickUp and GitLab metadata, cat ~/.kiro/crew/oauth_endpoints.json, forward-slash pytest/grep/git paths) and windows rows (curl.exe, a backslash-separated pytest path, Select-String with a \ path). The diff makes no path, separator, interpreter or executable assumption. The new code parses URLs only, with urlparse and a fixed https/host/path tuple, which works the same on every host. I found no platform spelling the diff assumes that my rows leave unprobed.

UNADJUDICATED: The guard is the OAuth banner credential gate (exfil.diagnose_oauth_url_credential → oauth_url_contains_credential). It is not a shell tier, so no verdict could be obtained for it. An input reaches it on four paths:

  • MCP OAuth consent URL → chat_runner._emit_mcp_oauth_request (chat_runner.py:2451)
  • ACP meta sanitizing → chat_utils (chat_utils.py:2268)
  • Connections warm premint → warm._credential_bearing_slugs (warm.py:2158)
  • Connections cold mint → sanitized_oauth_endpoint_display → oauth_rejection_is_endpoint_exemptible

On every path the URL goes through _blank_clickup_jws_client_id → _oauth_url_payload_diagnostic / _exfil_url_warning(allow_oauth_entropy=True). These are the legitimate inputs I would have submitted:

  • the ClickUp consent URL with an opaque client_id (0b3f1c8e4a2d)
  • the ClickUp consent URL with a real-length RS256 client_id (342/512/683-char signature) carrying an mcp-client- label
  • the ClickUp URL with client_id repeated, or appearing after resource=
  • a ClickUp URL whose query holds a +-encoded scope next to a percent-encoded redirect_uri, to confirm the first-match url.replace(f"?{parsed.query}", …, 1) rewrites only the query
  • a real ClickUp-issued JWS whose payload JSON contains a \/ escape from a server that escapes slashes, or an ES256/RS256 signature that happens to hold a 12-byte printable run

Those last two would be refused by the new "\\" in text and _SIGNATURE_TEXT_RUN_RE checks. Before this change they were refused too, as a JWS bearer shape at a non-approved endpoint, so they are not new refusals. They are, however, ClickUp registrations the carve-out may still fail to render, and nothing here could measure how often.

[SCOPE-REVIEWED] 11e1c46

@github-actions

github-actions Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — 🔴 changes requested (blocking)

GPT 6.1 found at least one blocking issue that must be resolved before merging 11e1c46b4260af6ee200e71f4069465c8b68a8a6. 1 of 1 blocking finding(s) are security-class and were withheld from adjudication, so the blocking verdict stands.

This comment is updated in place on each push.

BLOCKING -- src/kiro_crew/security/exfil.py:1737 -- Percent-encoded credentials bypass the decoded-JWS scan

_contains_fixed_credential(t) or _text_contains_bare_secret(t) for t in texts
A ClickUp client_id with an HS256 header, a percent-encoded GitHub PAT in its JSON payload, and "A" * 43 as its signature passes this scan → _blank_clickup_jws_client_id hides it from subsequent decoding checks → the banner preserves the original URL, sending the credential to ClickUp when Authorize is clicked.
Anchor: residual/security
Fix: Scan bounded percent-decoded forms of the decoded JSON keys and string values before granting the carve-out; reject decoding-budget exhaustion.
[BLOCK-MERGE] 11e1c46
[GPT-REVIEWED] 11e1c46

Adjudication (Opus 5.5) — is blocking on each finding proportionate?

F1 still blocks. I ran the finding's own example and it gets through.

  • Conditions, all confirmed:

    • _b64url_json_object (src/kiro_crew/security/exfil.py:1671-1686) only refuses backslashes, so % text stays in the payload.
    • The final scan at exfil.py:1735-1738 checks the decoded keys and values without percent-decoding them first.
    • The ID passes once alg is HS256 and the signature is 43 As (exfil.py:1708-1730).
    • _blank_clickup_jws_client_id then blanks it before any later check (exfil.py:1751-1755, exfil.py:1775).
  • Live run: _is_clickup_jws_client_id returned True. _contains_fixed_credential caught the plain PAT but not its percent-encoded form. diagnose_oauth_url_credential returned None, so the URL goes out unchanged.

  • Why not FLAG: a credential leaving the system is the unbounded rung. The only inputs needed are an ordinary crafted string with no extreme timing or impossible inputs, and the only recovery is a human clicking Authorize, which is not a recovery.

    [ADJUDICATION] 11e1c46 total=0 uphold=0 downgrade=0
    [GPT-ADJUDICATED] 11e1c46

    [ADJUDICATION-FENCED] 11e1c46 fenced=1 flagged=0
    UPHOLD-FENCED F1 src/kiro_crew/security/exfil.py:1737 -- Reproduced in this run: a percent-encoded GitHub PAT in the payload of an HS256 compact-JWS client_id passes _is_clickup_jws_client_id, gets blanked, and diagnose_oauth_url_credential returns None, so a crafted input carries the credential to ClickUp.
    [GPT-ADJUDICATED-FENCED] 11e1c46

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

Comment thread src/kiro_crew/security/exfil.py Fixed
@github-actions

github-actions Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 11e1c46

Verdict parsed from the review's SHA-scoped output markers for commit 11e1c46b4260af6ee200e71f4069465c8b68a8a6.

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

@iamwhatever
iamwhatever force-pushed the fix/oauth-jws-client-id-12796 branch 2 times, most recently from e228c9b to 82a0ec4 Compare October 4, 2026 19:06
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Maintainer handoff — security review needs a human call

This PR re-lands @zachary-povey's #12796 (accept a compact-JWS client_id on an approved OAuth endpoint) on a clean main. The drive-to-green pipeline took it as far as it safely can: the Opus 5.5 security review has blocked the same JWS carve-out span three times, each block a distinct, real defect, and the lane is security-fenced. Per our stop rule we will not push a fourth point-fix or post an /ai-review override — this needs a maintainer's judgement.

1. The three Opus findings, and how each was fixed

Each was a genuine security defect, reproduced at the blocking head, and addressed in turn:

  1. Credential hidden in a JWS segment. A client_id like aaa.bbb.<AWS-key> passed the shape test (base64url + two dots) and was then blanked from every credential scan at an approved endpoint, hiding the key. Fixed by requiring a genuine JOSE header (an eyJ… run decoding to a {…,"alg":…} object) and rejecting any segment that _contains_fixed_credential.
  2. RecursionError DoS. A client_id whose header run decoded to deeply nested JSON ({"alg":[[[…]]]}) made json.loads raise RecursionError — not a ValueError, so it escaped the gate and would crash the banner/mint/warm paths instead of rejecting the URL. Fixed by capping the header run length before decoding and catching (ValueError, RecursionError).
  3. Forged alg header + bare secret. A client_id like eyJhbGciOjF9.<40-char bare secret>.x (where eyJhbGciOjF9 decodes to {"alg":1}) passed the authenticity check, and because _contains_fixed_credential does not include the bare-secret heuristic, the bare secret was blanked and never seen by _text_contains_bare_secret. This one is still open — the suggested fix is to also reject when _text_contains_bare_secret(segment) is true for any segment.

The recurring shape is the concern: the carve-out blanks the whole client_id from all credential scans at an approved endpoint, so each fix plugs the one scan the last probe used and the next probe reaches for another. That non-convergence is why this is handed up rather than patched again.

2. Open design question (raised by Opus)

The carve-out currently applies at every approved OAuth authorization endpoint (and operator-added ones), not only the endpoint that issues compact-JWS identifiers. For example client_id=eyJhbGciOjF9.eyJ4IjoxfQ.sig at gitlab.com/oauth/authorize is now accepted, where base rejects it as fixed_credential_raw. If the exemption is meant only for providers that genuinely issue JWS client_ids (ClickUp here), scoping it to (mcp.clickup.com, /oauth/authorize) would shrink the blast radius considerably. This is a design decision — widen-the-carve-out vs. pin-it-to-the-issuer — that we would like a maintainer to make rather than guess.

3. What is solid and worth keeping

  • Duplicate endpoint-approval removed. The original port carried a second spelling of endpoint approval that ignored assume_approved_endpoint (First Principles blocked this). Endpoint approval is now computed once and honors the assumption, so oauth_rejection_is_endpoint_exemptible correctly reports that the oauth_endpoints.json remedy would clear a JWS-client_id rejection — which was the Goal's "no configuration remedy" problem.
  • Linear shape check. The three-group backtracking regex (flagged py/polynomial-redos by CodeQL) was replaced by split(".") == 3 plus a frozenset base64url-alphabet membership test — provably linear, no anchor, no backtracking.
  • Tests. The TestJwsClientIdCarveOut contract class pins each boundary (endpoint/param identity, alphabet, separator count, double-encoding) and now also the credential-smuggling and nested-JSON-DoS regressions.

4. Credit

Thank you, @zachary-povey, for the original fix in #12796 and for the thorough boundary tests — the authorship is preserved in this PR's git history (Author: and a Co-authored-by: trailer). We are leaving both this PR and #12796 open pending the maintainer call on the design question above.

@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 Oct 4, 2026
@bolichen97
bolichen97 force-pushed the fix/oauth-jws-client-id-12796 branch from 82a0ec4 to b5f488d Compare October 6, 2026 09:37
@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Sensitive Change Review

Sensitive files changed:

  • src/kiro_crew/security/exfil.py

  • @iamwhatever comment: does not name the current head 11e1c46; post it again for this head

How to clear this check:

  1. The PR author posts the template below as a PR comment, with
    every field filled (N/A needs a reason). Keep the
    Head commit line: it must name the current head SHA.
  2. The check turns green within a minute, with no push.
  3. A new push resets this check: post it again for the new head.

Only the author's comment counts this way. A reviewer can instead
paste the filled template into an "Approve" review on this head.
Merging still needs a reviewer's approval.

## Sensitive change review
- Head commit: 11e1c46b4260af6ee200e71f4069465c8b68a8a6
- What rule changed:
- Before -> after (what was allowed/blocked, now):
- Worst case if wrong (breaks commands / leaks secret / locks user out):
- Evidence checked (which sandbox result proves it):
- No regression:
  - Tools still work (which tools/commands were run, result):
  - Backward compatible (old config / old data / old callers still work, how checked):
  - Existing tests (which suites passed on this head):
- How to undo:

@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 Oct 6, 2026

Copy link
Copy Markdown
Contributor

Rebased onto current main (cc7e798) — this branch was 219+ commits behind.

  • Old head: 82a0ec4 → new head: b5f488d
  • Conflicts: none; git range-diff shows the single commit's patch unchanged (=)
  • Verified: py_compile on the 3 touched files; test_mcp_oauth_banner.py, test_exfil_base64_padding.py, test_exfil_gate_opt_out.py — 227 passed

No code changes beyond the rebase. Pushed with --force-with-lease after confirming no human activity in the last 6h. CI will re-run on the new head.

@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 Oct 6, 2026
@iamwhatever
iamwhatever force-pushed the fix/oauth-jws-client-id-12796 branch from b5f488d to 6dbf9b1 Compare October 12, 2026 11:46
@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 Oct 12, 2026
@iamwhatever iamwhatever changed the title fix(security): accept a compact-JWS client_id on an approved OAuth endpoint fix(security): accept ClickUp's compact-JWS client_id at its OAuth endpoint Oct 12, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Follow-up to the maintainer handoff above: the maintainer chose pin the carve-out to the issuer. New head 6dbf9b1f4a.

  • The generic compact-JWS path is gone. The exemption applies only at https://mcp.clickup.com/oauth/authorize (no port, no fragment); GitHub, GitLab, every other built-in endpoint and operator oauth_endpoints.json entries keep refusing a JWS-shaped client_id exactly as main does.
  • The value must also be pure base64url with two dots, carry a JOSE header with a real alg (not none), a JSON-object payload that is not a dashboard link token, and no fixed credential in any segment.
  • The reviewer repros are now negative tests and stay refused: a bearer JWT at GitHub (Opus), an alg=none header with a bare secret (Opus, at GitHub and ClickUp), and a dashboard link token inside client_id (GPT).
  • Why not the two suggested per-segment checks: on random HS256 signatures the bare-secret heuristic fires ~25% of the time, and the two-segment link-token pattern matches any HS256 JWS whose payload is 96+ chars, so both would refuse legitimate ClickUp identifiers. The payload-claim check covers the dashboard token instead, and the endpoint pin bounds what remains.
  • _PACKAGE_LINE_BUDGET 28,844 → 28,905 with a justification paragraph (+61 lines, the pinned carve-out), per maintainer decision.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Oct 12, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 8d22bc5
  • What rule changed: the ACP OAuth banner gate (src/kiro_crew/security/exfil.py, oauth_url_contains_credential). (a) ("mcp.clickup.com", "/oauth/authorize") is added to _OAUTH_AUTHORIZATION_ENDPOINTS. (b) A new _blank_clickup_jws_client_id blanks client_id only at exactly https://mcp.clickup.com/oauth/authorize (no port, no fragment), and only when the value is a strict compact JWS: base64url, 3 segments, optional mcp-client- label, header ≤256 chars whose alg fixes the exact signature length, JSON-object payload ≤1024 chars with no session_exp, and no credential or bare secret in any segment or decoded header/payload.
  • Before -> after: differential of the real function, main 0cda152 vs head, 5,206 cases (37 named client_id classes + 400 fuzz values × 6 endpoints × approved on/off, plus test/oauth_url_corpus.py). Main 181 accept / 5,025 refuse; head 239 / 4,968. Newly refused: 0. Newly accepted: 57, all at mcp.clickup.com/oauth/authorize:
    1. 32 compact-JWS client_ids (the intended fix).
    2. 25 ordinary client_ids (e.g. 0b3f1c8e4a2d), from adding ClickUp to the allowlist. This is the same verdict main already gives when an operator lists ClickUp in oauth_endpoints.json.
      Other endpoints (github, gitlab, evil.example.com, clickup:8443, http://clickup): 0 changes. Exceptions: 0.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): leaks a secret. A credential hidden in a JWS-shaped client_id at ClickUp would show as a live Authorize banner and go to mcp.clickup.com on click. Residual: the signature segment (fixed digest length, e.g. 43 chars for HS256) is not scanned by the bare-secret heuristic. No command breaks and nobody is locked out (0 new refusals).
  • Evidence checked (which sandbox result proves it): the differential above (diff_eval.py / diff_cmp.py / diff_cls.py; v_main.json, v_head.json). All 14 named negatives are refused at ClickUp on head (alg_none, alg_none_bare, hs256_bare_sig, hs256_payload_aws, hs256_payload_bare, hs256_oversize_sig, unknown_label, dash_token_raw, dash_token_as_payload_sig, dash_token_nested, pct_encoded_dots, nested_header, aws_key_id, bare_secret). test_mcp_oauth_banner.py -k JwsClientIdCarveOut: 36 passed. No sandbox run: the gate is a pure function of the URL, with no shell or file surface.
  • No regression:
    • Tools still work (which tools/commands were run, result): the gate has no shell surface; Security Scope Review passes on 8d22bc5. Callers (chat_runner banner, chat_utils, connections/mint.py, connections/warm.py) are covered by test_connections_oauth_client_routes.py, test_connections_oauth_clients.py, test_connections_oauth_relay.py: all pass.
    • Backward compatible (old config / old data / old callers still work, how checked): 0 of 5,206 cases flip accept->refuse; every LEGIT_OAUTH_URLS entry keeps its verdict (TestLegitOAuthUrlCorpus 66 passed); operator oauth_endpoints.json path unchanged (0 changes at non-ClickUp hosts); no config, data or signature change.
    • Existing tests (which suites passed on this head): 492 passed locally across oauth_url_corpus.py, test_connections_oauth_*, test_exfil_base64_padding.py, test_exfil_carveouts.py, test_exfil_gate_opt_out.py, test_mcp_oauth_banner.py, test_security_gate_liveness.py. CI on 8d22bc5: 93 pass; Backend Tests (3.12) 1-8, (Windows) 1-8, IPv6, namespace sandbox, Coverage Gate, CodeQL, Semgrep, Security Scope Review, Opus 5.5 Review, GPT 6.1 Review all green.
  • How to undo: git revert 8d22bc5403 (one commit). A ClickUp consent URL is refused again; nothing else changes.

@iamwhatever
iamwhatever force-pushed the fix/oauth-jws-client-id-12796 branch from 8d22bc5 to 2ea29e6 Compare October 12, 2026 23:39
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision labels Oct 13, 2026
@iamwhatever
iamwhatever force-pushed the fix/oauth-jws-client-id-12796 branch from 2ea29e6 to b7e5ddb Compare October 13, 2026 00:40
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Oct 13, 2026
@iamwhatever
iamwhatever force-pushed the fix/oauth-jws-client-id-12796 branch from b7e5ddb to 0ad30fc Compare October 13, 2026 01:37
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 13, 2026
…dpoint

ClickUp's MCP dynamic client registration issues a client_id shaped like a
compact JWS. The fixed-credential signature matches any eyJ three-segment
base64url run, so the ACP banner gate refused ClickUp's consent URL and the
server could not be authorized.

Blank that client_id before every credential scan, but only at
https://mcp.clickup.com/oauth/authorize (no port, no fragment, not an operator
endpoint) and only when the value is pure base64url with two dots, an optional
mcp-client- label, a JOSE header whose alg fixes the signature's exact length,
and a JSON-object payload that is not a dashboard link token. Every segment and
the decoded header and payload still face the fixed-credential scan, and the
decoded text faces the bare-secret scan. Every other endpoint keeps refusing a
JWS-shaped client_id. Add ClickUp's endpoint to the approved list and describe
the carve-out in the security spec.

Tests pin the endpoint, parameter, shape and signature-length boundaries, and
keep refused a bearer JWT at GitHub, an alg=none header with a bare secret, a
credential or bare secret inside the decoded payload, and a dashboard link token
inside client_id in any position.

Co-authored-by: Zachary Povey <64191599+zachary-povey@users.noreply.github.com>
@iamwhatever
iamwhatever force-pushed the fix/oauth-jws-client-id-12796 branch from 0ad30fc to 11e1c46 Compare October 13, 2026 02:40
@github-actions github-actions Bot added readiness: checking Automated validation is still running merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 13, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Closing: the compact-JWS client_id payload is free text, so a credential can be hidden in it under any encoding, and per-encoding scans do not converge (five GPT rounds). Reopen with an allowlist of ClickUp's real claim keys and value shapes once a real ClickUp client_id sample is available.

@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Oct 13, 2026
@bolichen97
bolichen97 deleted the fix/oauth-jws-client-id-12796 branch November 6, 2026 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge conflict Branch has merge conflicts with its base — author must resolve before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP OAuth: a compact-JWS client_id is rejected by the banner-safety gate at an approved endpoint

4 participants