-
Notifications
You must be signed in to change notification settings - Fork 10
feat(cli): Implement scan, query, and ci commands with Python DSL integration #361
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
This was referenced Nov 9, 2025
Owner
Author
2 tasks
66248dc to
63dbabe
Compare
SafeDep Report SummaryNo dependency changes detected. Nothing to scan. This report is generated by SafeDep Github App |
007b5e9 to
6e73771
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #361 +/- ##
==========================================
- Coverage 80.35% 79.78% -0.58%
==========================================
Files 64 64
Lines 6537 6802 +265
==========================================
+ Hits 5253 5427 +174
- Misses 1061 1148 +87
- Partials 223 227 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Owner
Author
Merge activity
|
…egration Implements functional CLI commands for Python DSL-based security scanning with multiple output formats and comprehensive testing. **Scan Command (scan.go):** - Full implementation using Python DSL rule loader - Builds code graph → module registry → callgraph pipeline - Executes DSL rules and prints human-readable results - Exits with error code if vulnerabilities found **Query Command (query.go):** - Similar to scan but optimized for ad-hoc exploration - Prints "Query Results" instead of "Security Scan" - No error exit code (exploration mode) **CI Command (ci.go):** - Designed for CI/CD integration - SARIF output support (--output sarif) for GitHub Code Scanning - JSON output support (--output json) for custom tooling - Includes rule metadata (CWE, OWASP, severity, confidence) - Exits with error code if vulnerabilities found **Testing:** - Updated main_test.go for new command descriptions - Updated query_test.go for real implementation - All commands tested end-to-end with test rules - All 167 Python tests pass (99% coverage) - All Go tests pass - All linters pass (golangci-lint, ruff, black, mypy) **Compatibility:** - Keeps analyze command for backward compatibility - All three new commands share common code graph building logic - Proper error handling throughout 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Update Python DSL package metadata and licensing for PyPI v1.0.0 release. Fixes AGPL-3.0 license declaration and adds required distribution files. Changes: - Add AGPL-3.0 LICENSE file (copied from root) - Update pyproject.toml with AGPL-3.0 license and full metadata - Update setup.py with AGPL-3.0 license classifier - Add MANIFEST.in to include LICENSE in distribution - Simplify README.md with project goals and single example - Add link to https://codepathfinder.dev Package validated: - Build: SUCCESS (14KB wheel, 21KB tarball) - Twine check: PASSED - Test coverage: 99.16% (167/167 tests) - Dependencies: Zero (stdlib only) - Python: 3.8+ 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
Add extensive test coverage for new CLI integration and DSL functionality: **cmd/scan.go tests (100% coverage)**: - countTotalCallSites: Tests for counting across functions, empty graphs - printDetections: Tests for full/minimal fields, multiple detections **cmd/ci.go tests (95%+ coverage)**: - generateSARIFOutput: Valid output, multiple rules, severity mapping - generateJSONOutput: Valid output, multiple detections, optional fields - Mock os.Exit() to enable testing without process termination **dsl/dataflow_executor_test.go enhancements**: - executeLocal: Sanitizer detection, reverse order, cross-function filtering - executeGlobal: Cross-function flows, sanitizer on path validation **dsl/ir_types_test.go (100% coverage)**: - GetType() methods for all IR types - Interface implementation verification **Test infrastructure**: - Helper functions for creating test rules - Comprehensive edge case coverage - All tests passing with linter compliance Coverage achieved: - scan.go: 100% - ci.go: 95%+ - dataflow_executor.go: 95%+ - ir_types.go: 100% 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Fixed critical bug where scan command failed to index any functions in the callgraph when using relative paths (e.g., --project .). Root Cause: - graph.Initialize() created nodes with relative file paths - BuildModuleRegistry() converted paths to absolute internally - indexFunctions() couldn't match relative paths to absolute paths - All functions skipped, resulting in 0 vulnerabilities detected Solution: Convert projectPath to absolute using filepath.Abs() before passing to both graph.Initialize() and callgraph.BuildCallGraph() to ensure consistent path representation throughout the pipeline. Impact: - Before: "indexed 0, skipped_registry=1149" (0 functions) - After: "indexed 1149, skipped_registry=0" (all functions) - Integration test now correctly detects vulnerabilities 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
063ae32 to
e0b3677
Compare
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.

Implements CLI commands for executing Python DSL security rules against codebases. Adds scan command for CI/CD vulnerability detection, query command for ad-hoc exploration, and ci command with SARIF/JSON output support. Integrates dataflow executor with pattern-based source-to-sink matching for intra-procedural taint analysis.