Skip to content

Commit 4384cb3

Browse files
hallelx2claude
andcommitted
ci: lift rotation check out of a double-negation (QF1001)
staticcheck flagged the De-Morgan form. Readability-wise the flat sequence is also easier. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 0ceb973 commit 4384cb3

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

pkg/queue/qstash_verify.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,11 @@ func (v *Verifier) Verify(signature string, body []byte, expectedURL string) err
9696

9797
// Try current key, then next key (rotation support). Constant-time
9898
// compares guard against timing attacks.
99-
if !hmacMatches(v.currentKey, signingInput, sig) &&
100-
!(len(v.nextKey) > 0 && hmacMatches(v.nextKey, signingInput, sig)) {
99+
ok := hmacMatches(v.currentKey, signingInput, sig)
100+
if !ok && len(v.nextKey) > 0 {
101+
ok = hmacMatches(v.nextKey, signingInput, sig)
102+
}
103+
if !ok {
101104
return errors.New("qstash verifier: signature mismatch")
102105
}
103106

0 commit comments

Comments
 (0)