# AI Security Scan

> AI-powered security scanning -- Semgrep, Snyk, CodeQL, SonarQube AI features, custom rules, CI/CD integration, and accuracy benchmarks.

- Skill: `leolin990405/ai-security-scan` (Agent Skill)
- Install (CLI): `npx get-skill add leolin990405/ai-security-scan`
- Raw SKILL.md: https://api.skillmd.com/api/skills/leolin990405/ai-security-scan/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: DevOps & Infra
- Author: LeoLin990405 (https://skillmd.com/u/leolin990405)
- Updated: 2026-11-11
- Page: https://skillmd.com/skills/leolin990405/ai-security-scan

---


# AI Security Scanning

## Tools Comparison

| Tool | Type | AI Features | Accuracy | Languages |
|------|------|-------------|----------|-----------|
| CodeQL | SAST | Auto-remediation | 88% | 15+ |
| Snyk Code | SAST | AI fix suggestions, DAST | 85% | 20+ |
| Semgrep | SAST+SCA | AI triage + autofix | 82% | 30+ |
| SonarQube | SAST | AI CodeFix, AI Assurance | Medium | 35+ |

## Semgrep

### CI Integration
```yaml
name: Semgrep
on: [pull_request]
jobs:
  semgrep:
    runs-on: ubuntu-latest
    container: { image: semgrep/semgrep }
    steps:
      - uses: actions/checkout@v4
      - run: semgrep ci
        env:
          SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}
```

### Custom Rules
```yaml
rules:
  - id: no-hardcoded-secrets
    patterns:
      - pattern: $KEY = "..."
      - metavariable-regex:
          metavariable: $KEY
          regex: (password|secret|api_key|token)
    message: "Hardcoded secret in $KEY"
    severity: ERROR
    languages: [python, javascript, typescript]
```

## GitHub CodeQL

```yaml
name: CodeQL
on:
  push: { branches: [main] }
  pull_request: { branches: [main] }
jobs:
  analyze:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: github/codeql-action/init@v3
        with: { languages: "javascript, python" }
      - uses: github/codeql-action/autobuild@v3
      - uses: github/codeql-action/analyze@v3
```

## Snyk

- **DeepCode AI**: Real-time in-IDE scanning
- **DAST Correlation**: Links static findings to exploitable runtime issues
- **Agent Fix**: Context-aware AI remediation

## SonarQube AI (2025-2026)

- **AI CodeFix**: LLM-generated fixes (Enterprise edition)
- **AI Code Assurance**: Special quality gate for AI-generated code

## Combined Pipeline

```yaml
name: Security Pipeline
on: [pull_request]
jobs:
  sast:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: semgrep ci
      - uses: github/codeql-action/analyze@v3
  sca:
    runs-on: ubuntu-latest
    steps:
      - uses: snyk/actions/node@master
        env: { SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} }
```

## Sources

- [Semgrep](https://github.com/semgrep/semgrep)
- [Snyk DeepCode AI](https://snyk.io/platform/deepcode-ai/)
- [CodeQL](https://github.com/github/codeql-action)
- [SonarQube AI](https://docs.sonarsource.com/sonarqube-cloud/ai-capabilities/ai-code-assurance)

