unitoneai/securityskills/sast-config

Claude Code and agent skill by unitoneai/securityskills

Trust tier 3
  • community
  • ext:[{"type":"hook","description":"Pre/post lifecycle hooks"},{"type":"config","description":"Configuration overrides"}]
Source check pending

Checking that the SKILL.md file is still in the repository.

Reviews and tunes SAST tool configurations against OWASP ASVS 4.0.3 and CWE Top 25. Auto-invoked when reviewing Semgrep rules, CodeQL queries, SAST CI integration, or false positive triage workflows. Produces a SAST maturity assessment covering rule authoring, severity tuning, custom rule development, and CI integration patterns.

Install

npx vskill@latest install unitoneai/securityskills/sast-config

Semi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard

SKILL.md

The same SKILL.md was published earlier as unitoneai/securityskills/sast-config.

SAST Tool Configuration and Tuning

A structured, repeatable process for reviewing and tuning Static Application Security Testing (SAST) tool configurations against OWASP ASVS 4.0.3 verification requirements and the CWE Top 25 Most Dangerous Software Weaknesses. This skill covers Semgrep rule authoring, CodeQL query patterns, severity tuning, false positive management, custom rule development, and CI integration. All findings map to ASVS controls and CWE identifiers.


When to Use

If a target is provided via arguments, focus the review on: $ARGUMENTS

  • Initial SAST deployment to establish baseline rule configuration.
  • Periodic SAST tuning reviews to reduce false positive rates.
  • Custom rule development for organization-specific vulnerability patterns.
  • CI/CD integration review for SAST gate enforcement.
  • Post-incident rule gap analysis (a vulnerability was missed -- why?).
  • ASVS compliance mapping to verify SAST coverage against verification requirements.

Context

SAST tools are only as effective as their configuration. Default rule sets produce high false positive rates that erode developer trust, while overly aggressive tuning creates dangerous blind spots. OWASP ASVS 4.0.3 provides 286 verification requirements across 14 chapters -- a subset of these are automatable via SAST. The CWE Top 25 (2024 edition) identifies the most prevalent and impactful weakness types. Effective SAST tuning maps rules to these frameworks, tunes severity to organizational risk context, and integrates into CI with clear pass/fail criteria that developers can act on.


Process

Step 1: Discovery -- Locate SAST Configurations

Use Glob and Grep to locate SAST tool configurations, custom rules, and CI integration.

Patterns to search:

# Semgrep
**/.semgrep.yml
**/.semgrep.yaml
**/.semgrep/
**/semgrep*
**/.semgrepignore
# CodeQL
**/.github/codeql/
**/codeql-config.yml
**/*.ql
**/*.qll
**/qlpack.yml
**/.github/workflows/*codeql*
# General SAST
**/sonar-project.properties
**/.sonarcloud.properties
**/checkmarx*
**/fortify*
**/.bandit
**/bandit.yaml
**/.flake8
**/pylintrc
**/.eslintrc*
# CI integration
**/.github/workflows/*.yml
**/.gitlab-ci.yml
**/Jenkinsfile*

Categorize by:

  • Tool: Semgrep, CodeQL, SonarQube, Bandit, ESLint-security, etc.
  • Rule source: Default/managed rules, community rules, custom org rules.
  • Integration point: Pre-commit, PR check, scheduled scan, IDE plugin.

Step 2: Rule Coverage Analysis Against CWE Top 25

Map the active SAST rule set against CWE Top 25 (2024) to identify coverage gaps.

2.1 CWE Top 25 Coverage Matrix
RankCWE IDWeaknessSAST DetectableSemgrep RegistryCodeQL Coverage
1CWE-787Out-of-bounds WritePartial (C/C++)Limitedcpp/overflow-buffer
2CWE-79Cross-site Scripting (XSS)Yesjavascript.browser.security.*.xssjs/xss, js/reflected-xss
3CWE-89SQL InjectionYespython.django.security.injection.sql.*, java.lang.security.audit.sqli.*java/sql-injection, python/sql-injection
4CWE-416Use After FreePartial (C/C++)Limitedcpp/use-after-free
5CWE-78OS Command InjectionYespython.lang.security.audit.dangerous-subprocess-use.*python/command-injection, java/command-injection
6CWE-20Improper Input ValidationPartialPattern-dependentPattern-dependent
7CWE-125Out-of-bounds ReadPartial (C/C++)Limitedcpp/out-of-bounds-read
8CWE-22Path TraversalYespython.lang.security.audit.path-traversal.*python/path-injection, java/path-injection
9CWE-352CSRFPartialFramework-specificjava/csrf, python/csrf
10CWE-434Unrestricted UploadPartialFramework-specificPattern-dependent

