Skip to content

feat: Soroban static rules for signature verification, auth in loops, recursive calls, and call depth (#899, #874, #878, #879) - #939

Merged
mijinummi merged 2 commits into
MDTechLabs:mainfrom
wowamaxe-glitch:fix/gasguard-issues-899-874-878-879
Aug 31, 2026
Merged

feat: Soroban static rules for signature verification, auth in loops, recursive calls, and call depth (#899, #874, #878, #879)#939
mijinummi merged 2 commits into
MDTechLabs:mainfrom
wowamaxe-glitch:fix/gasguard-issues-899-874-878-879

Conversation

@wowamaxe-glitch

Copy link
Copy Markdown
Contributor

Summary of Changes

This Pull Request implements static analysis analyzers and rule definitions for four Soroban contract optimization issues on GasGuard:

1. Issue #899: Detect Duplicate Soroban Signature Verification

  • Dataflow Analyzer: Added DuplicateSignatureAnalyzer (packages/analyzers/soroban/dataflow/duplicate-signature-analyzer.ts) to track signature verification calls (ed25519_verify, secp256k1_verify, verify_signature, signature.verify, check_auth) within function scopes and detect duplicate verifications executed on identical inputs.
  • Rule Definition: Implemented detectDuplicateSignatureVerifications rule (packages/rules/soroban/src/authorization/duplicate-signature-verification-rule.ts) with severity 'high'|'medium'.

2. Issue #874: Detect Soroban Authorization Inside Expensive Loops

  • Loop Analyzer: Added AuthorizationLoopAnalyzer (packages/analyzers/soroban/loops/authorization-loop-analyzer.ts) to inspect loop constructs (for, while, loop), detect authorization operations (require_auth, require_auth_for_args, verify_authorizations, invoker()) inside loops, estimate iteration cost impact, and suggest hoisting auth checks.
  • Rule Definition: Implemented detectAuthorizationInLoops rule (packages/rules/soroban/src/authorization/authorization-in-loops-rule.ts).

3. Issue #878: Detect Recursive Soroban Contract Calls

  • Call Graph Cycle Analyzer: Added RecursiveCallAnalyzer (packages/analyzers/soroban/callgraph/recursive-call-analyzer.ts) to construct function call graphs, detect direct self-recursion and indirect cyclic invocation paths, and report affected call cycles.
  • Rule Definition: Implemented detectRecursiveContractCalls rule (packages/rules/soroban/src/calls/recursive-contract-calls-rule.ts).

4. Issue #879: Implement Soroban Call Depth Threshold Rule

  • Call Depth Analyzer: Added CallDepthAnalyzer (packages/analyzers/soroban/callgraph/call-depth-analyzer.ts) to calculate maximum invocation depth per entrypoint with configurable depth threshold limits (default 3).
  • Rule Definition: Implemented detectCallDepthThresholdExceeded rule (packages/rules/soroban/src/calls/call-depth-threshold-rule.ts).

Verification

  • Unit Tests: Added test suite packages/rules/soroban/tests/issues-899-874-878-879.spec.ts covering all 4 rules (8/8 tests passing, 19/19 soroban tests passing).

Closes #899
Closes #874
Closes #878
Closes #879

@drips-wave

drips-wave Bot commented Aug 29, 2026

Copy link
Copy Markdown

@wowamaxe-glitch 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

@mijinummi

Copy link
Copy Markdown
Collaborator

Kindly fix conflict @wowamaxe-glitch

@wowamaxe-glitch

Copy link
Copy Markdown
Contributor Author

@mijinummi Kindly Merge

@mijinummi
mijinummi merged commit 4063ee5 into MDTechLabs:main Aug 31, 2026
4 of 7 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

2 participants