SAST & Secret Detection (Semgrep + Gitleaks)
Deep static analysis of Abstract Syntax Trees (ASTs) for code vulnerabilities and Shannon-entropy scanning for exposed credentials.
1. Source Code AST Analysis Architecture
Kavach SAST engine uses Semgrep for pattern matching directly against language parse trees (ASTs) rather than brittle regex matching. This enables semantic taint tracking — following untrusted user inputs from HTTP request parameters (sources) to database queries or shell executions (sinks).
2. High-Entropy Secret Detection (Gitleaks)
Secret scanning integrates Gitleaks Shannon-entropy algorithms alongside verified regex signatures. It scans commit history, staging areas, and configuration files for AWS access keys, Stripe secret keys, GitHub personal access tokens, and private RSA keys.
3. Rulesets, Severity Scoring & False Positives
Every detected finding is classified under CVSS v3.1 into CRITICAL, HIGH, MEDIUM, or LOW severity. To eliminate false positives, Kavach checks whether test directories, mocks, or dead code paths generated the finding, automatically pruning them from production merge blockers.
4. CLI Scan Execution & Pre-Commit Hook
Developers can execute SAST and secret checks locally before pushing code to remote branches:
5. Automated Remediation Diff
When an unsafe pattern is verified (e.g. string concatenation in SQL queries), Kavach proposes an idiomatic parameterized query patch. The patch is tested in an ephemeral sandbox before submitting a pull request.