For each CWE, verify:

  • At least one active rule covers the weakness for each language in the codebase.
  • Rule is enabled (not suppressed in configuration).
  • Rule severity matches the CWE's risk (Top 10 CWEs should not be INFO level).

Finding classification: CWE Top 10 weakness with zero SAST coverage for a language in use is High. CWE 11-25 with no coverage is Medium.


Step 3: Semgrep Rule Authoring Review
3.1 Semgrep Configuration Structure

Verify the Semgrep configuration follows best practices:

yaml
# .semgrep.yml -- well-structured configuration
rules:
# Rule references managed rule sets
- p/owasp-top-ten
- p/cwe-top-25
- p/r2c-security-audit
# Organization-specific custom rules
- ./semgrep-rules/
# .semgrepignore -- exclusion patterns (must be justified)
test/
vendor/
node_modules/
*.test.js
*.spec.py

What to verify:

  • Managed rule sets are pinned to a version or use p/ registry references.
  • Custom rule directory exists and contains organization-specific rules.
  • .semgrepignore exclusions are justified (test files are acceptable; production code paths are not).
  • --error flag is used in CI to fail the pipeline on findings (not just report).
3.2 Custom Semgrep Rule Authoring (YAML format)

Custom rules should follow Semgrep's rule schema. Example of a well-authored custom rule:

yaml
rules:
- id: custom.auth.jwt-none-algorithm
patterns:
- pattern: |
jwt.encode($PAYLOAD, ..., algorithm="none")
- pattern: |
jwt.decode($TOKEN, ..., algorithms=["none", ...])
message: >
JWT with 'none' algorithm detected. This disables signature verification
and allows token forgery. Use RS256 or ES256.
languages: [python]
severity: ERROR
metadata:
cwe:
- "CWE-327: Use of a Broken or Risky Cryptographic Algorithm"
owasp:
- "A02:2021 - Cryptographic Failures"
asvs:
- "V6.2.1"
confidence: HIGH
impact: HIGH
references:
- https://cwe.mitre.org/data/definitions/327.html
- id: custom.auth.hardcoded-admin-bypass
pattern: |
if $USER == "admin":
return True
message: >
Hardcoded admin bypass detected. Authentication decisions must use
proper identity verification, not string comparison against hardcoded values.
languages: [python]
severity: ERROR
metadata:
cwe:
- "CWE-798: Use of Hard-coded Credentials"
asvs:
- "V2.10.1"
confidence: HIGH
- id: custom.crypto.weak-random
patterns:
- pattern-either:
- pattern: random.random()
- pattern: random.randint(...)
- pattern: Math.random()
- pattern-not-inside: |
# nosemgrep: custom.crypto.weak-random
...
message: >
Weak PRNG used in potentially security-sensitive context. Use
secrets.token_bytes() or crypto.getRandomValues() for security purposes.
languages: [python, javascript]
severity: WARNING
metadata:
cwe:
- "CWE-330: Use of Insufficiently Random Values"
asvs:
- "V6.3.1"

Rule quality checklist:

  • [ ] id follows a namespace convention (e.g., custom.category.name).
  • [ ] pattern uses metavariables ($VAR) correctly for taint tracking.
  • [ ] message explains the vulnerability AND references the fix.
  • [ ] severity is ERROR (blocks CI), WARNING (reported), or INFO (informational).
  • [ ] metadata includes cwe, owasp, and/or asvs references.
  • [ ] confidence is documented (HIGH, MEDIUM, LOW).
  • [ ] languages is explicitly specified.
  • [ ] pattern-not or pattern-not-inside handles known safe patterns to reduce false positives.

