fix(nns): Prevent large manage neuron proposals #4509
Merged
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.
The changes in this PR is already deployed as part of a security hotfix:
Compared to the original commit, this PR also adds a CHANGELOG entry (not unreleased_changelog, since it's already released)
Why
Manage Neuron proposals have low fees (0.01 ICP) and high limit for open proposals (100K). If they can be large (~2MiB), then it's easy to fill up the wasm memory with very low cost.
What
Prevent large fields in
Command
When validating the manage neuron proposals (
validate_manage_neuron_proposal
), simply disallow problematic commands:opt blob
. There is generally lack of validation on the content of manage neuron proposals at the time the manage neuron proposals are created, but rather the commands are validated at execution time. This needs to be improved in the future. In this PR (intended as a hotfix), we aim at making the attack impossible with as few lines as possible. Disabling DisburseMaturity in manage neuron proposals is OK since the command is still under development.not_for_profit
, and only DFINITY neurons have this flag (at genesis)Lower the limit of open proposals
Change the limit of open neuron management proposals from 100K to 10K