🛡️ Sentinel: [HIGH] Fix TOCTOU race condition in signature verifier nonce checking - #128
Merged
Conversation
There was a problem hiding this comment.
Code Review
This pull request resolves a TOCTOU race condition in the signature verification process by combining the nonce check and record operations into a single atomic method, and adds a concurrent replay test to verify the fix. The review feedback identifies a performance bottleneck in the nonce eviction logic under high concurrent load and suggests rate-limiting the eviction process to prevent latency spikes.
blue4209211
force-pushed
the
fix-nonce-toctou-race
branch
from
August 8, 2026 05:48
61fa67c to
25c874e
Compare
mayankpande88
approved these changes
Aug 8, 2026
…once checking Signed-off-by: shiv <blue.4209211@gmail.com>
mayankpande88
force-pushed
the
fix-nonce-toctou-race
branch
from
August 8, 2026 05:56
25c874e to
c433a14
Compare
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.
Description
pkg/signing/verify.go, nonces were checked withisReplayedNonce()prior to signature verification, and recorded withrecordNonce()only at the end ofVerify().isReplayedNonce()simultaneously before any goroutine recorded the nonce, allowing attackers to bypass replay attack protection and execute duplicate signed commands on datasources.pkg/signing/verify.goto perform cryptographic Ed25519 signature and payload integrity verification first.isReplayedNonceandrecordNoncecalls with an atomiccheckAndRecordNonce(nonce)method under mutex lockv.nonceMu.TestVerify_ConcurrentReplayinpkg/signing/verify_test.goto test concurrent replay protection under 20 concurrent goroutines..jules/sentinel.md.Type of change
How Has This Been Tested?
Checklist
git commit -s) per DCOmake validatepasses (fmt + lint + test)