Repository navigation
fix(challenge,trace_binding): validate challenge secret/ttl/now/expiry and enforce strict iat/credential_id in trace_binding (#285) - #290
Conversation
|
🟡 Contributor Check: MEDIUM
Automated check by AgenTrust Contributor Check. |
carloshvp
left a comment
There was a problem hiding this comment.
Reviewed exact head ce7721ff4a06a5a0500776fa7a2452be285eb80a in an isolated checkout.
[P2] Preserve the domain-error contract when converting a decimal expiry.
The new ASCII/decimal precheck removes the earlier try/except around int(expiry_str). With a valid secret and a syntactically shaped challenge whose expiry contains 4,301 ASCII decimal digits, Python 3.12's default integer-string limit raises ValueError at src/ca2a_runtime/challenge.py. verify_challenge documents AttestationFailed for a malformed/unissued challenge; the actual merge-base implementation returned that domain error for this same input. The new ValueError escapes instead.
Please keep the ASCII/decimal guard and translate a ValueError from int(expiry_str) back into AttestationFailed, or reject an excessive expiry length through that domain error before conversion. A focused in-process correction restoring the catch produces AttestationFailed for the oversized input while the valid issued-challenge control still passes. Add that regression alongside the non-decimal cases. This is a demonstrated error-contract regression; no authentication bypass is claimed.
The ordinary exact-head suite passes (800 passed, 16 skipped), as do pip check, Ruff, mypy, configured Bandit, sign-offs and diff whitespace checks. Requesting the narrow conversion-error repair before approval.
Reviewed with OpenAI Codex.
…y and enforce strict iat/credential_id in trace_binding (agentrust-io#285) Validate secret bytes/length, ttl_seconds, now, and ASCII decimal expiry (preserving AttestationFailed when int(expiry_str) exceeds the integer string conversion limit) in ca2a_runtime.challenge, and enforce strict integer iat and non-empty credential_id in ca2a_runtime.trace_binding. Closes agentrust-io#285 Signed-off-by: Raghuvar Karthik Durga <177662415+drk-ram@users.noreply.github.com>
ce7721f to
d32fe0d
Compare
|
Thank you @carloshvp! Addressed in
|
carloshvp
left a comment
There was a problem hiding this comment.
Reviewed current head d32fe0d00c90da939e20f239d10d95be8b845fb8 in an isolated checkout.
The oversized decimal-expiry conversion now translates the integer-conversion limit into AttestationFailed; the 4,301-digit regression reaches that path. The secret/TTL/time and TRACE binding validations remain intact. This resolves my earlier challenge-parser change request.
Fresh Python 3.12.10 validation: 857 passed, 16 skipped; Ruff, mypy and configured Bandit pass. The installed dependencies are consistent, and the PR commit carries a DCO sign-off. The required format check and whitespace check pass. Hosted CI and the required independent security approvals remain separate.
Reviewed with OpenAI Codex.
What
Validate
secret(bytesof length >= 16), exactintttl_secondsandnow, and ASCII decimalexpiryinca2a_runtime.challenge, and validateiat(positive RFC 8785 safeint),subject,credential_id,parent_record_hash, and non-emptyhopsinca2a_runtime.trace_binding.Why
Closes #285.
Security impact
Prevents
verify_challenge(..., now=False)from treating the current time as epoch0(making expired challenges appear unexpired), rejects empty/short HMAC challenge secrets, and prevents boolean/float/out-of-rangeiator empty non-rootcredential_idin signed TRACE records.Test plan
pytestpasses (pytest tests/unit/test_challenge.py -q:45 passed)ruff checkpasses (ruff check src tests/unit/test_challenge.py:All checks passed!)mypypassesDCO sign-off
Developer Certificate of Origin (https://developercertificate.org).