Require server-issued challenges for attestation submit#1756
Require server-issued challenges for attestation submit#1756Scottcjn merged 3 commits intoScottcjn:mainfrom
Conversation
|
Welcome to RustChain! Thanks for your first pull request. Before we review, please make sure:
Bounty tiers: Micro (1-10 RTC) | Standard (20-50) | Major (75-100) | Critical (100-150) A maintainer will review your PR soon. Thanks for contributing! |
|
Review-ready. This PR is a focused security hardening follow-up to merged PR #1746. It closes the remaining client-controlled timestamp / arbitrary-nonce path in /attest/submit and makes pico_bridge fail closed Happy to answer any review questions or adjust the patch if needed. |
|
Review: Approve ✅ Excellent security hardening. Removing the local nonce fallback and requiring server-issued challenges closes a real replay attack surface. Test coverage is thorough. One minor: 💰 75 RTC — solid security contribution @Mavline. Please share your RTC wallet address. |
|
Excellent security hardening — removing the client-supplied timestamp attack surface is the right call. Has a merge conflict with main though. Can you rebase? Will merge immediately after. |
|
Update: CI fix just landed on main (removed broken |
|
Still approved — excellent security hardening. Just needs rebase against current main. The BCOS scan CI is being fixed separately. |
|
The other 3 createkr PRs just merged via auto-update. Your PR has a real merge conflict that can't be auto-resolved. Can you rebase manually? |
|
@Mavline — This is solid security work (server-issued challenges for attestation). It has merge conflicts with main after today's merges. Could you rebase? We'll merge promptly. |
Scottcjn
left a comment
There was a problem hiding this comment.
Thorough review complete. This closes the timestamp-bypass vulnerability cleanly.
What was vulnerable: extract_attestation_timestamp() let clients supply server_time/nonce_ts in the payload, which caused _attest_nonce_requires_challenge() to skip challenge validation entirely. Any miner could forge attestations without fetching a server challenge.
What this fixes:
- Removes the timestamp-based skew fallback path entirely
attest_validate_and_store_nonce()now unconditionally requires a live challenge from/attest/challenge- Pico bridge fails closed instead of synthesizing local nonces
- All test suites updated to use
_attach_live_challenge()helper - New regression tests cover: arbitrary nonce rejection, timestamp bypass, expired challenges, pico fail-closed
- DB schema consistency fixed across test fixtures
tempfile.mktemp→tempfile.mkstemp(minor safety fix)
Deployment note about multi-node sticky routing is appreciated and accurate.
Approved — merging via squash.
|
Code reviewed and approved — this is solid security work that closes a real bypass vector. However, the branch has merge conflicts with git fetch origin main
git rebase origin/main
# resolve any conflicts
git push --force-with-leaseThe conflicts are likely from recent changes to the test fixtures or the main node file. Should be straightforward to resolve. |
|
This is excellent security work — removing the local nonce fallback and requiring server-issued challenges is exactly right. We want to merge this. However, there are merge conflicts with main. Could you rebase onto git fetch origin
git rebase origin/main
# resolve any conflicts
git push --force-with-leaseApproved: 75 RTC once rebased and merged. |
|
Still has merge conflicts. This is a good security fix — please rebase so we can merge. |
9bf5e7d to
4470170
Compare
|
Rebased onto current |
|
Merged! We rebased this for you (trivial conflict in test variable naming). This is excellent security work — removing the local nonce fallback closes a genuine attestation bypass. Payment: 75 RTC Please share your RTC wallet address to receive payment (or confirm the one from previous PRs). |
Follow-up to #1746.
This tightens the attestation nonce contract so
/attest/submitonly accepts live server-issued challenges from/attest/challenge. The previous merged path could still be bypassed by supplying client-controlled timestamp fields, and in-treepico_bridgestill had an insecure local-nonce fallback.What changed:
used_noncesafter successful challenge consumptionpico_bridgeclosed when challenge fetch fails instead of synthesizing a local nonceValidation:
/tmp/rustchain-test-venv/bin/python -m unittest node/tests/test_attest_nonce_replay.py node/tests/test_attest_submit_challenge_binding.py/tmp/rustchain-test-venv/bin/python miners/pico_bridge/tests/test_pico_bridge_miner.pyImportant deployment note: