Skip to content

Repository files navigation

Warden logo

Warden — AIDLC Security Review

Security as a blocking constraint, not a checklist.

An AI-powered security review GitHub Action that analyzes code changes for vulnerabilities using Anthropic's Claude for deep, context-aware semantic analysis. The code-review pillar of Warden, the AI-Driven Development Lifecycle (AIDLC) security platform by Techanv Consulting.

License Powered by Claude GitHub Action Website

Warden banner

Table of Contents


Overview

Warden integrates security directly into AI-assisted development. Rather than treating security as an afterthought checklist, Warden bakes protective guardrails into every stage of AI-powered coding — preventing violations from proceeding without human review.

This repository is the code-review pillar: a GitHub Action that runs on pull requests, uses Claude to understand what changed and why, and surfaces real, high-impact security findings as inline PR comments.

Note: Warden calls the Anthropic Claude API under the hood. References to the anthropic SDK, the ANTHROPIC_API_KEY environment variable, the @anthropic-ai/claude-code CLI, and claude-* model IDs are functional and intentionally preserved.

Where Warden Fits

Warden enforces security across the three phases of the AI-Driven Development Lifecycle (AIDLC):

AIDLC security pipeline — Inception, Construction, Operations
Phase Focus This Action
Inception Threat modeling
Construction Code review You are here
Operations Deployment & monitoring

Features

  • AI-Powered Analysis — Claude's reasoning detects vulnerabilities with deep semantic understanding, not just pattern matching.
  • Diff-Aware Scanning — For PRs, only analyzes changed files.
  • Inline PR Comments — Posts findings on the exact lines of code.
  • Contextual Understanding — Understands code intent and purpose, reducing noise.
  • Language Agnostic — Works with any programming language.
  • False-Positive Filtering — Advanced filtering focuses attention on real, high-impact issues.

Quick Start

Add this to your repository's .github/workflows/security.yml:

name: Security Review

permissions:
  pull-requests: write  # Needed for leaving PR comments
  contents: read

on:
  pull_request:

jobs:
  security:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          ref: ${{ github.event.pull_request.head.sha || github.sha }}
          fetch-depth: 2

      - uses: techanvconsulting/warden-action@main
        with:
          comment-pr: true
          claude-api-key: ${{ secrets.CLAUDE_API_KEY }}

Add your Anthropic Claude API key as the CLAUDE_API_KEY repository secret. The key must be enabled for both the Claude API and Claude Code usage.

How It Works

Warden architecture diagram
  1. PR Analysis — When a pull request opens, Claude analyzes the diff to understand what changed.
  2. Contextual Review — Claude examines the changes in context, understanding purpose and security implications.
  3. Finding Generation — Issues are identified with explanations, severity ratings, and remediation guidance.
  4. False-Positive Filtering — Low-impact and false-positive-prone findings are filtered out to reduce noise.
  5. PR Comments — Findings are posted as review comments on the specific lines of code.

Repository Layout

claudecode/
├── github_action_audit.py   # Main audit entrypoint for GitHub Actions
├── prompts.py               # Security audit prompt templates
├── findings_filter.py       # False-positive filtering logic
├── claude_api_client.py     # Claude API client for false-positive filtering
├── json_parser.py           # Robust JSON parsing utilities
├── requirements.txt         # Python dependencies
├── test_*.py                # Test suites
└── evals/                   # Eval tooling to test scans on arbitrary PRs

Example Output

Example Warden security finding posted as a PR comment

Configuration

Action Inputs

Input Description Default Required
claude-api-key Anthropic Claude API key for security analysis. Must be enabled for both the Claude API and Claude Code usage. None Yes
comment-pr Whether to comment on PRs with findings true No
upload-results Whether to upload results as artifacts true No
exclude-directories Comma-separated list of directories to exclude from scanning None No
claude-model Claude model name to use. Defaults to Opus 4.1. claude-opus-4-1-20250805 No
claudecode-timeout Timeout for analysis in minutes 20 No
run-every-commit Run on every commit (skips cache check). May increase false positives on PRs with many commits. false No
false-positive-filtering-instructions Path to custom false-positive filtering instructions file None No
custom-security-scan-instructions Path to custom security scan instructions file to append to the audit prompt None No
warden-url Warden platform base URL to push findings to (e.g. https://warden.example.com). Leave empty to skip. None No
warden-token Warden CI access token used to upload findings (Setting → CI Token in Warden). None No

Send findings to the Warden platform

Set warden-url and warden-token to push every finding into your Warden instance through its CI ingest API, so PR-review results land in the dashboard alongside the rest of the scanner fleet (Semgrep, Trivy, gitleaks, …). The upload runs after the scan and never fails the build — it no-ops if the URL or token is unset.

- uses: techanvconsulting/warden-action@v1
  with:
    claude-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
    warden-url: https://warden.example.com
    warden-token: ${{ secrets.WARDEN_CI_TOKEN }}

Each finding maps to a Warden SAST finding under the warden-ai scanner: severity (HIGH → High, …), file/line → location, exploit_scenario appended to the description, recommendation → remediation, cwe → rule. PR scans are tagged with the merge-request id so they appear in the PR's shift-left view.

Action Outputs

Output Description
findings-count Total number of security findings
results-file Path to the results JSON file

Security Analysis Capabilities

Vulnerability Categories Detected

  • Injection — SQL, command, LDAP, XPath, NoSQL injection, XXE
  • Authentication & Authorization — broken auth, privilege escalation, IDOR, bypass logic, session flaws
  • Data Exposure — hardcoded secrets, sensitive data logging, information disclosure, PII handling
  • Cryptography — weak algorithms, improper key management, insecure randomness
  • Input Validation — missing validation, improper sanitization, buffer overflows
  • Business Logic — race conditions, TOCTOU issues
  • Configuration — insecure defaults, missing security headers, permissive CORS
  • Supply Chain — vulnerable dependencies, typosquatting risks
  • Code Execution — RCE via deserialization, pickle injection, eval injection
  • Cross-Site Scripting (XSS) — reflected, stored, and DOM-based

False-Positive Filtering

By default, low-impact and false-positive-prone findings are excluded to focus on high-impact issues:

  • Denial-of-Service vulnerabilities
  • Rate-limiting concerns
  • Memory/CPU exhaustion
  • Generic input validation without proven impact
  • Open redirects

Filtering can be tuned per project — see Custom Scanning Configuration.

Benefits Over Traditional SAST

  • Contextual understanding of semantics and intent, not just patterns
  • Lower false positives through AI reasoning about actual exploitability
  • Detailed explanations of why something is vulnerable and how to fix it
  • Adaptive to organization-specific security requirements

Claude Code Integration: /security-review Command

By default, Claude Code ships a /security-review slash command that provides the same analysis as this Action, integrated directly into your Claude Code environment. Run /security-review to perform a comprehensive review of all pending changes.

Customizing the Command

  1. Copy security-review.md into your project's .claude/commands/ folder.
  2. Edit it to add organization-specific scan or filtering directions.

Custom Scanning Configuration

Custom scanning and false-positive filtering instructions are supported. See the docs/ folder:

Local Development & Testing

Run the test suite:

cd warden-action
# Run all tests
pytest claudecode -v

To run the scanner locally against a specific PR, see the evaluation framework documentation.

Security Considerations

This Action is not hardened against prompt injection and should only review trusted PRs. Configure your repository to require approval for all external contributors so workflows only run after a maintainer review.

License & Attribution

Licensed under the Apache License 2.0 — see LICENSE and NOTICE.

Warden is a product of Techanv Consulting. It is a derivative of Anthropic's MIT-licensed claude-code-security-review; the original MIT notice is retained in NOTICE.

Support


Built by Techanv Consulting · Powered by Anthropic Claude

About

No description, website, or topics provided.

Resources

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages