Skip to content

Conversation

@shivasurya
Copy link
Owner

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.

@shivasurya shivasurya added enhancement New feature or request go Pull requests that update go code python labels Nov 21, 2025
@shivasurya shivasurya self-assigned this Nov 21, 2025
@shivasurya shivasurya added enhancement New feature or request go Pull requests that update go code python labels Nov 21, 2025
@safedep
Copy link

safedep bot commented Nov 21, 2025

SafeDep Report Summary

Green Malicious Packages Badge Green Vulnerable Packages Badge Green Risky License Badge

No dependency changes detected. Nothing to scan.

This report is generated by SafeDep Github App

@codecov
Copy link

codecov bot commented Nov 21, 2025

Codecov Report

❌ Patch coverage is 70.66667% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.90%. Comparing base (14282b1) to head (21e1328).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
sourcecode-parser/dsl/loader.go 31.03% 20 Missing ⚠️
sourcecode-parser/dsl/call_matcher.go 95.45% 1 Missing and 1 partial ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Owner Author

shivasurya commented Nov 21, 2025

Merge activity

  • Nov 21, 1:29 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Nov 21, 1:38 AM UTC: Graphite rebased this pull request as part of a merge.
  • Nov 21, 1:39 AM UTC: @shivasurya merged this pull request with Graphite.

@shivasurya shivasurya changed the base branch from shiva/pr-05-advanced-features to graphite-base/389 November 21, 2025 01:36
@shivasurya shivasurya changed the base branch from graphite-base/389 to main November 21, 2025 01:37
shivasurya and others added 2 commits November 21, 2025 01:38
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]>
@shivasurya shivasurya force-pushed the shiva/pr-06-tuple-indexing branch from 32fb907 to 21e1328 Compare November 21, 2025 01:38
@shivasurya shivasurya merged commit 392e963 into main Nov 21, 2025
3 checks passed
@shivasurya shivasurya deleted the shiva/pr-06-tuple-indexing branch November 21, 2025 01:39
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]>
@shivasurya shivasurya mentioned this pull request Nov 28, 2025
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

enhancement New feature or request go Pull requests that update go code python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants