Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

component: eliminate TOCTOU bug factory #3962

Merged
merged 3 commits into from
Mar 7, 2024
Merged

component: eliminate TOCTOU bug factory #3962

merged 3 commits into from
Mar 7, 2024

Conversation

hdevalence
Copy link
Member

This renames the previous check_stateful method to check_historical,
renames execute to check_and_execute, and by default moves all of the
content of check_stateful into check_and_execute, unless there's an obvious
and LOCAL reason why it's safe to do so that can be written into the body of
the method.

IMO it's still worth it to have the method in the trait. We may wish to take
advantage of it later, when we can spend more time carefully reasoning about
performance.

Closes #3690

This renames the previous `check_stateful` method to `check_historical`,
renames `execute` to `check_and_execute`, and by default moves all of the
content of `check_stateful` into `check_and_execute`, unless there's an obvious
and LOCAL reason why it's safe to do so that can be written into the body of
the method.

IMO it's still worth it to have the method in the trait. We may wish to take
advantage of it later, when we can spend more time carefully reasoning about
performance.

Note: we've left behind two versions of the trait, which will be reconciled in
a later commit.
Turns out we still need this trait; I commented why
Comment on lines 36 to 39
// These should be redundant given the choice to move these checks into check_and_execute
// but are left here for reference and as a defense in depth.
no_duplicate_spends(self)?;
no_duplicate_votes(self)?;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slightly ambivalent on this point -- should we just delete?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

point in favor of deleting: people (me) might be tempted to add other such checks here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good, looks like our test suite is checking the exact error message, so we'll need to patch up the tests

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably don't want to just change the error message, but instead modify those tests to actually have the right FMD clues, to actually exercise duplicate nullifiers.

@hdevalence hdevalence added the zellic-component-remediated Tag PRs that are remediating Zellic findings label Mar 6, 2024
Copy link
Contributor

@cratelyn cratelyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is great work 🎉

crates/core/app/src/action_handler.rs Show resolved Hide resolved
crates/core/app/src/action_handler.rs Show resolved Hide resolved
This temporarily disables a few relevant tests; these should be restored later.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
zellic-component-remediated Tag PRs that are remediating Zellic findings
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants