Skip to content

feat(engine): detect usage of env.storage().instance().update() witho…#482

Merged
Gbangbolaoluwagbemiga merged 2 commits intoHyperSafeD:mainfrom
MarvyNwaokobia:feature/detect-storage-update-without-check-v2
Mar 30, 2026
Merged

feat(engine): detect usage of env.storage().instance().update() witho…#482
Gbangbolaoluwagbemiga merged 2 commits intoHyperSafeD:mainfrom
MarvyNwaokobia:feature/detect-storage-update-without-check-v2

Conversation

@MarvyNwaokobia
Copy link
Copy Markdown

Description

This PR improves the StorageUpdateStateCheckRule to accurately detect state checks preceding env.storage().instance().update() calls. It now supports:

Match expressions: Recognizes when update() is called inside a match arm where the match expression is a state check.
Sequential checks: Tracks state checks occurring in previous statements within the same function block.

Related Issue

Closes #451

Changes

Updated check_for_vulnerable_update in storage_update_state_check.rs.
Added unit tests for match arms and sequential checks.
Verification
Ran cargo test -p sanctifier-core --lib --no-default-features rules::storage_update_state_check::tests and all tests passed.

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 30, 2026

@MarvyNwaokobia Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Gbangbolaoluwagbemiga Gbangbolaoluwagbemiga merged commit 39af277 into HyperSafeD:main Mar 30, 2026
2 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[engine] Rule: Detect usage of env.storage().instance().update() without state check

2 participants