Soroban Unsafe Operations Detection Rule#516
Open
onajidavid87-web wants to merge 4 commits into
Open
Conversation
Created new files like packages/rules/src/stellar/unsafe_operations/mod.rs — UnsafeOperationsRule implementing SorobanLintRule with 5 detection categories:
1. Panic operations — .unwrap(), .expect(), panic!(), unreachable!(), todo!(), unimplemented!()
2. Unsafe blocks — unsafe { }
3. Unprotected invocations — invoke_contract / env.invoke() without prior require_auth
4. Unchecked arithmetic — raw +, -, *, / without checked_/saturating_ methods
5. Unbounded loops — loop { } without break/return
Each detection produces a RuleViolation with severity, description, and remediation suggestions. Includes 10 inline test cases (#[cfg(test)]).
Modified files
- packages/rules/src/stellar/mod.rs — added pub mod unsafe_operations; and pub use unsafe_operations::*;
- packages/rules/src/stellar/linting/mod.rs — registered UnsafeOperationsRule in the default SorobanLinter rules list
Closes MDTechLabs#496
Collaborator
|
Hi @onajidavid87-web kindly fix the remaining 2 ci that are failing. Thanks for your contribution. |
Collaborator
|
Hi @onajidavid87-web , you may pull from main update your branch fix the contract by cargo fmt, cargo test then push back. Well done! |
Collaborator
|
Hello @onajidavid87-web , you'll be unassigned in the 12hrs if you didn't fix the errors as requested. Thank you |
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.
Created new files like packages/rules/src/stellar/unsafe_operations/mod.rs — UnsafeOperationsRule implementing SorobanLintRule with 5 detection categories:
Closes #496