Step 4: CodeQL Query Pattern Review
4.1 CodeQL Configuration
yaml
# .github/codeql/codeql-config.yml
name: "Custom CodeQL Config"
queries:
- uses: security-extended # More rules than default
- uses: security-and-quality # Maximum coverage
- uses: ./codeql-queries # Custom queries
paths-ignore:
- test/**
- vendor/**
- "**/*.test.js"
query-filters:
- exclude:
id: js/redundant-assignment # Documented false positive

What to verify:

  • security-extended or security-and-quality query suite is used (not just default).
  • Custom query directory exists for org-specific patterns.
  • paths-ignore does not exclude production source code.
  • query-filters exclusions have documented justification.
4.2 CodeQL Custom Query Structure
ql
/**
* @name SQL injection from user-controlled source
* @description Detects SQL queries built from user input without parameterization.
* @kind path-problem
* @problem.severity error
* @security-severity 9.8
* @precision high
* @id custom/sql-injection
* @tags security
* external/cwe/cwe-089
* external/owasp/a03-2021
*/
import java
import semmle.code.java.dataflow.TaintTracking
import semmle.code.java.security.SqlInjectionQuery
class CustomSqlInjectionConfig extends TaintTracking::Configuration {
CustomSqlInjectionConfig() { this = "CustomSqlInjectionConfig" }
override predicate isSource(DataFlow::Node source) {
source instanceof RemoteFlowSource
}
override predicate isSink(DataFlow::Node sink) {
sink instanceof SqlInjectionSink
}
}
from CustomSqlInjectionConfig config, DataFlow::PathNode source, DataFlow::PathNode sink
where config.hasFlowPath(source, sink)
select sink.getNode(), source, sink, "SQL injection from $@.", source.getNode(), "user input"

Query quality checklist:

  • [ ] @kind is appropriate (path-problem for taint tracking, problem for point queries).
  • [ ] @security-severity uses CVSS scale (0.0-10.0).
  • [ ] @precision is set (high, medium, low) -- affects result ranking.
  • [ ] @tags include CWE and OWASP references.
  • [ ] Taint tracking uses appropriate source and sink definitions.
  • [ ] Query is tested against known-vulnerable and known-safe code samples.

Step 5: Severity Tuning and False Positive Management
5.1 Severity Mapping to OWASP ASVS

Map tool-native severity levels to a consistent organizational severity:

ASVS LevelRisk ContextSemgrep SeverityCodeQL SeverityCI Action
L1 (Opportunistic)Internet-facing, unauthenticatedERRORerror, @security-severity >= 7.0Block merge
L2 (Standard)Authenticated, business-criticalERROR or WARNINGerror or warning, >= 4.0Block or warn
L3 (Advanced)High-value targets, regulated dataWARNING or INFOAll severitiesWarn, review required
5.2 False Positive Management Workflow
Finding reported by SAST
|
v
[Triage by AppSec]
|
+----+----+
| |
True Positive False Positive
| |
v v
Create fix Document reason
ticket |
+--------+--------+
| |
Pattern issue Code-specific
(rule defect) (one-off FP)
| |
v v
Fix rule / Add inline
report upstream suppression
with comment

Suppression requirements:

python
# Semgrep inline suppression -- MUST include justification
value = request.args.get("id") # nosemgrep: python.django.security.injection.sql.sql-injection -- validated by ORM layer, not raw SQL
# CodeQL suppression via query filter (in codeql-config.yml)
# Document in SAST-SUPPRESSIONS.md with ticket reference

What to verify:

  • Every suppression has a documented justification (not just nosemgrep).
  • Suppressions are reviewed periodically (quarterly).
  • False positive rate is tracked as a metric (target: < 20% FP rate).
  • True positive findings have a defined SLA (Critical: 7 days, High: 30 days, Medium: 90 days).

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
76
Repository forks
133
7-day trend score
22

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Extension points

  • hookPre/post lifecycle hooks
  • configConfiguration overrides

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/unitoneai/securityskills/sast-config/badge)](https://verified-skill.com/skills/unitoneai/securityskills/sast-config)

Something wrong with this skill or its page? Tell us.