Detection β Evidence β Severity β Patch Preview β HTML/JSON Reports β Email Delivery
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π€ AGENTIC AI PROTECTION β’ π SECRET REDACTION β’ π ENV FILE AUDIT β
β π¦ ARTIFACT GOVERNANCE β’ π RISK SCORING β’ π RESPONSIVE REPORTS β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ActionGuard AutoAudit is a state-of-the-art security auditing engine designed specifically for modern GitHub CI/CD pipelines and agentic AI workflows. It builds upon zizmor by introducing specialized detection rules for AI agent threats, secret leaks, risky configuration files, and artifact retention vulnerabilities.
ActionGuard normalizes heterogeneous security findings from multiple tools (zizmor, Ruff, Bandit, npm audit, pip-audit) into a unified risk model, delivering actionable remediation plans complete with safe patch previews.
π Safety Guarantee: ActionGuard never mutates code automatically, deletes configuration files, rotates credentials, or changes production permissions without human oversight. It reports, redacts, and recommendsβkeeping developers strictly in control.
| Feature Area | Description | Highlights |
|---|---|---|
| π€ Agentic AI Security | Detects untrusted inputs reaching AI agents, AI outputs executed as shell scripts, and missing trust checks. | 5 dedicated rules (AG-AI-001βAG-AI-005) |
| π Secret Detection | Deep regex scanning for GitHub PATs, AWS keys, OpenAI/Google tokens, JWTs, DB URIs, and private keys. | 100% automated redaction (6-char prefix + ...redacted) |
| π Env & Config Audit | Identifies committed .env, .pem, .key, and credential files, alongside missing .gitignore rules. |
Prevents accidental leak of sensitive configuration files |
| π¦ Artifact Governance | Detects full-repository artifact uploads, sensitive path inclusions, and excessive retention (> 30 days). | Mitigates data exfiltration & storage bloat risks |
| π Tool Orchestration | Seamlessly wraps zizmor, Ruff, Bandit, pip-audit, and npm audit. | Graceful fallback if any tool is uninstalled/unavailable |
| π Normalized Risk Model | Calculates category scores (0β100) and an overall security score from severity-weighted rules. | Standardized risk metrics across all pipelines |
| π Rich Reporting | Generates self-contained, responsive HTML reports (dark-mode ready) and structured JSON. | Executive dashboard + machine-readable findings |
| π§ Email Notifications | Optional SMTP dispatch of HTML executive summaries directly to security engineers. | Silent fail-safe execution if SMTP secrets are absent |
flowchart TD
%% Inputs
subgraph Trigger ["β‘ Trigger Events"]
A1[GitHub Push / PR]
A2[Workflow Dispatch]
A3[Manual CLI Execution]
end
%% Core Engine
subgraph Engine ["π‘οΈ ActionGuard Core Engine"]
B[Orchestrator - actionguard.scanner]
subgraph CustomRules ["π Custom Rule Suite"]
R1[π€ Agentic AI Rules AG-AI-001..005]
R2[π Secret Detection & Redaction AG-SEC-001]
R3[π Environment & Config Audit AG-ENV-001..003]
R4[π¦ Artifact Upload & Retention AG-ART-001..003]
R5[π§Ή Repository Hygiene AG-HYG-001..004]
end
subgraph Integrations ["π Security Tool Integrations"]
I1[zizmor - Workflow Audit]
I2[Ruff + Bandit - SAST]
I3[npm audit + pip-audit - SCA]
end
end
%% Processing Layer
subgraph Processing ["π Processing & Normalization"]
N[Normalized Finding Collection]
S[Severity-Weighted Scoring Engine]
M[Remediation Plan & Patch Generator]
end
%% Output Layer
subgraph Outputs ["π Multi-Channel Outputs"]
O1[Interactive HTML Report]
O2[Machine-Readable JSON Report]
O3[GitHub CI Artifact]
O4[Optional SMTP Email Dispatch]
end
%% Connections
Trigger --> B
B --> CustomRules
B --> Integrations
CustomRules --> N
Integrations --> N
N --> S --> M
M --> O1
M --> O2
O1 & O2 --> O3
O1 --> O4
%% Styling
classDef trigger fill:#1f2937,stroke:#3b82f6,stroke-width:2px,color:#fff;
classDef engine fill:#111827,stroke:#8b5cf6,stroke-width:2px,color:#fff;
classDef process fill:#064e3b,stroke:#10b981,stroke-width:2px,color:#fff;
classDef output fill:#4c1d95,stroke:#a855f7,stroke-width:2px,color:#fff;
class A1,A2,A3 trigger;
class B engine;
class N,S,M process;
class O1,O2,O3,O4 output;
sequenceDiagram
autonumber
actor Dev as Developer / CI Runner
participant CLI as actionguard.cli
participant Scanner as Scanner Engine
participant Rules as Rules & Integrations
participant Redact as Redactor Utility
participant Score as Scoring Model
participant Rep as Report Generator
participant Mail as Email Dispatcher
Dev->>CLI: actionguard audit . --html report.html --json report.json
CLI->>Scanner: audit(repo_path, run_integrations=True)
par Custom Security Rules Execution
Scanner->>Rules: Execute Agentic, Secret, Env & Artifact Rules
Rules->>Redact: Redact sensitive tokens (first 6 chars + ...redacted)
Redact-->>Rules: Redacted Evidence Strings
and Upstream Tool Integrations Execution
Scanner->>Rules: Invoke zizmor, Ruff, Bandit, pip-audit, npm audit
end
Rules-->>Scanner: Return Normalized Findings[] & Tool Status
Scanner->>Score: calculate_scores(findings)
Score-->>Scanner: Return Overall (0-100) & Category Scores
Scanner-->>CLI: AuditResult Payload
CLI->>Rep: generate_reports(AuditResult)
Rep-->>CLI: Write report.html & report.json
opt SMTP Email Configured
CLI->>Mail: send_email(AuditResult, html_content)
Mail-->>Dev: Dispatch HTML Summary Email
end
CLI-->>Dev: Display Terminal Scoreboard & Summary
stateDiagram-v2
[*] --> UntrustedInputReceived: PR / Issue / Comment Created
state UntrustedInputReceived {
[*] --> CheckAuthorTrust
CheckAuthorTrust --> UntrustedAuthor: No author_association check (AG-AI-003)
CheckAuthorTrust --> TrustedAuthor: Verified Org Member
}
UntrustedAuthor --> PromptInjectionRisk: Consumed by AI Agent (AG-AI-001)
state PromptInjectionRisk {
[*] --> SecretExposureCheck
SecretExposureCheck --> SecretsLeaked: Agent context includes GITHUB_TOKEN (AG-AI-005)
SecretExposureCheck --> ShellExecutionCheck
ShellExecutionCheck --> ArbitraryCodeExec: AI output passed to `eval` or `bash` (AG-AI-002)
ShellExecutionCheck --> ExcessPermissions: Job has `write-all` permissions (AG-AI-004)
}
SecretsLeaked --> ActionGuardAlert: Flag Critical Vulnerability
ArbitraryCodeExec --> ActionGuardAlert: Flag Critical Vulnerability
ExcessPermissions --> ActionGuardAlert: Flag High Vulnerability
ActionGuardAlert --> [*]: Generate Safe Remediation Patch
| Rule ID | Category | Severity | Detection Target | Description & Mitigation |
|---|---|---|---|---|
AG-AI-001 |
Agentic AI | π΄ Critical | Untrusted Input to AI | Triggers when untrusted PR/issue/comment body is passed into an AI agent step without sanitization. |
AG-AI-002 |
Agentic AI | π΄ Critical | AI Output Shell Execution | Detects AI response outputs piped directly into eval, bash, sh, or executable steps. |
AG-AI-003 |
Agentic AI | π High | Missing Author Association | Flags comment-triggered workflows lacking github.event.comment.author_association verification. |
AG-AI-004 |
Agentic AI | π΄ Critical | Over-Privileged Agent Job | Detects AI workflows executing with write permissions (write-all or pull-requests: write). |
AG-AI-005 |
Agentic AI | π΄ Critical | Secrets Exposed to Agent | Flags high-privilege secrets (GITHUB_TOKEN, API keys) injected into untrusted AI agent contexts. |
| Rule ID | Category | Severity | Detection Target | Description & Mitigation |
|---|---|---|---|---|
AG-SEC-001 |
Secrets | π΄ Critical | Hardcoded Credentials | Scans for GitHub PATs (ghp_), AWS keys (AKIA), OpenAI keys (sk-), JWTs, DB URIs, and Private Keys. Always redacted. |
AG-ENV-001 |
Environment | π΄ Critical | Committed Sensitive Files | Flags committed .env, .env.production, *.pem, *.key, service-account.json files. |
AG-ENV-002 |
Environment | π‘ Medium | Missing .gitignore |
Warns if the repository lacks a .gitignore file entirely. |
AG-ENV-003 |
Environment | π‘ Medium | Incomplete .gitignore |
Detects .gitignore files that omit standard secret patterns (.env, *.key). |
| Rule ID | Category | Severity | Detection Target | Description & Mitigation |
|---|---|---|---|---|
AG-ART-001 |
Artifacts | π High | Whole-Repo Upload | Flags actions/upload-artifact steps targeting root path: . or path: ./. |
AG-ART-002 |
Artifacts | π High | Sensitive File Upload | Detects artifact paths containing sensitive directories (.env, .git, credentials). |
AG-ART-003 |
Artifacts | π High | Excessive Retention Window | Warns when artifact retention-days exceeds 30 days (reducing exposure window). |
| Rule ID / Source | Category | Severity | Detection Target | Description & Mitigation |
|---|---|---|---|---|
AG-HYG-001 |
Governance | π΅ Low | Missing Governance Docs | Checks for presence of README.md, LICENSE, SECURITY.md, and CODEOWNERS. |
AG-HYG-002 |
Governance | π΅ Low | Missing CI Workflows | Verifies that at least one GitHub Actions workflow exists under .github/workflows/. |
AG-HYG-003 |
Governance | π΅ Low | Missing Dependency Locks | Checks for poetry.lock, Pipfile.lock, package-lock.json, or yarn.lock. |
ZIZMOR-* |
CI/CD | Mapped | Upstream zizmor Findings | Normalizes all native zizmor workflow security findings into ActionGuard models. |
RUFF-* / BANDIT-* |
Code Quality | Mapped | Python Code SAST | Imports linting and static analysis findings from Ruff and Bandit. |
AUDIT-* |
Dependencies | Mapped | Dependency Vulnerabilities | Captures known security advisories from pip-audit and npm audit. |
ActionGuard calculates security scores on a 0 to 100 scale. Every repository starts at 100 points, with penalties deducted based on finding severities floored at zero.
flowchart LR
subgraph Severities ["Deduction Weights"]
C["π΄ Critical (-25)"]
H["π High (-15)"]
M["π‘ Medium (-8)"]
L["π΅ Low (-3)"]
I["βͺ Info (-1)"]
end
subgraph Formula ["Risk Calculation Engine"]
SUM["Total Penalty = Ξ£ (Findings Γ Weight)"]
CALC["Score = max(0, 100 - Total Penalty)"]
end
subgraph Categories ["Category Ratings"]
CAT1["CI/CD Security"]
CAT2["Secrets"]
CAT3["Artifacts"]
CAT4["Code Quality"]
CAT5["Dependencies"]
CAT6["Hygiene"]
end
C & H & M & L & I --> SUM --> CALC
CALC --> CAT1 & CAT2 & CAT3 & CAT4 & CAT5 & CAT6
# Clone the repository
git clone https://github.com/Tayab-Ahamed/Actionguard-Autoaudit.git
cd Actionguard-Autoaudit
# Create virtual environment & activate
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install ActionGuard in editable mode with development dependencies
pip install -e ".[dev]"
# Install optional external security tools for full coverage
pip install zizmor ruff bandit pip-audit
# Perform a complete repository security audit
actionguard audit . \
--html reports/actionguard-report.html \
--json reports/actionguard-report.json
# Run audit via python module syntax (alternative)
python -m actionguard.cli audit . --html report.html --json report.json
If you already have a generated JSON report and want to re-render the HTML report with styling adjustments:
actionguard report \
--json reports/actionguard-report.json \
--html reports/actionguard-report.html
usage: actionguard [-h] {audit,scan,report} ...
ActionGuard AutoAudit CLI - GitHub CI/CD & Agentic AI Security Engine
positional arguments:
{audit,scan,report}
audit Run full audit (rules + integrations) and generate reports
scan Alias for 'audit'
report Re-render HTML report from existing JSON report
options:
-h, --help show this help message and exit
| Option / Flag | Description | Default |
|---|---|---|
path |
Target repository directory to scan | . (current directory) |
--html PATH |
Output filepath for the self-contained HTML report | None (stdout summary only) |
--json PATH |
Output filepath for machine-readable JSON payload | None |
--email |
Enable SMTP email delivery of the HTML report | False |
--no-integrations |
Skip external tools (zizmor, Ruff, Bandit, etc.) |
False |
ActionGuard supports automated SMTP email dispatch of HTML executive summaries. Email delivery triggers only when all required SMTP environment variables are populated.
| Variable | Required | Default Value | Description |
|---|---|---|---|
MAIL_USERNAME |
β | None | Sender email address / SMTP username |
MAIL_PASSWORD |
β | None | SMTP password or App Password |
REPORT_TO_EMAIL |
β | None | Recipient email address |
MAIL_HOST |
β | smtp.gmail.com |
SMTP server hostname |
MAIL_PORT |
β | 465 |
SMTP port (SSL) |
βΉοΈ If SMTP environment variables are missing, email delivery is silently skipped without failing the audit.
Integrate ActionGuard into your GitHub repository using .github/workflows/actionguard-autoaudit.yml:
name: ActionGuard AutoAudit
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
audit:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout Codebase
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: pip
- name: Install ActionGuard & Scanners
run: |
pip install -e '.[dev]' zizmor
- name: Run Test Suite
run: pytest -q
- name: Execute Security Audit
env:
MAIL_USERNAME: ${{ secrets.MAIL_USERNAME }}
MAIL_PASSWORD: ${{ secrets.MAIL_PASSWORD }}
REPORT_TO_EMAIL: ${{ secrets.REPORT_TO_EMAIL }}
run: |
python -m actionguard.cli audit . \
--html reports/actionguard-report.html \
--json reports/actionguard-report.json \
--email
- name: Upload Security Reports
if: always()
uses: actions/upload-artifact@v4
with:
name: actionguard-audit-reports
path: |
reports/actionguard-report.html
reports/actionguard-report.json
retention-days: 7
Actionguard-Autoaudit/
βββ .github/
β βββ workflows/
β βββ actionguard-autoaudit.yml # Least-privilege CI workflow
βββ actionguard/
β βββ __init__.py
β βββ cli.py # CLI entrypoint (audit, scan, report)
β βββ config.py # Size limits, timeouts, skip patterns
β βββ email_sender.py # SMTP email delivery utility
β βββ models.py # Finding, Severity & AuditResult dataclasses
β βββ remediation.py # Prioritized remediation checklist builder
β βββ report.py # HTML & JSON report materialization
β βββ scanner.py # Core scanner & integration orchestrator
β βββ scoring.py # Severity-weighted risk scoring engine
β βββ rules/ # Custom security rule engine
β β βββ agentic.py # 5 Agentic AI security rules (AG-AI-*)
β β βββ artifacts.py # Artifact upload & retention checks (AG-ART-*)
β β βββ env_files.py # Committed env file & gitignore audits (AG-ENV-*)
β β βββ hygiene.py # Repository governance checks (AG-HYG-*)
β β βββ secrets.py # Regex secret scanner & redactor (AG-SEC-*)
β βββ integrations/ # External tool integration wrappers
β β βββ bandit.py # SAST for Python security
β β βββ common.py # Subprocess runner & status helpers
β β βββ npm_audit.py # JS dependency audit wrapper
β β βββ pip_audit.py # Python dependency vulnerability checker
β β βββ ruff.py # Fast Python linter wrapper
β β βββ zizmor.py # GitHub Actions workflow auditor
β βββ utils/ # Utility helpers
βββ examples/ # Vulnerable demo repository samples
βββ reports/ # Generated HTML & JSON security reports
βββ slides/ # ActionGuard presentation materials
βββ tests/ # Comprehensive Pytest test suite
β βββ test_agentic_rules.py
β βββ test_artifact_rules.py
β βββ test_env_rules.py
β βββ test_scoring.py
β βββ test_secret_redaction.py
βββ CODEOWNERS # Code ownership rules
βββ LICENSE # Standard MIT License
βββ NOTICE.md # Upstream zizmor attribution notice
βββ pyproject.toml # Package metadata & tool configurations
βββ README.md # Project documentation
βββ requirements.txt # Direct python dependencies
βββ SECURITY.md # Responsible disclosure policy
βββ VALIDATION.md # Verification & audit test results
- Secret Masking: Any matched credential or secret string is automatically truncated to its first 6 characters followed by
...redactedbefore being stored in findings or output reports. - File Exclusions: Scanners skip binary files, files larger than 1 MB, generated reports (
reports/), and standard dependency/build paths (.venv,node_modules,.git). - Safe Recommendations: Findings explicitly categorize suggested fixes into auto-fix-safe and manual-review-required changes.
Test ActionGuard against the bundled intentionally-vulnerable demonstration repository:
actionguard audit examples/demo-vulnerable-repo \
--html reports/demo-report.html \
--json reports/demo-report.json
Expected Vulnerabilities Detected:
- AI-generated script execution (
AG-AI-002) - Over-privileged workflow permissions (
AG-AI-004) - Untrusted comment triggers (
AG-AI-003) - Hardcoded secrets exposure (
AG-SEC-001) - Whole-repository artifact upload (
AG-ART-001) - Excessive retention window (
AG-ART-003)
ActionGuard AutoAudit leverages zizmor as its core GitHub Actions analysis engine. For full licensing details and attribution, refer to NOTICE.md.
Distributed under the MIT License. See LICENSE for complete terms.
For security vulnerability reports, please consult SECURITY.md.
ActionGuard AutoAudit β’ Empowering Secure GitHub Actions & Agentic AI Workflows