Repository navigation
test(client,identity): pin nonce and IPFS fail-closed guards at their entry points - #17
SaulBuilds wants to merge 1 commit into
Conversation
… entry points Two fail-closed guards were only covered through a check elsewhere that masked their removal: - IdentityClient.exchange_code: the up-front "nonce required" check. With it removed, nonce="" was still caught later by the ID-token claim comparison, and nonce=None silently skipped the nonce check. The new test drives exchange_code with None and "" and asserts it refuses before the authorization code is redeemed (no token-endpoint request). - CitrateClient.deploy_model: an IPFS upload failure must abort the deploy. The new test makes upload_to_ipfs raise and asserts deploy_model raises and broadcasts no transaction; a positive control checks the returned CID is what lands in the calldata. Revert check: each guard neutralised in turn, full suite run, the new tests go red on assertion; restored, green. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KGMeatV8UjtCB4CTbWuAv4
BerryManifold
left a comment
There was a problem hiding this comment.
Approval at d8e7207373ed3a4e6a5d5ec50b0ddddd69e87d34 after focused differential review of changed files, history, security guards and immediate callers. All 5 targeted tests pass; both nonce-guard-removal and IPFS fail-open mutants fail assertions, restoring source returns 5/5 green.
Limits: No deployments, live authority/chain/storage operations, full cross-repository integration or full historical security audit. Required CI/branch/owner gates still apply. Both account submissions reflect the same automated review.
Matr0xshka
left a comment
There was a problem hiding this comment.
Approval at d8e7207373ed3a4e6a5d5ec50b0ddddd69e87d34 after focused differential review of changed files, history, security guards and immediate callers. All 5 targeted tests pass; both nonce-guard-removal and IPFS fail-open mutants fail assertions, restoring source returns 5/5 green.
Limits: No deployments, live authority/chain/storage operations, full cross-repository integration or full historical security audit. Required CI/branch/owner gates still apply. Both account submissions reflect the same automated review.
BerryManifold
left a comment
There was a problem hiding this comment.
Automated Codex static review of d8e7207373ed3a4e6a5d5ec50b0ddddd69e87d34 is complete. Result: clean; details retained privately. Details and coverage limits are recorded in the project's private review log. No tests were executed by this reviewer. Both account submissions represent the same Codex review, not independent reviews.
Matr0xshka
left a comment
There was a problem hiding this comment.
Automated Codex static review of d8e7207373ed3a4e6a5d5ec50b0ddddd69e87d34 is complete. Result: clean; details retained privately. Details and coverage limits are recorded in the project's private review log. No tests were executed by this reviewer. Both account submissions represent the same Codex review, not independent reviews.
BerryManifold
left a comment
There was a problem hiding this comment.
Automated Codex static review of d8e7207373ed3a4e6a5d5ec50b0ddddd69e87d34 is complete. Result: clean; details retained privately. Details and coverage limits are recorded in the project's private review log. No tests were executed by this reviewer. Both account submissions represent the same Codex review, not independent reviews.
Matr0xshka
left a comment
There was a problem hiding this comment.
Automated Codex static review of d8e7207373ed3a4e6a5d5ec50b0ddddd69e87d34 is complete. Result: clean; details retained privately. Details and coverage limits are recorded in the project's private review log. No tests were executed by this reviewer. Both account submissions represent the same Codex review, not independent reviews.
Summary
Tests only. No production code, version or dependency changes.
Pins two fail-closed guards at their public entry points. Before this PR, each guard could be removed with the rest of the suite still green, because a later check masked the removal.
exchange_codeIdentityClient.exchange_codetest_exchange_code_without_a_nonce_is_refused_before_the_token_request[None],[""]. Positive control:test_exchange_code_with_the_matching_nonce_still_succeedsCitrateClient.deploy_modeltest_deploy_model_aborts_when_the_ipfs_upload_fails. Positive control:test_deploy_model_carries_the_cid_the_upload_returnednonce=""was still caught later by the ID-token claim comparison.nonce=None, however, skipped the nonce check entirely and the token verified. The new test asserts that both values raiseIdentityErrorbefore the authorization code is redeemed: no request reaches the token endpoint.upload_to_ipfsraise. It then asserts thatdeploy_modelraisesCitrateErrorand that noeth_sendRawTransactionis made.All transports are in-process fakes, so no test opens a socket.
Standard: met
if not nonce:→if False:; theraise CitrateError(...)in_upload_to_ipfs→return "fallback_…"), and the suite was run each time:test_deploy_model_aborts_when_the_ipfs_upload_fails).citrate_sdk.economics).uv run --frozen pytest -qcollects 907 → 912 tests (5 new). The new file passes, and the suite without the economics simulation runs 811 passed, 49 skipped.ruff check .andmypy .are clean.🤖 Generated with Claude Code
https://claude.ai/code/session_01KGMeatV8UjtCB4CTbWuAv4