From threatmodel-skills
Performs SAST with Semgrep to scan code for vulnerabilities across languages, provide OWASP/CWE mappings, remediation guidance, custom rules, and CI/CD integration.
npx claudepluginhub agentsecops/secopsagentkit --plugin offsec-skillsThis skill uses the workspace's default tool permissions.
Perform comprehensive static application security testing using Semgrep, a fast, open-source
Designs and optimizes AI agent action spaces, tool definitions, observation formats, error recovery, and context for higher task completion rates.
Compares coding agents like Claude Code and Aider on custom YAML-defined codebase tasks using git worktrees, measuring pass rate, cost, time, and consistency.
Designs, implements, and audits WCAG 2.2 AA accessible UIs for Web (ARIA/HTML5), iOS (SwiftUI traits), and Android (Compose semantics). Audits code for compliance gaps.
Perform comprehensive static application security testing using Semgrep, a fast, open-source static analysis tool. This skill provides automated vulnerability detection, security code review workflows, and remediation guidance mapped to OWASP Top 10 and CWE standards.
Scan a codebase for security vulnerabilities:
semgrep --config=auto --severity=ERROR --severity=WARNING /path/to/code
Run with OWASP Top 10 ruleset:
semgrep --config="p/owasp-top-ten" /path/to/code
scripts/semgrep_scan.py with appropriate rulesetssemgrep --diff to scan only modified codereferences/remediation_guide.mdassets/rule_template.yamlreferences/custom_rules.mdassets/ci_config_examples/Sensitive Data Handling: Semgrep scans code locally; ensure scan results don't leak
secrets or proprietary code patterns. Use --max-lines-per-finding to limit output.
Access Control: Semgrep scans require read access to source code. Restrict scan result access to authorized security and development teams.
Audit Logging: Log all scan executions with timestamps, user, commit hash, and findings count for compliance auditing.
Compliance: SAST scanning supports SOC2, PCI-DSS, and GDPR compliance requirements. Maintain scan history and remediation tracking.
Safe Defaults: Use --config=auto for balanced detection. For security-critical
applications, use --config="p/security-audit" for comprehensive coverage.
Semgrep supports 30+ languages including:
scripts/semgrep_scan.py - Full-featured scanning with OWASP/CWE mapping and reportingscripts/baseline_scan.sh - Quick baseline scan for CI/CDscripts/diff_scan.sh - Scan only changed files (for PRs)references/owasp_cwe_mapping.md - OWASP Top 10 to CWE mapping with Semgrep rulesreferences/remediation_guide.md - Vulnerability remediation patterns by categoryreferences/rule_library.md - Curated list of useful Semgrep rulesetsassets/rule_template.yaml - Template for creating custom Semgrep rulesassets/ci_config_examples/ - CI/CD integration examples (GitHub Actions, GitLab CI)assets/semgrep_config.yaml - Recommended Semgrep configuration# Run comprehensive scan and generate report
scripts/semgrep_scan.py --config security-audit \
--output results.json \
--format json \
--severity HIGH CRITICAL
# Scan only changed files, fail on HIGH/CRITICAL
scripts/diff_scan.sh --fail-on high \
--base-branch main \
--output sarif
# Search for specific vulnerability patterns
semgrep --config "r/javascript.lang.security.audit.xss" \
--json /path/to/code | jq '.results'
# Test custom rule against vulnerable samples
semgrep --config assets/custom_rules.yaml \
--test tests/vulnerable_samples/
semgrep/semgrep-action@v1 with SARIF uploadSee assets/ci_config_examples/ for ready-to-use configurations.
Semgrep findings are classified by severity:
For large codebases:
# Use --jobs for parallel scanning
semgrep --config auto --jobs 4
# Exclude vendor/test code
semgrep --config auto --exclude "vendor/" --exclude "test/"
# Use lightweight rulesets for faster feedback
semgrep --config "p/owasp-top-ten" --exclude-rule "generic.*"
Solution:
--exclude-rule to disable noisy rules.semgrepignore file to exclude false positive patterns--severity filtering# nosemgrep comments for confirmed false positives (with justification)Solution:
--exclude for vendor/generated code--jobs for parallel processing--config=auto--diffSolution:
p/security-audit or p/owasp-top-tenreferences/rule_library.md for specialized rulesSee references/rule_library.md for guidance on writing effective Semgrep rules.
Use assets/rule_template.yaml as a starting point.
Example rule structure:
rules:
- id: custom-sql-injection
patterns:
- pattern: execute($QUERY)
- pattern-inside: |
$QUERY = $USER_INPUT + ...
message: Potential SQL injection from user input concatenation
severity: ERROR
languages: [python]
metadata:
cwe: "CWE-89"
owasp: "A03:2021-Injection"
This skill provides detection for all OWASP Top 10 2021 categories.
See references/owasp_cwe_mapping.md for complete coverage matrix.