fix(web-bot-auth): fail closed on future created timestamps in Rust verify - #127
Open
SashaMIT wants to merge 2 commits into
Open
fix(web-bot-auth): fail closed on future created timestamps in Rust verify#127SashaMIT wants to merge 2 commits into
SashaMIT wants to merge 2 commits into
Conversation
…erify WebBotAuthVerifier::verify already rejects expired signatures after cloudflare#125, but still accepted cryptographically valid signatures with created in the future. The TypeScript web-bot-auth verifier rejects those before crypto verify. Enforce the created window the same way, before expires, and surface SignatureCreatedInFuture. verify_ignore_expiry still runs crypto and reports the new advisory flag.
AkshatM
reviewed
Aug 14, 2026
| /// the message expired in the past. | ||
| pub is_expired: Option<bool>, | ||
| /// If the `created` tag was present on the message, whether or not | ||
| /// `created` is still in the future. |
Contributor
There was a problem hiding this comment.
nit: remove the word "still"
AkshatM
approved these changes
Aug 14, 2026
Contributor
Author
|
Dropped "still" from the |
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.
Summary
WebBotAuthVerifier::verifystill accepted cryptographically valid signatures whencreatedis in the future, even after #125 started failing closed onexpires. The TypeScriptweb-bot-authverifier already rejects those inputs (created in the future) before crypto verify.This makes the Rust Web Bot Auth verifier fail closed on a future (or unparsable)
createdwindow, then on expiry, then proceeds to cryptographic verification only when the window is valid. That matches TypeScriptpackages/web-bot-auth/src/index.ts. GenericMessageVerifier::verifyis unchanged.verify_ignore_expirystill runs crypto and now reportsis_created_in_futureon the advisory.Threat model: an attacker who can mint a valid Ed25519 web-bot-auth signature (stolen bot key, or the bot itself) can set
created=now+skewwithexpiresstill in the future. Rust currently treats that as valid; TypeScript rejects it. Same authority assumption as #125 for expiry.Test plan
cargo +stable test --all --all-features(including newtest_verify_rejects_created_in_the_future)cargo +stable clippy --all-features --all-targets -- -D warningscargo +stable fmt --all -- --checkcreatedguard makestest_verify_rejects_created_in_the_futurefail (Ok(SignatureTiming)instead ofSignatureCreatedInFuture)Made with Cursor