-
Notifications
You must be signed in to change notification settings - Fork 10
PR #6: Add Tuple Indexing for Nested Argument Matching #389
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
Merged
Conversation
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
SafeDep Report SummaryNo dependency changes detected. Nothing to scan. This report is generated by SafeDep Github App |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #389 +/- ##
==========================================
- Coverage 79.01% 78.90% -0.11%
==========================================
Files 70 70
Lines 7051 7117 +66
==========================================
+ Hits 5571 5616 +45
- Misses 1242 1262 +20
- Partials 238 239 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This was referenced Nov 21, 2025
Owner
Author
This was referenced Nov 21, 2025
Owner
Author
Merge activity
|
Modified scan and ci commands to accept both single rule files and directories of rules, enabling modular rule organization and easier ruleset management. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Implemented tuple/list element extraction using "0[0]" syntax to match specific elements within tuple arguments, enabling detection of patterns like socket.bind(("0.0.0.0", 8080)) with match_position={"0[0]": "0.0.0.0"}.
**Changes:**
- Added `parseTupleIndex()` to parse position strings with optional indexing
- Added `extractTupleElement()` to extract elements from tuple/list strings
- Updated `matchesPositionalArguments()` to support tuple indexing
- Added 350+ lines of comprehensive tests covering all edge cases
- Updated Python DSL documentation with tuple indexing examples
**Features:**
- Tuple indexing: `{"0[0]": "value"}` matches first tuple element
- List support: Works with both `(...)` and `[...]` syntax
- Wildcard compatible: `{"0[0]": "192.168.*"}` works
- Backward compatible: Simple positional matching unchanged
- OR logic support: `{"0[0]": ["a", "b", "c"]}` works
**Testing:**
- Unit tests: parseTupleIndex, extractTupleElement, integration tests
- End-to-end: Verified with socket.bind detection
- Full suite: All existing tests pass (100% compatibility)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
32fb907 to
21e1328
Compare
shivasurya
added a commit
that referenced
this pull request
Nov 28, 2025
Release v1.1.0 includes enhanced argument matching capabilities: - Add positional argument matching (match_position parameter) - Add keyword argument matching (match_name parameter) - Add tuple indexing for nested arguments - Add wildcard support in argument values - Add comprehensive type hints - Fix critical bugs in argument matching Related PRs: #386, #389, #390 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
6 tasks
shivasurya
added a commit
that referenced
this pull request
Nov 28, 2025
Release v1.1.0 includes enhanced argument matching capabilities: - Add positional argument matching (match_position parameter) - Add keyword argument matching (match_name parameter) - Add tuple indexing for nested arguments - Add wildcard support in argument values - Add comprehensive type hints - Fix critical bugs in argument matching Related PRs: #386, #389, #390 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.

This introduces tuple indexing syntax for matching values within nested tuple arguments. Rules can now use position specifiers like 0[0] to validate specific elements of tuple parameters, enabling detection of security issues in function calls that accept complex argument structures. The implementation includes robust tuple parsing and element extraction with proper error handling.