Skip to content
Back to skills

Semgrep Appsec Scanner

ASecurity

Use when running Semgrep SAST on source code: registry or custom rules, secrets detection, supply-chain dependency findings, and result triage.

  • 75 stars
  • 0 votes
  • 0 copies
  • 5 views
  • Added September 12, 2026
ai-agentspythongoshellbashsqlrailsapisecurity

Works with

  • cli
  • api

Security analysis

A100/100

Scanned November 25, 2026

npx -y skills add seaworld008/Commonly-used-high-value-skills --skill semgrep-appsec-scanner --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Semgrep Appsec Scanner?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Semgrep Appsec Scanner
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/seaworld008-semgrep-appsec-scanner/badge)](https://www.skillsdirectory.com/skills/seaworld008-semgrep-appsec-scanner)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: semgrep-appsec-scanner
description: 'Use when running Semgrep SAST on source code: registry or custom rules, secrets detection, supply-chain dependency findings, and result triage.'
zh_description: "用于通过 Semgrep 执行应用安全 SAST、源码扫描、自定义规则、密钥流程和供应链依赖分析。"
version: "1.0.2"
author: seaworld008
source: "in-house"
source_url: ""
tags: [security, sast, semgrep, code-scanning, supply-chain, secrets, ci, appsec]
created_at: "2026-05-20"
updated_at: "2026-11-17"
quality: 4
complexity: advanced
---

# 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:
- "scan this code with Semgrep"
- "find injection bugs"
- "add SAST to CI"
- "write a Semgrep rule"
- "scan dependencies with Semgrep Supply Chain"
- "triage Semgrep findings"

## Core Capabilities

- Run SAST checks across many common programming languages.
- Use community and organization rules from the Semgrep registry.
- Author custom rules for project-specific insecure patterns.
- Triage findings with file, line, rule ID, and dataflow context.
- Integrate scans into pull requests and CI.
- Combine SAST with supply-chain and secrets workflows when the Semgrep plan supports them.

## Workflow

### 1. Identify Languages and Frameworks

Before scanning, inspect the repo:

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

Classify:
- Primary languages.
- Web frameworks.
- Package managers and lockfiles.
- Generated directories to exclude.
- Test fixtures that may intentionally contain insecure samples.

### 2. Verify Semgrep

```bash
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

```bash
semgrep scan --config auto
```

For stricter security-focused scans:

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

For JSON output:

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

For SARIF:

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

### 4. Triage Findings

For each finding, record:
- Rule ID.
- File and line.
- Vulnerability class.
- Source and sink, if dataflow is available.
- User-controlled input evidence.
- Exploit preconditions.
- Suggested fix and regression test.

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:

```yaml
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:
- Prefer framework-native safe APIs.
- Add tests for the vulnerable path.
- Avoid broad sanitizers that hide root causes.
- Keep suppressions narrow and justified.

For dependency findings:
- Prefer package-manager native updates.
- Check whether the vulnerable dependency is reachable.
- Treat supply-chain results as complementary to OSV, Grype, Trivy, or Snyk scans.

## 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.

```yaml
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

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

### Finding Report Template

```markdown
## Semgrep Finding

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

## Interpretation Rules

- Semgrep is strongest when rules match the language and framework accurately.
- Do not report test fixtures, docs, or intentionally vulnerable examples unless they can ship.
- A finding without a feasible data path may be a hardening recommendation rather than a vulnerability.
- Use custom rules for local conventions; do not force generic rules to carry all policy.
- Keep false-positive feedback in rule tests so the signal improves over time.

## Boundaries

- Do not upload private code to a hosted service without approval.
- Do not suppress a rule across the entire repo unless the pattern is demonstrably irrelevant.
- Do not claim SAST coverage means dependency or runtime security is complete.
- Do not auto-fix security code without running tests around the behavior.
- Do not scan vendored dependencies as first-party code unless the user asks.

## Reference Sources

- Semgrep docs: https://semgrep.dev/docs/
- Running rules: https://semgrep.dev/docs/running-rules/
- Semgrep Supply Chain overview: https://semgrep.dev/docs/semgrep-supply-chain/overview/

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.