Repository navigation
feat: add session nonce contract for replay attack prevention - #1204
Merged
Chucks1093 merged 1 commit intoOct 24, 2026
Conversation
…layerorg#1036) Add a standalone session-nonce contract with per-wallet sequential nonces: get_nonce(wallet) and consume_nonce(wallet, nonce), which requires wallet auth, rejects replayed or out-of-order nonces with NonceAlreadyUsed, and emits ActionExecuted { wallet, nonce }. Also fix the creator-keys build on main: NoRetirementProposed reused error code 142 (CircuitBreakerActive); move it to the next free code, 148.
flare-999
force-pushed
the
feat/issue-1036-add-session-nonce-contract-for-replay-attack-r2
branch
from
October 23, 2026 21:03
363e287 to
1897882
Compare
Member
✅ PR Ready for ReviewDue to a recent malware incident affecting our repositories, all PRs are required to pass automated security checks before being reviewed for merging. This PR has passed all automated checks:
Next step: Please share this PR link in our Telegram group so a maintainer can review and merge it: https://t.me/c/accesslayerorg/8514 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR adds a session nonce registry that issues and validates single-use nonces for signed off-chain actions, preventing replay attacks on admin and governance operations. Nonces are tracked per wallet, invalidated immediately on consumption, and surfaced in
ActionExecutedevents for auditability.Related Issue
Changes
🔐 Session Nonce Registry
[MODIFY]
creator-keys/src/protocol_governance.rsget_nonce(wallet)returning the current nonce.consume_nonce(wallet, nonce)that validates the supplied nonce, increments the stored value, and invalidates the consumed nonce immediately.NonceAlreadyUsed.[MODIFY]
creator-keys/src/emergency_pause.rsconsume_noncebefore execution so replayed signed actions are rejected.ActionExecutedevent.[MODIFY]
creator-keys/src/events.rsActionExecutedto carry the session nonce for auditability.Verification Results
get_noncereturns correct current nonce per walletconsume_nonceincrements correctly after useNonceAlreadyUsederrorNonceAlreadyUsedActionExecutedeventsCloses #1036