fix(relay): address auth middleware round 2 PR review
Critical:
- Fix i64 overflow in DPoP freshness check: widen to i128 before
subtracting to prevent panic (debug) or bypass (release) when
iat = i64::MIN
- Add debug log in verify_access_token _ arm so InvalidSignature /
key rotation failures are visible in operator logs
Important:
- Reject cnf present without jkt (cnf:{} now returns 401 instead of
silently downgrading to plain Bearer)
- Add dpop_stale_proof_returns_401 and dpop_future_dated_proof_returns_401
tests covering both sides of the ±60 s freshness window
- Fix misleading "signature verification failed" log — now says
"decoding or signature verification failed"
- Reorder DPoP validation: verify signature before computing/comparing
thumbprint (defence-in-depth: prove key control before trusting claims)
Suggestions:
- Switch make_dpop_proof jti from fixed string to Uuid::new_v4() so
tests won't interfere when jti deduplication is added
- Refactor make_dpop_proof to delegate to make_dpop_proof_with_iat