fix(aztec-nr): restrict raw note-enqueue sink to pub(crate) - #24974
Open
vezenovm wants to merge 1 commit into
Open
fix(aztec-nr): restrict raw note-enqueue sink to pub(crate)#24974vezenovm wants to merge 1 commit into
vezenovm wants to merge 1 commit into
Conversation
Reduce `enqueue_note_for_validation` and `NoteValidationRequest` (struct, `new`, and re-export) from `pub` to `pub(crate)`. These are only ever called by aztec-nr's own discovery paths, which run nonce discovery before enqueuing so every enqueued note's unique hash is guaranteed present in the tx effects. This addresses F-832 as API hygiene rather than a security boundary. Two distinct threat models: 1. F-832's actual threat: malicious sender vs honest contract. The honest author uses documented, pub APIs in good faith. A pub raw sink that looks like "the way to deliver a note from a handler" invites them to wire it up, and then any sender bricks their users. Removing it from the pub surface means an honest author can't build the vulnerable pattern out of sanctioned parts. This is the case worth defending, and restriction defends it. 2. Malicious/broken contract author. Unpreventable: they can recompute the slot, push directly, or just panic in a handler. aztec-nr can't and needn't stop this. The only people harmed are users who chose to run that contract, and the blast radius is that one contract's scope.
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.
Fixes F-832
Reduce
enqueue_note_for_validationandNoteValidationRequestfrompubtopub(crate). These are only ever called by aztec-nr's own discovery paths, which run nonce discovery before enqueuing so every enqueued note's unique hash is guaranteed present in the tx effects.Addresses F-832 as API hygiene rather than a security boundary. Two distinct threat models:
Maybe we do not even deem this
pub(crate)restriction worth it as I do not think custom message handlers have high demand at this point. But it felt easy enough to restrict the API here. If they ever do have large demand perhaps we should think through our APIs a bit further as to help custom message handlers avoid foot-guns. Once custom handlers become more heavily used we could consider APIs that at least push devs towards inclusion being checked or provide boilerplate for safe custom handlers