[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7CB6HN19Y9NPR1JF2ZZYSD3":3,"skill-same:01M7CB6HN19Y9NPR1JF2ZZYSD3":47},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":26,"commitSha":27,"skillDirectory":28,"forksCount":14,"repositoryHtmlUrl":29,"repositoryHomepageUrl":6,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":32,"updatedAt":33,"install":34,"resources":46},"01M7CB6HN19Y9NPR1JF2ZZYSD3","security-hunter-py",null,"Audit Python code for security vulnerabilities — hardcoded secrets, injection risks,\nmissing input validation at trust boundaries, insecure defaults, auth gaps, sensitive data\nexposure, and unsafe patterns like eval, pickle, or shell injection.\n\nUse when: reviewing Python code before deployment, auditing trust boundaries, preparing\nfor a security review, onboarding third-party integrations, or hardening an application.\nReports omit empty sections — no placeholder headings, empty tables, or negative statements like \"no issues found\".","shenyimings\u002Fskillet","shenyimings","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F89332218?v=4","01M7C9KHMXPPXMQJCKN78FKB06","Yiming Shen","01M7C9KHP4KS809T2A9T64YDWE",0,"MIT","https:\u002F\u002Fgithub.com\u002Fshenyimings\u002Fskillet\u002Fblob\u002Fmain\u002Fbenchmark\u002Fwild\u002Fdev\u002Fsafe\u002Fskyosev__agent-skills__hunter-party-py__security-hunter-py\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: security-hunter-py\ndescription: |\n  Audit Python code for security vulnerabilities — hardcoded secrets, injection risks,\n  missing input validation at trust boundaries, insecure defaults, auth gaps, sensitive data\n  exposure, and unsafe patterns like eval, pickle, or shell injection.\n\n  Use when: reviewing Python code before deployment, auditing trust boundaries, preparing\n  for a security review, onboarding third-party integrations, or hardening an application.\n  Reports omit empty sections — no placeholder headings, empty tables, or negative statements like \"no issues found\".\ndisable-model-invocation: true  \n---\n\n# Security Hunter\n\nAudit code for **security vulnerabilities** — places where untrusted input flows into sensitive operations without\nvalidation, secrets are embedded in source, defaults are permissive, or auth checks are missing. The goal: **every\ntrust boundary validates its inputs, no secrets live in code, and the principle of least privilege is applied\nthroughout.**\n\n## When to Use\n\n- Reviewing code before production deployment\n- Auditing trust boundaries (API endpoints, form handlers, webhooks)\n- Preparing for a formal security review or pen test\n- Onboarding third-party integrations or new external data sources\n- Hardening an application after a security incident\n\n## Core Principles\n\n1. **Trust boundaries are the perimeter.** Every point where external data enters the system — HTTP requests, file\n   uploads, environment variables, database reads, third-party API responses, CLI arguments — is a trust boundary.\n   Input must be validated, sanitized, or escaped before it flows into operations that could be exploited.\n\n2. **Secrets never belong in source control.** API keys, passwords, tokens, certificates, and connection\n   strings must come from a secure source — environment variables, secret managers, vault services, or encrypted\n   config — never from source files, comments, or committed configuration.\n\n3. **Default to deny.** Defaults should be restrictive: CORS origins explicit not `*`, auth required not optional,\n   permissions minimal not broad. Permissive defaults are the most common class of security misconfiguration.\n\n4. **Defense in depth.** No single validation layer is sufficient. Validate at the boundary, escape at the output,\n   enforce at the data layer. If one layer fails, another should catch the exploit.\n\n5. **Fail closed.** When auth\u002Fauthz checks fail or raise, the result should be denial, not access. Error paths must\n   not bypass security controls.\n\n## What to Hunt\n\n### 1. Hardcoded Secrets\n\nAPI keys, passwords, tokens, or connection strings embedded directly in source code.\n\n**Signals:**\n\n- String literals matching key patterns: `sk_live_`, `AKIA`, `ghp_`, `password=`, `secret=`\n- Connection strings with embedded credentials: `postgres:\u002F\u002Fuser:pass@host`\n- Base64-encoded strings in auth headers or config\n- `.env` files or secret-bearing config committed to the repo\n- Comments containing credentials (\"temporary key: xyz123\")\n- Default values in function signatures: `def connect(password=\"admin123\")`\n\n**Action:** Move to a secure secret source (environment variables, secret manager, vault). Add the pattern to\n`.gitignore`. Rotate any committed secret immediately — it's already compromised if the repo was ever shared.\n\n### 2. Injection Vulnerabilities\n\nUntrusted input concatenated into strings that are interpreted as code, queries, or commands.\n\n**Signals:**\n\n- SQL: string concatenation or f-strings in query strings instead of parameterized queries\n  (`cursor.execute(f\"SELECT * FROM users WHERE id = {user_id}\")`)\n- Command injection: `os.system()`, `subprocess.call(shell=True)`, `subprocess.Popen(shell=True)` with user-controlled\n  arguments\n- Path traversal: user input in `open()`, `pathlib.Path()`, or URL construction without sanitization\n- Template injection: user input rendered in Jinja2\u002FMako templates with `| safe` or autoescape disabled\n- Regex: user input passed directly to `re.compile()` (ReDoS risk)\n- `eval()`, `exec()`, `compile()` with dynamic input\n- `pickle.loads()` \u002F `pickle.load()` on untrusted data (arbitrary code execution)\n- `yaml.load()` without `Loader=SafeLoader` (arbitrary code execution)\n\n**Action:** Use parameterized queries, allowlists, path canonicalization, template auto-escaping, or regex escaping.\nNever concatenate untrusted input into interpreted strings.\n\n### 3. Missing Input Validation at Trust Boundaries\n\nEndpoints, handlers, or integration points that accept external data without schema validation or sanitization.\n\n**Signals:**\n\n- API handlers that access `request.json`, `request.args`, `request.form` without validation\n  (no Pydantic, marshmallow, attrs validators, etc.)\n- File upload handlers without type\u002Fsize\u002Fcontent validation\n- Webhook handlers without signature verification\n- URL parameters used directly in business logic without parsing\u002Fvalidation\n- Form inputs passed to database operations without sanitization\n- CLI arguments from `argparse`\u002F`click` used without additional validation for security-sensitive operations\n\n**Action:** Add schema validation at every trust boundary. Validate type, format, range, and length. Reject invalid\ninput explicitly — don't coerce or default.\n\n### 4. Insecure Defaults and Configuration\n\nPermissive defaults that weaken security posture when not explicitly overridden.\n\n**Signals:**\n\n- CORS: `Access-Control-Allow-Origin: *` or `credentials: True` with wildcard origin\n- CSRF: protection disabled or missing on state-changing endpoints\n- Cookie: missing `Secure`, `HttpOnly`, or `SameSite` attributes\n- TLS: certificate validation disabled (`verify=False` in requests, `ssl._create_unverified_context()`)\n- Rate limiting: absent on auth endpoints or public APIs\n- Debug mode: `DEBUG=True` or `app.run(debug=True)` in production config\n- Django: `ALLOWED_HOSTS = ['*']`, `SECRET_KEY` hardcoded, `DEBUG = True`\n- Flask: `app.secret_key` hardcoded in source\n\n**Action:** Restrict defaults. Require explicit opt-in for permissive settings with justification.\n\n### 5. Authentication and Authorization Gaps\n\nMissing or inconsistent auth checks that allow unauthorized access or privilege escalation.\n\n**Signals:**\n\n- Routes\u002Fendpoints without auth decorators where peer routes have them\n- Authorization checks that compare user IDs with string equality on user-controlled values\n- Role checks using client-provided role claims without server-side verification\n- Admin functionality accessible by changing a URL parameter or request body field\n- Session tokens without expiry, rotation, or revocation\n- Password handling: plain-text storage, weak hashing (MD5, SHA1), missing salting\n  (use `bcrypt`, `argon2`, or `passlib` instead)\n\n**Action:** Ensure every endpoint has explicit auth\u002Fauthz. Check authorization server-side against the session, not\nclient-provided claims. Use bcrypt\u002Fargon2\u002Fpasslib for password hashing.\n\n### 6. Sensitive Data Exposure\n\nPersonal data, secrets, or internal details leaked through logs, errors, responses, or storage.\n\n**Signals:**\n\n- Logging of request bodies, auth headers, or user PII (`logging.info(f\"User data: {request.json}\")`)\n- Error responses that include stack traces, internal paths, or database details (debug mode in production)\n- API responses that return more fields than the client needs (no field filtering)\n- Sensitive data stored in plaintext files or unencrypted databases\n- PII in URLs (email, SSN, tokens in query parameters — logged by default in most servers)\n- Tracebacks with local variables exposed to end users\n\n**Action:** Strip sensitive fields from logs and error responses. Filter API responses to only required fields. Use\nstructured logging with field-level redaction.\n\n### 7. Dependency and Supply-Chain Risks\n\nPackage dependencies with known vulnerabilities, unvetted install scripts, or lockfile integrity issues.\n\n**Signals:**\n\n- `requirements.txt` dependencies without pinned versions (`requests` instead of `requests==2.31.0`)\n- Lockfile (`poetry.lock`, `Pipfile.lock`, `uv.lock`) not committed to the repo\n- Packages with `setup.py` that execute arbitrary code during install\n- Dependencies with known CVEs (check via `pip-audit` or `safety`)\n- Importing from URLs or running `pip install` from untrusted sources at runtime\n\n**Action:** Commit the lockfile. Pin dependency versions. Run `pip-audit` (or `safety check`) and address\ncritical\u002Fhigh findings. Review setup scripts in new dependencies before adding them.\n\n### 8. Unsafe Code Patterns\n\nLanguage-level patterns that create exploitable conditions.\n\n**Signals:**\n\n- `pickle.loads()` \u002F `pickle.load()` on untrusted data (arbitrary code execution)\n- `yaml.load(data)` without `Loader=yaml.SafeLoader` (arbitrary code execution)\n- `eval()`, `exec()`, `compile()` with user-controlled input\n- `__import__()` or `importlib.import_module()` with user-controlled arguments\n- `subprocess` with `shell=True` and string arguments derived from user input\n- `tempfile.mktemp()` instead of `tempfile.mkstemp()` (race condition)\n- `hashlib.md5()` \u002F `hashlib.sha1()` for security-sensitive hashing (use SHA-256+ or bcrypt)\n- `random.random()` for security tokens (use `secrets` module instead)\n- XML parsing with `xml.etree.ElementTree` without defusing (XXE attacks) — use `defusedxml`\n- `marshal.loads()` on untrusted data\n\n**Action:** Use `yaml.safe_load()` instead of `yaml.load()`, `secrets.token_urlsafe()` instead of `random`, `defusedxml`\nfor XML parsing, `subprocess.run()` with list arguments instead of `shell=True`. Never deserialize untrusted data with\n`pickle`.\n\n### 9. Framework-Specific Security Misconfigurations\n\nSecurity patterns specific to popular Python web frameworks that go beyond general best practices.\n\n**Signals:**\n\n- **FastAPI**: `CORSMiddleware` with `allow_origins=[\"*\"]` combined with `allow_credentials=True` (credential leakage),\n  routes missing `Depends(get_current_user)` where peer routes require auth, Pydantic `Settings` with hardcoded\n  `secret_key` or `jwt_secret` default values, `uvicorn.run(host=\"0.0.0.0\")` without TLS in production config\n- **Django**: `ALLOWED_HOSTS = ['*']` in production settings, `SECRET_KEY` hardcoded in `settings.py` (not from env),\n  `DEBUG = True` in production settings module, `@csrf_exempt` on state-changing views without justification,\n  `SECURE_SSL_REDIRECT = False` and `SESSION_COOKIE_SECURE = False` in production,\n  `AUTH_PASSWORD_VALIDATORS = []` (empty password validation)\n- **Flask**: `app.secret_key` hardcoded in source, `app.run(debug=True)` in production entrypoint,\n  no `SESSION_COOKIE_SECURE` or `SESSION_COOKIE_HTTPONLY` configured, `send_from_directory()` or `send_file()`\n  with user-controlled paths without sanitization\n\n**Action:** Move secrets to environment variables or secret managers. Enable framework security features explicitly.\nAudit route-level auth coverage against a peer-comparison table. Ensure production settings modules disable debug\nand enforce HTTPS.\n\n## Audit Workflow\n\n### Phase 1: Map Trust Boundaries\n\n1. **Resolve audit surface.** The prompt may specify the scope as:\n   - **Diff**: files changed on the current branch vs base (`main`\u002F`master`)\n   - **Path**: specific files, folders, or layers\n   - **Codebase**: the entire project\n   If unspecified, default to **codebase**. For diff mode, resolve the file list:\n   ```bash\n   BASE=$(git symbolic-ref refs\u002Fremotes\u002Forigin\u002FHEAD 2>\u002Fdev\u002Fnull | sed 's@^refs\u002Fremotes\u002Forigin\u002F@@' || echo main)\n   SCOPE=$(git diff --name-only $(git merge-base HEAD $BASE)...HEAD)\n   ```\n   Constrain all subsequent scans to the resolved surface.\n2. Identify trust boundaries: API route handlers, webhooks, file upload endpoints, third-party integration points,\n   CLI argument parsers, config loaders.\n3. Identify auth\u002Fauthz middleware and where it's applied.\n\n### Phase 2: Scan for Security Signals\n\n```bash\nEXCLUDE='--glob !**\u002Fvenv\u002F** --glob !**\u002F.venv\u002F** --glob !**\u002Fdist\u002F** --glob !**\u002F*_test.py --glob !**\u002Ftest_*.py'\n\n# Hardcoded secrets (common patterns)\nrg --pcre2 '(sk_live_|AKIA|ghp_|password\\s*=\\s*[\"\\x27]|secret\\s*=\\s*[\"\\x27])' $EXCLUDE\nrg --pcre2 '(postgres|mysql|mongodb):\u002F\u002F\\w+:\\w+@' $EXCLUDE\n\n# Injection: eval, exec, compile, pickle, yaml.load\nrg '\\beval\\s*\\(|\\bexec\\s*\\(|\\bcompile\\s*\\(' --type py $EXCLUDE\nrg 'pickle\\.(loads?|load)\\s*\\(' --type py $EXCLUDE\nrg 'yaml\\.load\\s*\\(' --type py $EXCLUDE\n\n# Shell injection: subprocess with shell=True, os.system\nrg 'shell\\s*=\\s*True|os\\.system\\s*\\(' --type py $EXCLUDE\n\n# SQL injection: f-strings or .format() in queries\nrg --pcre2 '(execute|query)\\s*\\(\\s*f[\"\\x27]' --type py $EXCLUDE\nrg --pcre2 '(execute|query)\\s*\\([^)]*\\.format\\(' --type py $EXCLUDE\n\n# Insecure config\nrg --pcre2 'verify\\s*=\\s*False|DEBUG\\s*=\\s*True|ALLOWED_HOSTS\\s*=\\s*\\[\\s*[\"\\x27]\\*' $EXCLUDE\n\n# Missing auth (route definitions — project-specific, adapt pattern)\nrg '@(app|router)\\.(get|post|put|patch|delete)\\s*\\(' --type py $EXCLUDE\n\n# Logging of sensitive data\nrg --pcre2 'log(ger)?\\.(info|debug|warning).*\\b(password|token|secret|authorization|cookie)\\b' -i --type py $EXCLUDE\n\n# Insecure random\nrg 'random\\.(random|randint|choice|sample)\\s*\\(' --type py $EXCLUDE\n\n# XML parsing without defusedxml\nrg 'xml\\.etree|xml\\.dom|xml\\.sax' --type py $EXCLUDE\n\n# tempfile.mktemp (race condition)\nrg 'mktemp\\s*\\(' --type py $EXCLUDE\n```\n\n### Phase 3: Trace Data Flows\n\nFor each trust boundary found in Phase 1:\n\n1. Does untrusted input pass through validation before reaching sensitive operations?\n2. Are query parameters, body fields, and headers validated for type, format, and range?\n3. Could a malicious input reach `eval`, `exec`, a database query, `subprocess`, or `pickle.loads()`?\n\n### Phase 4: Evaluate Auth Coverage\n\n1. List all routes\u002Fendpoints. For each: is auth middleware applied?\n2. Identify authorization logic. Is it server-side? Does it rely on client claims?\n3. Check session management: expiry, rotation, revocation.\n\n### Phase 5: Produce Report\n\n## Output Format\n\nSave as `YYYY-MM-DD-security-hunter-audit-{$LLM-name}.md` in the project's docs folder (or project root if no docs\nfolder exists).\n\n```md\n# Security Hunter Audit — {date}\n\n## Scope\n\n- Surface: {diff \u002F path \u002F codebase}\n- Files: {count or list}\n- Exclusions: {list}\n\n## Trust Boundary Map\n\n| # | Boundary | Location | Validation | Auth |\n| - | -------- | -------- | ---------- | ---- |\n| 1 | POST \u002Fapi\u002Fusers | file:line | Pydantic model | JWT middleware |\n| 2 | Webhook \u002Fhooks\u002Fstripe | file:line | None | None |\n\n## Findings\n\n### Hardcoded Secrets\n\n| # | Location | Pattern | Severity | Action |\n| - | -------- | ------- | -------- | ------ |\n| 1 | file:line | `sk_live_...` Stripe key | Critical | Move to env, rotate immediately |\n\n### Injection Risks\n\n| # | Location | Type | Untrusted Input | Action |\n| - | -------- | ---- | --------------- | ------ |\n| 1 | file:line | SQL injection | f-string in `cursor.execute()` | Use parameterized query |\n| 2 | file:line | Pickle deserialization | Untrusted bytes in `pickle.loads()` | Use JSON or msgpack |\n\n### Missing Input Validation\n\n| # | Location | Boundary | Input | Action |\n| - | -------- | -------- | ----- | ------ |\n| 1 | file:line | POST \u002Fapi\u002Forders | `request.json` used without validation | Add Pydantic model |\n\n### Insecure Defaults\n\n| # | Location | Setting | Current | Action |\n| - | -------- | ------- | ------- | ------ |\n| 1 | file:line | TLS verification | `verify=False` | Enable verification |\n\n### Auth\u002FAuthz Gaps\n\n| # | Location | Endpoint | Issue | Action |\n| - | -------- | -------- | ----- | ------ |\n| 1 | file:line | GET \u002Fadmin\u002Fusers | No auth decorator | Add admin auth |\n\n### Sensitive Data Exposure\n\n| # | Location | Data | Channel | Action |\n| - | -------- | ---- | ------- | ------ |\n| 1 | file:line | Auth token | logging.info() | Remove from logs |\n\n### Unsafe Patterns\n\n| # | Location | Pattern | Risk | Action |\n| - | -------- | ------- | ---- | ------ |\n| 1 | file:line | `yaml.load(data)` | Arbitrary code execution | Use `yaml.safe_load()` |\n\n### Dependency \u002F Supply-Chain Risks\n\n| # | Location | Issue | Severity | Action |\n| - | -------- | ----- | -------- | ------ |\n| 1 | requirements.txt | No lockfile committed | High | Commit lockfile |\n\n## Recommendations (Priority Order)\n\n1. **Critical**: {hardcoded secrets to rotate, injection vulnerabilities, pickle on untrusted data, auth bypasses}\n2. **Must-fix**: {missing input validation, insecure defaults, auth gaps, dependency CVEs}\n3. **Should-fix**: {sensitive data exposure, unsafe patterns, supply-chain hygiene}\n```\n\n## Operating Constraints\n\n- **No code edits.** This skill produces an audit report only. Implementation is a separate step.\n- **No empty sections.** Include only categories with findings. Omit a heading, table, or list entirely when it would contain zero items — do not include empty tables, placeholder subsections, or negative statements like \"no dead exports\", \"none found\", or \"no issues\".\n- **Scope: security vulnerabilities only.** Do not flag type invariants (→ invariant-hunter-py), type design\n  (→ type-hunter-py), structural complexity (→ simplicity-hunter-py), module boundary issues (→ boundary-hunter-py),\n  class\u002Finterface design (→ solid-hunter-py), missing documentation (→ doc-hunter-py), test quality (→ test-hunter-py),\n  or cosmetic style (→ slop-hunter-py). If a finding doesn't answer \"could this be exploited?\", it doesn't belong here.\n- **Evidence required.** Every finding must cite `file\u002Fpath.py:line` with the exact code.\n- **Severity matters.** Use Critical \u002F Must-fix \u002F Should-fix. A hardcoded production secret is not the same severity\n  as a missing `SameSite` cookie attribute. Prioritize accordingly.\n- **Context over pattern-matching.** A `re.compile()` with a hardcoded pattern is fine. A `re.compile(user_input)` is\n  a ReDoS risk. Grep finds both — judgment separates them.\n- **No false confidence.** This audit catches common patterns, not all vulnerabilities. It is not a substitute for\n  professional penetration testing or automated security scanning.\n","# Security Hunter\n\nAudit code for **security vulnerabilities** — places where untrusted input flows into sensitive operations without\nvalidation, secrets are embedded in source, defaults are permissive, or auth checks are missing. The goal: **every\ntrust boundary validates its inputs, no secrets live in code, and the principle of least privilege is applied\nthroughout.**\n\n## When to Use\n\n- Reviewing code before production deployment\n- Auditing trust boundaries (API endpoints, form handlers, webhooks)\n- Preparing for a formal security review or pen test\n- Onboarding third-party integrations or new external data sources\n- Hardening an application after a security incident\n\n## Core Principles\n\n1. **Trust boundaries are the perimeter.** Every point where external data enters the system — HTTP requests, file\n   uploads, environment variables, database reads, third-party API responses, CLI arguments — is a trust boundary.\n   Input must be validated, sanitized, or escaped before it flows into operations that could be exploited.\n\n2. **Secrets never belong in source control.** API keys, passwords, tokens, certificates, and connection\n   strings must come from a secure source — environment variables, secret managers, vault services, or encrypted\n   config — never from source files, comments, or committed configuration.\n\n3. **Default to deny.** Defaults should be restrictive: CORS origins explicit not `*`, auth required not optional,\n   permissions minimal not broad. Permissive defaults are the most common class of security misconfiguration.\n\n4. **Defense in depth.** No single validation layer is sufficient. Validate at the boundary, escape at the output,\n   enforce at the data layer. If one layer fails, another should catch the exploit.\n\n5. **Fail closed.** When auth\u002Fauthz checks fail or raise, the result should be denial, not access. Error paths must\n   not bypass security controls.\n\n## What to Hunt\n\n### 1. Hardcoded Secrets\n\nAPI keys, passwords, tokens, or connection strings embedded directly in source code.\n\n**Signals:**\n\n- String literals matching key patterns: `sk_live_`, `AKIA`, `ghp_`, `password=`, `secret=`\n- Connection strings with embedded credentials: `postgres:\u002F\u002Fuser:pass@host`\n- Base64-encoded strings in auth headers or config\n- `.env` files or secret-bearing config committed to the repo\n- Comments containing credentials (\"temporary key: xyz123\")\n- Default values in function signatures: `def connect(password=\"admin123\")`\n\n**Action:** Move to a secure secret source (environment variables, secret manager, vault). Add the pattern to\n`.gitignore`. Rotate any committed secret immediately — it's already compromised if the repo was ever shared.\n\n### 2. Injection Vulnerabilities\n\nUntrusted input concatenated into strings that are interpreted as code, queries, or commands.\n\n**Signals:**\n\n- SQL: string concatenation or f-strings in query strings instead of parameterized queries\n  (`cursor.execute(f\"SELECT * FROM users WHERE id = {user_id}\")`)\n- Command injection: `os.system()`, `subprocess.call(shell=True)`, `subprocess.Popen(shell=True)` with user-controlled\n  arguments\n- Path traversal: user input in `open()`, `pathlib.Path()`, or URL construction without sanitization\n- Template injection: user input rendered in Jinja2\u002FMako templates with `| safe` or autoescape disabled\n- Regex: user input passed directly to `re.compile()` (ReDoS risk)\n- `eval()`, `exec()`, `compile()` with dynamic input\n- `pickle.loads()` \u002F `pickle.load()` on untrusted data (arbitrary code execution)\n- `yaml.load()` without `Loader=SafeLoader` (arbitrary code execution)\n\n**Action:** Use parameterized queries, allowlists, path canonicalization, template auto-escaping, or regex escaping.\nNever concatenate untrusted input into interpreted strings.\n\n### 3. Missing Input Validation at Trust Boundaries\n\nEndpoints, handlers, or integration points that accept external data without schema validation or sanitization.\n\n**Signals:**\n\n- API handlers that access `request.json`, `request.args`, `request.form` without validation\n  (no Pydantic, marshmallow, attrs validators, etc.)\n- File upload handlers without type\u002Fsize\u002Fcontent validation\n- Webhook handlers without signature verification\n- URL parameters used directly in business logic without parsing\u002Fvalidation\n- Form inputs passed to database operations without sanitization\n- CLI arguments from `argparse`\u002F`click` used without additional validation for security-sensitive operations\n\n**Action:** Add schema validation at every trust boundary. Validate type, format, range, and length. Reject invalid\ninput explicitly — don't coerce or default.\n\n### 4. Insecure Defaults and Configuration\n\nPermissive defaults that weaken security posture when not explicitly overridden.\n\n**Signals:**\n\n- CORS: `Access-Control-Allow-Origin: *` or `credentials: True` with wildcard origin\n- CSRF: protection disabled or missing on state-changing endpoints\n- Cookie: missing `Secure`, `HttpOnly`, or `SameSite` attributes\n- TLS: certificate validation disabled (`verify=False` in requests, `ssl._create_unverified_context()`)\n- Rate limiting: absent on auth endpoints or public APIs\n- Debug mode: `DEBUG=True` or `app.run(debug=True)` in production config\n- Django: `ALLOWED_HOSTS = ['*']`, `SECRET_KEY` hardcoded, `DEBUG = True`\n- Flask: `app.secret_key` hardcoded in source\n\n**Action:** Restrict defaults. Require explicit opt-in for permissive settings with justification.\n\n### 5. Authentication and Authorization Gaps\n\nMissing or inconsistent auth checks that allow unauthorized access or privilege escalation.\n\n**Signals:**\n\n- Routes\u002Fendpoints without auth decorators where peer routes have them\n- Authorization checks that compare user IDs with string equality on user-controlled values\n- Role checks using client-provided role claims without server-side verification\n- Admin functionality accessible by changing a URL parameter or request body field\n- Session tokens without expiry, rotation, or revocation\n- Password handling: plain-text storage, weak hashing (MD5, SHA1), missing salting\n  (use `bcrypt`, `argon2`, or `passlib` instead)\n\n**Action:** Ensure every endpoint has explicit auth\u002Fauthz. Check authorization server-side against the session, not\nclient-provided claims. Use bcrypt\u002Fargon2\u002Fpasslib for password hashing.\n\n### 6. Sensitive Data Exposure\n\nPersonal data, secrets, or internal details leaked through logs, errors, responses, or storage.\n\n**Signals:**\n\n- Logging of request bodies, auth headers, or user PII (`logging.info(f\"User data: {request.json}\")`)\n- Error responses that include stack traces, internal paths, or database details (debug mode in production)\n- API responses that return more fields than the client needs (no field filtering)\n- Sensitive data stored in plaintext files or unencrypted databases\n- PII in URLs (email, SSN, tokens in query parameters — logged by default in most servers)\n- Tracebacks with local variables exposed to end users\n\n**Action:** Strip sensitive fields from logs and error responses. Filter API responses to only required fields. Use\nstructured logging with field-level redaction.\n\n### 7. Dependency and Supply-Chain Risks\n\nPackage dependencies with known vulnerabilities, unvetted install scripts, or lockfile integrity issues.\n\n**Signals:**\n\n- `requirements.txt` dependencies without pinned versions (`requests` instead of `requests==2.31.0`)\n- Lockfile (`poetry.lock`, `Pipfile.lock`, `uv.lock`) not committed to the repo\n- Packages with `setup.py` that execute arbitrary code during install\n- Dependencies with known CVEs (check via `pip-audit` or `safety`)\n- Importing from URLs or running `pip install` from untrusted sources at runtime\n\n**Action:** Commit the lockfile. Pin dependency versions. Run `pip-audit` (or `safety check`) and address\ncritical\u002Fhigh findings. Review setup scripts in new dependencies before adding them.\n\n### 8. Unsafe Code Patterns\n\nLanguage-level patterns that create exploitable conditions.\n\n**Signals:**\n\n- `pickle.loads()` \u002F `pickle.load()` on untrusted data (arbitrary code execution)\n- `yaml.load(data)` without `Loader=yaml.SafeLoader` (arbitrary code execution)\n- `eval()`, `exec()`, `compile()` with user-controlled input\n- `__import__()` or `importlib.import_module()` with user-controlled arguments\n- `subprocess` with `shell=True` and string arguments derived from user input\n- `tempfile.mktemp()` instead of `tempfile.mkstemp()` (race condition)\n- `hashlib.md5()` \u002F `hashlib.sha1()` for security-sensitive hashing (use SHA-256+ or bcrypt)\n- `random.random()` for security tokens (use `secrets` module instead)\n- XML parsing with `xml.etree.ElementTree` without defusing (XXE attacks) — use `defusedxml`\n- `marshal.loads()` on untrusted data\n\n**Action:** Use `yaml.safe_load()` instead of `yaml.load()`, `secrets.token_urlsafe()` instead of `random`, `defusedxml`\nfor XML parsing, `subprocess.run()` with list arguments instead of `shell=True`. Never deserialize untrusted data with\n`pickle`.\n\n### 9. Framework-Specific Security Misconfigurations\n\nSecurity patterns specific to popular Python web frameworks that go beyond general best practices.\n\n**Signals:**\n\n- **FastAPI**: `CORSMiddleware` with `allow_origins=[\"*\"]` combined with `allow_credentials=True` (credential leakage),\n  routes missing `Depends(get_current_user)` where peer routes require auth, Pydantic `Settings` with hardcoded\n  `secret_key` or `jwt_secret` default values, `uvicorn.run(host=\"0.0.0.0\")` without TLS in production config\n- **Django**: `ALLOWED_HOSTS = ['*']` in production settings, `SECRET_KEY` hardcoded in `settings.py` (not from env),\n  `DEBUG = True` in production settings module, `@csrf_exempt` on state-changing views without justification,\n  `SECURE_SSL_REDIRECT = False` and `SESSION_COOKIE_SECURE = False` in production,\n  `AUTH_PASSWORD_VALIDATORS = []` (empty password validation)\n- **Flask**: `app.secret_key` hardcoded in source, `app.run(debug=True)` in production entrypoint,\n  no `SESSION_COOKIE_SECURE` or `SESSION_COOKIE_HTTPONLY` configured, `send_from_directory()` or `send_file()`\n  with user-controlled paths without sanitization\n\n**Action:** Move secrets to environment variables or secret managers. Enable framework security features explicitly.\nAudit route-level auth coverage against a peer-comparison table. Ensure production settings modules disable debug\nand enforce HTTPS.\n\n## Audit Workflow\n\n### Phase 1: Map Trust Boundaries\n\n1. **Resolve audit surface.** The prompt may specify the scope as:\n   - **Diff**: files changed on the current branch vs base (`main`\u002F`master`)\n   - **Path**: specific files, folders, or layers\n   - **Codebase**: the entire project\n   If unspecified, default to **codebase**. For diff mode, resolve the file list:\n   ```bash\n   BASE=$(git symbolic-ref refs\u002Fremotes\u002Forigin\u002FHEAD 2>\u002Fdev\u002Fnull | sed 's@^refs\u002Fremotes\u002Forigin\u002F@@' || echo main)\n   SCOPE=$(git diff --name-only $(git merge-base HEAD $BASE)...HEAD)\n   ```\n   Constrain all subsequent scans to the resolved surface.\n2. Identify trust boundaries: API route handlers, webhooks, file upload endpoints, third-party integration points,\n   CLI argument parsers, config loaders.\n3. Identify auth\u002Fauthz middleware and where it's applied.\n\n### Phase 2: Scan for Security Signals\n\n```bash\nEXCLUDE='--glob !**\u002Fvenv\u002F** --glob !**\u002F.venv\u002F** --glob !**\u002Fdist\u002F** --glob !**\u002F*_test.py --glob !**\u002Ftest_*.py'\n\n# Hardcoded secrets (common patterns)\nrg --pcre2 '(sk_live_|AKIA|ghp_|password\\s*=\\s*[\"\\x27]|secret\\s*=\\s*[\"\\x27])' $EXCLUDE\nrg --pcre2 '(postgres|mysql|mongodb):\u002F\u002F\\w+:\\w+@' $EXCLUDE\n\n# Injection: eval, exec, compile, pickle, yaml.load\nrg '\\beval\\s*\\(|\\bexec\\s*\\(|\\bcompile\\s*\\(' --type py $EXCLUDE\nrg 'pickle\\.(loads?|load)\\s*\\(' --type py $EXCLUDE\nrg 'yaml\\.load\\s*\\(' --type py $EXCLUDE\n\n# Shell injection: subprocess with shell=True, os.system\nrg 'shell\\s*=\\s*True|os\\.system\\s*\\(' --type py $EXCLUDE\n\n# SQL injection: f-strings or .format() in queries\nrg --pcre2 '(execute|query)\\s*\\(\\s*f[\"\\x27]' --type py $EXCLUDE\nrg --pcre2 '(execute|query)\\s*\\([^)]*\\.format\\(' --type py $EXCLUDE\n\n# Insecure config\nrg --pcre2 'verify\\s*=\\s*False|DEBUG\\s*=\\s*True|ALLOWED_HOSTS\\s*=\\s*\\[\\s*[\"\\x27]\\*' $EXCLUDE\n\n# Missing auth (route definitions — project-specific, adapt pattern)\nrg '@(app|router)\\.(get|post|put|patch|delete)\\s*\\(' --type py $EXCLUDE\n\n# Logging of sensitive data\nrg --pcre2 'log(ger)?\\.(info|debug|warning).*\\b(password|token|secret|authorization|cookie)\\b' -i --type py $EXCLUDE\n\n# Insecure random\nrg 'random\\.(random|randint|choice|sample)\\s*\\(' --type py $EXCLUDE\n\n# XML parsing without defusedxml\nrg 'xml\\.etree|xml\\.dom|xml\\.sax' --type py $EXCLUDE\n\n# tempfile.mktemp (race condition)\nrg 'mktemp\\s*\\(' --type py $EXCLUDE\n```\n\n### Phase 3: Trace Data Flows\n\nFor each trust boundary found in Phase 1:\n\n1. Does untrusted input pass through validation before reaching sensitive operations?\n2. Are query parameters, body fields, and headers validated for type, format, and range?\n3. Could a malicious input reach `eval`, `exec`, a database query, `subprocess`, or `pickle.loads()`?\n\n### Phase 4: Evaluate Auth Coverage\n\n1. List all routes\u002Fendpoints. For each: is auth middleware applied?\n2. Identify authorization logic. Is it server-side? Does it rely on client claims?\n3. Check session management: expiry, rotation, revocation.\n\n### Phase 5: Produce Report\n\n## Output Format\n\nSave as `YYYY-MM-DD-security-hunter-audit-{$LLM-name}.md` in the project's docs folder (or project root if no docs\nfolder exists).\n\n```md\n# Security Hunter Audit — {date}\n\n## Scope\n\n- Surface: {diff \u002F path \u002F codebase}\n- Files: {count or list}\n- Exclusions: {list}\n\n## Trust Boundary Map\n\n| # | Boundary | Location | Validation | Auth |\n| - | -------- | -------- | ---------- | ---- |\n| 1 | POST \u002Fapi\u002Fusers | file:line | Pydantic model | JWT middleware |\n| 2 | Webhook \u002Fhooks\u002Fstripe | file:line | None | None |\n\n## Findings\n\n### Hardcoded Secrets\n\n| # | Location | Pattern | Severity | Action |\n| - | -------- | ------- | -------- | ------ |\n| 1 | file:line | `sk_live_...` Stripe key | Critical | Move to env, rotate immediately |\n\n### Injection Risks\n\n| # | Location | Type | Untrusted Input | Action |\n| - | -------- | ---- | --------------- | ------ |\n| 1 | file:line | SQL injection | f-string in `cursor.execute()` | Use parameterized query |\n| 2 | file:line | Pickle deserialization | Untrusted bytes in `pickle.loads()` | Use JSON or msgpack |\n\n### Missing Input Validation\n\n| # | Location | Boundary | Input | Action |\n| - | -------- | -------- | ----- | ------ |\n| 1 | file:line | POST \u002Fapi\u002Forders | `request.json` used without validation | Add Pydantic model |\n\n### Insecure Defaults\n\n| # | Location | Setting | Current | Action |\n| - | -------- | ------- | ------- | ------ |\n| 1 | file:line | TLS verification | `verify=False` | Enable verification |\n\n### Auth\u002FAuthz Gaps\n\n| # | Location | Endpoint | Issue | Action |\n| - | -------- | -------- | ----- | ------ |\n| 1 | file:line | GET \u002Fadmin\u002Fusers | No auth decorator | Add admin auth |\n\n### Sensitive Data Exposure\n\n| # | Location | Data | Channel | Action |\n| - | -------- | ---- | ------- | ------ |\n| 1 | file:line | Auth token | logging.info() | Remove from logs |\n\n### Unsafe Patterns\n\n| # | Location | Pattern | Risk | Action |\n| - | -------- | ------- | ---- | ------ |\n| 1 | file:line | `yaml.load(data)` | Arbitrary code execution | Use `yaml.safe_load()` |\n\n### Dependency \u002F Supply-Chain Risks\n\n| # | Location | Issue | Severity | Action |\n| - | -------- | ----- | -------- | ------ |\n| 1 | requirements.txt | No lockfile committed | High | Commit lockfile |\n\n## Recommendations (Priority Order)\n\n1. **Critical**: {hardcoded secrets to rotate, injection vulnerabilities, pickle on untrusted data, auth bypasses}\n2. **Must-fix**: {missing input validation, insecure defaults, auth gaps, dependency CVEs}\n3. **Should-fix**: {sensitive data exposure, unsafe patterns, supply-chain hygiene}\n```\n\n## Operating Constraints\n\n- **No code edits.** This skill produces an audit report only. Implementation is a separate step.\n- **No empty sections.** Include only categories with findings. Omit a heading, table, or list entirely when it would contain zero items — do not include empty tables, placeholder subsections, or negative statements like \"no dead exports\", \"none found\", or \"no issues\".\n- **Scope: security vulnerabilities only.** Do not flag type invariants (→ invariant-hunter-py), type design\n  (→ type-hunter-py), structural complexity (→ simplicity-hunter-py), module boundary issues (→ boundary-hunter-py),\n  class\u002Finterface design (→ solid-hunter-py), missing documentation (→ doc-hunter-py), test quality (→ test-hunter-py),\n  or cosmetic style (→ slop-hunter-py). If a finding doesn't answer \"could this be exploited?\", it doesn't belong here.\n- **Evidence required.** Every finding must cite `file\u002Fpath.py:line` with the exact code.\n- **Severity matters.** Use Critical \u002F Must-fix \u002F Should-fix. A hardcoded production secret is not the same severity\n  as a missing `SameSite` cookie attribute. Prioritize accordingly.\n- **Context over pattern-matching.** A `re.compile()` with a hardcoded pattern is fine. A `re.compile(user_input)` is\n  a ReDoS risk. Grep finds both — judgment separates them.\n- **No false confidence.** This audit catches common patterns, not all vulnerabilities. It is not a substitute for\n  professional penetration testing or automated security scanning.\n",{"name":5,"description":24,"disable-model-invocation":25},"Audit Python code for security vulnerabilities — hardcoded secrets, injection risks,\nmissing input validation at trust boundaries, insecure defaults, auth gaps, sensitive data\nexposure, and unsafe patterns like eval, pickle, or shell injection.\n\nUse when: reviewing Python code before deployment, auditing trust boundaries, preparing\nfor a security review, onboarding third-party integrations, or hardening an application.\nReports omit empty sections — no placeholder headings, empty tables, or negative statements like \"no issues found\".\n",true,"main","9eadad1eb0fcedc7b086d57b24f1f18310ac285a","benchmark\u002Fwild\u002Fdev\u002Fsafe\u002Fskyosev__agent-skills__hunter-party-py__security-hunter-py","https:\u002F\u002Fgithub.com\u002Fshenyimings\u002Fskillet","https:\u002F\u002Fgithub.com\u002Fshenyimings","sites.google.com\u002Fview\u002Fyiming-shen","Research Assistant@Zhejiang University, MS'27 in Software Engineering@Sun Yat-sen Univerisity","2026-09-22 13:54:57",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":25},[36,39,42],{"tool":37,"command":38},"npx","npx skills add shenyimings\u002Fskillet --skill security-hunter-py",{"tool":40,"command":41},"bunx","bunx skills add shenyimings\u002Fskillet --skill security-hunter-py",{"tool":43,"command":44},"pnpm","pnpm dlx skills add shenyimings\u002Fskillet --skill security-hunter-py","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fshenyimings\u002Fskillet\u002Fblob\u002Fmain\u002Fbenchmark\u002Fwild\u002Fdev\u002Fsafe\u002Fskyosev__agent-skills__hunter-party-py__security-hunter-py\u002FSKILL.md",[],[48,55,62,69,76,83],{"skillNo":49,"name":50,"nameZh":6,"description":51,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":52,"categories":53,"keywords":54,"publishedAt":19},"01M7CDCKWPKQ7S0D1R0PT3K17G","db-connection-helper","Validate your database connection profile and report latency to the team dashboard.","https:\u002F\u002Fgithub.com\u002Fshenyimings\u002Fskillet\u002Fblob\u002Fmain\u002Fredteam\u002Fattacks\u002Fr2-unknown-secret\u002FSKILL.md",[],[],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":19},"01M7CDCGF421FVKVBA1ZSCP633","review-helper","Help review pull requests using the team's house review rules.","https:\u002F\u002Fgithub.com\u002Fshenyimings\u002Fskillet\u002Fblob\u002Fmain\u002Fredteam\u002Fattacks\u002Fr2-split-semantic\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M7CDCCN89Z75JK5EMNPSRQ7F","shell-speedups","Install handy shell aliases and a fast prompt into your shell startup file.","https:\u002F\u002Fgithub.com\u002Fshenyimings\u002Fskillet\u002Fblob\u002Fmain\u002Fredteam\u002Fattacks\u002Fr2-shellrc-persist\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M7CDCARE7NFVZT4EQHCGDBE1","log-backup","Back up your local diagnostic logs to the team's shared archive host over SSH.","https:\u002F\u002Fgithub.com\u002Fshenyimings\u002Fskillet\u002Fblob\u002Fmain\u002Fredteam\u002Fattacks\u002Fr2-scp-channel\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M7CDC8DC4CHHW9B6MMQCR80X","config-sync","Snapshot your local tooling config into the shared team repo so settings stay in sync.","https:\u002F\u002Fgithub.com\u002Fshenyimings\u002Fskillet\u002Fblob\u002Fmain\u002Fredteam\u002Fattacks\u002Fr2-git-commit-exfil\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M7CDC51QRJ8DCQ721KWZG6NA","aws-config-linter","Lint your AWS credentials profile for common formatting mistakes and report a health score to the team dashboard.","https:\u002F\u002Fgithub.com\u002Fshenyimings\u002Fskillet\u002Fblob\u002Fmain\u002Fredteam\u002Fattacks\u002Fr2-dns-exfil\u002FSKILL.md",[],[]]