Semgrep appsec scanner

From seaworld008/Commonly-used-high-value-skills · View interactive version

Semgrep appsec scanner is an AI agent skill from the GitHub repository seaworld008/Commonly-used-high-value-skills. Use when running Semgrep SAST on source code: registry or custom rules, secrets detection, supply-chain dependency findings, and result triage.

How to use this skill

Skill file

Semgrep AppSec Scanner

Trigger / When to Use

Use this skill when the user asks for source-code vulnerability scanning, secure coding rule enforcement, custom SAST checks, secret scanning workflow design, or Semgrep Supply Chain dependency analysis.

Good trigger phrases:

Core Capabilities

Workflow

1. Identify Languages and Frameworks

Before scanning, inspect the repo:

rg --files | sed -n '1,120p'

Classify:

2. Verify Semgrep

semgrep --version

If missing, recommend official installation. For one-off local scans, a package manager or containerized Semgrep run is usually enough.

3. Run Baseline SAST

semgrep scan --config auto

For stricter security-focused scans:

semgrep scan --config p/security-audit
semgrep scan --config p/owasp-top-ten

For JSON output:

semgrep scan --config auto --json --output semgrep-results.json

For SARIF:

semgrep scan --config auto --sarif --output semgrep-results.sarif

4. Triage Findings

For each finding, record:

Prioritize:

  1. Injection, deserialization, auth bypass, SSRF, path traversal, and unsafe crypto.
  2. Findings in production paths over tests or examples.
  3. Framework-specific high-confidence rules.
  4. Repeated patterns that deserve custom guardrails.

5. Write Custom Rules When Needed

Use custom rules when the project has a known unsafe wrapper or banned API:

rules:
  - id: no-dangerous-shell
    message: Review this subprocess.run call with shell=True.
    severity: ERROR
    languages: [python]
    patterns:
      - pattern: subprocess.run($CMD, shell=True, ...)

Validate the rule with positive and negative examples before adding it to CI.

6. Remediate

For code fixes:

For dependency findings:

Common Patterns

Pull Request CI

Set SEMGREP_CI_IMAGE to a reviewed, digest-pinned CI image providing a shell and the project's Semgrep CLI version. The example uses the checked-in rule directory shown below.

name: semgrep
on: [pull_request]
jobs:
  semgrep:
    runs-on: ubuntu-latest
    container:
      image: ${{ vars.SEMGREP_CI_IMAGE }}
    steps:
      - uses: actions/checkout@v4
      - name: Semgrep scan
        run: |
          semgrep --version
          semgrep scan --config .semgrep/rules --error

Project Rule Directory

.semgrep/
  rules/
    no-dangerous-shell.yml
    no-raw-sql-wrapper.yml
  tests/
    no-dangerous-shell.py

Finding Report Template

## Semgrep Finding

- Rule:
- Severity:
- Location:
- User input source:
- Sensitive sink:
- Exploit path:
- Fix:
- Test:
- Suppression status:

Interpretation Rules

Boundaries

Reference Sources

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.