Security agent

From oyi77/1ai-skills · View interactive version

Security agent is an AI agent skill from the GitHub repository oyi77/1ai-skills. Use when bug bounty hunter and security auditor. Finds vulnerabilities before they find production.

How to use this skill

Skill file

Overview

This agent operates as a bug bounty hunter and security auditor, hunting for vulnerabilities in code you own or test. Use it before shipping anything exposed to untrusted input or user data. It produces evidence-backed findings with reproduction steps, not generic warnings.

Security Agent

Quick Reference — see parent for full agent ecosystem.

The Security Agent scans code changes, endpoints, and configurations for vulnerabilities before they reach production. It combines static analysis (Semgrep, CodeQL), secret scanning (Gitleaks, TruffleHog), dependency auditing, and dynamic probing to surface findings ranked by severity with evidence and fix recommendations. Its adversarial mindset assumes every input is malicious and every exposed endpoint is an attack surface.

When Not to Use

Dependencies

Commands

# Refer to the skill's usage section for specific commands
# Adapt these to your workflow

Key Responsibilities

Code Example

"""Minimal security agent pattern — scan a diff for vulnerabilities."""

import json, sys, re

def scan_diff(diff_text: str) -> dict:
    findings = []
    lines = diff_text.split("\n")

    patterns = {
        "P1": {
            "eval": r"\beval\s*\(",
            "exec": r"\bexec\s*\(",
            "raw_sql": r"\.execute\(.*['\"].*SELECT|INSERT|UPDATE|DELETE",
            "hardcoded_key": r"(?:sk-|pk-|AKIA|-----BEGIN (?:RSA |EC )?PRIVATE KEY-----)",
        },
        "P2": {
            "pickle_load": r"pickle\.loads?\(",
            "assert_true": r"assert True",
            "debug_endpoint": r"@app\.route\(.*['\"]/debug",
            "insecure_hash": r"hashlib\.md5|hashlib\.sha1",
        }
    }

    for severity, checks in patterns.items():
        for name, pattern in checks.items():
            for i, line in enumerate(lines):
                if line.startswith("+") and re.search(pattern, line):
                    findings.append({
                        "file": "changed_file", "line": i,
                        "severity": severity, "type": name,
                        "finding": f"Potential {name} detected",
                        "recommendation": "See OWASP cheat sheet for safe alternatives"
                    })

    return {
        "findings": findings,
        "summary": {
            "P1": len([f for f in findings if f["severity"] == "P1"]),
            "P2": len([f for f in findings if f["severity"] == "P2"]),
            "P3": len([f for f in findings if f["severity"] == "P3"])
        },
        "verdict": "blocked" if any(f["severity"] == "P1" for f in findings) else "needs_review" if findings else "clean"
    }

if __name__ == "__main__":
    diff = sys.stdin.read()
    result = scan_diff(diff)
    print(json.dumps(result, indent=2))

Checklist

Workflow

  1. Identify the task or trigger.
  2. Prepare inputs and configure parameters.
  3. Execute the core routine.
  4. Verify the output against expected results.
  5. Iterate based on feedback or new data.

Verification

Anti-Rationalization Table

| Rationalization | Reality |

|---|---|

| "It is an internal endpoint, no one can reach it" | Internal endpoints are one SSRF or compromised VPN away from public — protect everything |

| "We will add security later" | Security added after launch is exponentially more expensive and often ships incomplete |

| "The framework protects against XSS/SQLi by default" | ORMs and templating engines have escape hatches and edge cases — verify, do not assume |

When to Use

Use before every deployment to production, on any commit touching auth/payments/PII/external APIs, when adding new dependencies, and as a recurring audit of existing code. Do NOT use on third-party code you cannot modify, for real-time decisions requiring human judgment, or when the agent lacks access to the full application context (auth flows, data model) needed to assess impact accurately.

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.