You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(signing): cap key_origins entry size, route cold-cache jwks_uri=None to JWKS_UNAVAILABLE, host-only diagnostic fallback
Three remaining Argus follow-ups from #789.
1. Per-entry length cap on _extract_key_origins. Each origin value
is bounded at 512 bytes — well above any legitimate
scheme+host+port shape but tight enough that a pathological
multi-kilobyte entry from the 64 KiB capabilities body doesn't
propagate through downstream comparisons. Oversized entries are
SKIPPED (not truncated — a truncated host would silently match
the wrong domain). Constant
_MAX_KEY_ORIGIN_VALUE_BYTES = 512 documents the choice.
2. Cold-cache jwks_uri=None routes to REQUEST_SIGNATURE_JWKS_UNAVAILABLE.
Previous behavior coerced None to '' and routed through the
mismatch path with empty actual_origin — a resolver-side I/O
failure misclassified as adversarial origin-mismatch on
dashboards. Now raises JWKS_UNAVAILABLE with
detail={'purpose': signing_purpose} so the cold-cache shape
aggregates with other resolver-fetch failures.
3. Diagnostic host-only fallback on canonicalization failure. When
_origin_host can't canonicalize one side, the mismatch detail's
expected_origin / actual_origin values must still be HOST-SHAPED
— previous fallback leaked the full raw URL into the host-labeled
field, inconsistent with the success-path host-only shape. New
_diagnostic_host helper falls through to _extract_host (the same
URL/bare-host parser the canonicalization step uses) for a
best-effort host, empty string at worst.
Three new tests in test_verify_from_agent_url.py:
- _extract_key_origins skips oversized entries
- mismatch detail uses host-only fallback (no URL leakage)
- jwks_uri=None routes to JWKS_UNAVAILABLE
622 tests across impacted surface remain green. ruff + mypy clean.
Refs Argus second-pass review on #789 (cold-cache routing, detail
shape, per-entry length cap).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments