Skip to content
Back to search

zero-lab

MarketplaceWorks with Claude CodeGitHub

Portable, evidence-bound security skills for authorized defensive assessment, red teaming, penetration testing, detection engineering, and engagement operations.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/zero-lab-ai--skills/badge.svg)](/listings/zero-lab-ai--skills)

HTML

<a href="/listings/zero-lab-ai--skills"><img src="/api/listings/zero-lab-ai--skills/badge.svg" alt="findsafeskills safety rating" /></a>

Install

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

Claude Code

/plugin marketplace add zero-lab-ai/skills
/plugin menu

Select the bundle you need from the marketplace menu.

Codex

Codex reads the same marketplace metadata directly:

codex plugin marketplace add zero-lab-ai/skills
codex plugin list
codex plugin add <bundle-name>@zero-lab

ChatGPT Workspace Marketplace

Use this repository's `.claude-plugin/marketplace.json` for workspace imports. Each skill includes `agents/openai.yaml` with its display name, description, Zero Lab mark, and brand color.

Other agent harnesses

Install the cross-agent skills tree:

npx skills add zero-lab-ai/skills

You can also copy a single `plugins/<bundle>/skills/<skill>/` directory into the location your harness scans. Nothing outside that skill directory is required at runtime.

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

.claude-plugin/marketplace.json · Manifest · 124 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. {
  2. "name": "zero-lab",
  3. "owner": {
  4. "name": "zero-lab.ai",
  5. "email": "contact@zero-lab.ai",
  6. "url": "https://zero-lab.ai"
  7. },
  8. "metadata": {
  9. "version": "1.2.2",
  10. "description": "Security skills from zero-lab.ai for authorized assessment, detection, and engagement work"
  11. },
  12. "plugins": [
  13. {
  14. "name": "agent-security",
  15. "description": "Reviews agent and MCP surfaces, tests prompt-injection and runtime controls, and maps identity and authority across agent handoffs.",
  16. "version": "0.3.2",
  17. "author": {
  18. "name": "zero-lab.ai",
  19. "email": "contact@zero-lab.ai",
  20. "url": "https://zero-lab.ai"
  21. },
  22. "source": "./plugins/agent-security"
  23. },
  24. {
  25. "name": "recon-operations",
  26. "description": "Provides authorized network, public-exposure, human, physical, and AI-system reconnaissance with explicit scope, contact, noise, evidence, and automation boundaries.",
  27. "version": "0.2.1",
  28. "author": {
  29. "name": "zero-lab.ai",
  30. "email": "contact@zero-lab.ai",
  31. "url": "https://zero-lab.ai"
  32. },
  33. "source": "./plugins/recon-operations"
  34. },
  35. {
  36. "name": "identity-security",
  37. "description": "Assesses Active Directory, AD CS, Kerberos, credentials, privilege escalation, lateral movement, and durable identity exposure while separating structural paths from demonstrated access.",
  38. "version": "0.1.0",
  39. "author": {
  40. "name": "zero-lab.ai",
  41. "email": "contact@zero-lab.ai",
  42. "url": "https://zero-lab.ai"
  43. },
  44. "source": "./plugins/identity-security"
  45. },
  46. {
  47. "name": "application-endpoint-security",
  48. "description": "Tracks authorized security assessment coverage across web, cloud, mobile, firmware, endpoint persistence, and offline password auditing without turning missing evidence into clean results.",
  49. "version": "0.1.0",
  50. "author": {
  51. "name": "zero-lab.ai",
  52. "email": "contact@zero-lab.ai",
  53. "url": "https://zero-lab.ai"
  54. },
  55. "source": "./plugins/application-endpoint-security"
  56. },
  57. {
  58. "name": "network-protocol-security",
  59. "description": "Plans and assesses wireless, network-protocol, traffic, command-channel, and bounded covert-channel security work with explicit scope, safety, evidence, and detection boundaries.",
  60. "version": "0.1.0",
  61. "author": {
  62. "name": "zero-lab.ai",
  63. "email": "contact@zero-lab.ai",
  64. "url": "https://zero-lab.ai"
  65. },
  66. "source": "./plugins/network-protocol-security"
  67. },
  68. {
  69. "name": "binary-forensics",
  70. "description": "Triages supplied binary faults, volatile-memory evidence, and suspected rootkits, and prepares bounded validation handoffs without execution or weaponization.",
  71. "version": "0.1.0",
  72. "author": {
  73. "name": "zero-lab.ai",
  74. "email": "contact@zero-lab.ai",
  75. "url": "https://zero-lab.ai"
  76. },
  77. "source": "./plugins/binary-forensics"
  78. },
  79. {
  80. "name": "detection-validation",
  81. "description": "Builds and validates detections, audits telemetry coverage, tests defensive resilience, correlates incident evidence, and synthesizes control evidence without inflating coverage.",
  82. "version": "0.1.1",
  83. "author": {
  84. "name": "zero-lab.ai",
  85. "email": "contact@zero-lab.ai",
  86. "url": "https://zero-lab.ai"
  87. },
  88. "source": "./plugins/detection-validation"
  89. },
  90. {
  91. "name": "engagement-operations",
  92. "description": "Provides engagement planning, AI threat modeling, action-proof review, security-tool governance, findings writing, and report assembly with defensible evidence boundaries.",
  93. "version": "0.2.1",
  94. "author": {
  95. "name": "zero-lab.ai",
  96. "email": "contact@zero-lab.ai",
  97. "url": "https://zero-lab.ai"
  98. },
  99. "source": "./plugins/engagement-operations"
  100. },
  101. {
  102. "name": "rag-security",
  103. "description": "Maps retrieval surfaces and assesses source integrity, tenant isolation, context handling, data exposure, and cleanup in RAG systems.",
  104. "version": "0.2.1",
  105. "author": {
  106. "name": "zero-lab.ai",
  107. "email": "contact@zero-lab.ai",
  108. "url": "https://zero-lab.ai"
  109. },
  110. "source": "./plugins/rag-security"
  111. },
  112. {
  113. "name": "ml-system-security",
  114. "description": "Audits ML artifact lifecycles, decision boundaries, dataset integrity, and model-serving exposure with explicit evidence states.",
  115. "version": "0.2.1",
  116. "author": {
  117. "name": "zero-lab.ai",
  118. "email": "contact@zero-lab.ai",
  119. "url": "https://zero-lab.ai"
  120. },
  121. "source": "./plugins/ml-system-security"
  122. }
  123. ]
  124. }
README.md · README · 286 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # zero-lab skills
  2. Portable, evidence-bound security skills for authorized defensive assessment,
  3. penetration testing, red teaming, detection engineering, purple teaming, and
  4. engagement operations.
  5. The collection contains **56 skills in 10 installable plugins** from
  6. [zero-lab.ai](https://zero-lab.ai). Install a coherent bundle, or copy an
  7. individual skill folder into any agent harness that reads `SKILL.md`.
  8. > [!IMPORTANT]
  9. > These skills support authorized security work. They do not grant permission,
  10. > expand scope, or replace an organization's rules of engagement. Skills that
  11. > touch adversary behavior are designed to measure exposure, preserve evidence,
  12. > and hand results back to defenders.
  13. ## Contents
  14. - [Install](#install)
  15. - [Bundles](#bundles)
  16. - [Skill index](#skill-index)
  17. - [Compatibility](#compatibility)
  18. - [Trust and safety](#trust-and-safety)
  19. - [Repository structure](#repository-structure)
  20. - [Contributing](#contributing)
  21. - [Contributors](#contributors)
  22. - [Security](#security)
  23. - [License](#license)
  24. ## Install
  25. ### Claude Code
  26. ```text
  27. /plugin marketplace add zero-lab-ai/skills
  28. /plugin menu
  29. ```
  30. Select the bundle you need from the marketplace menu.
  31. ### Codex
  32. Codex reads the same marketplace metadata directly:
  33. ```sh
  34. codex plugin marketplace add zero-lab-ai/skills
  35. codex plugin list
  36. codex plugin add <bundle-name>@zero-lab
  37. ```
  38. ### ChatGPT Workspace Marketplace
  39. Use this repository's `.claude-plugin/marketplace.json` for workspace imports.
  40. Each skill includes `agents/openai.yaml` with its display name, description,
  41. Zero Lab mark, and brand color.
  42. ### Other agent harnesses
  43. Install the cross-agent skills tree:
  44. ```sh
  45. npx skills add zero-lab-ai/skills
  46. ```
  47. You can also copy a single
  48. `plugins/<bundle>/skills/<skill>/` directory into the location your harness
  49. scans. Nothing outside that skill directory is required at runtime.
  50. ## Bundles
  51. | Plugin | Skills | Purpose |
  52. | --- | ---: | --- |
  53. | [`agent-security`](plugins/agent-security) | 4 | Agent surfaces, prompt injection, runtime validation, and trust boundaries |
  54. | [`recon-operations`](plugins/recon-operations) | 9 | Network, public-exposure, human, physical, and AI-system reconnaissance |
  55. | [`identity-security`](plugins/identity-security) | 8 | Directory, credential, privilege, and lateral-movement security |
  56. | [`application-endpoint-security`](plugins/application-endpoint-security) | 6 | Cloud, web, mobile, firmware, endpoint, and password assessment coverage |
  57. | [`network-protocol-security`](plugins/network-protocol-security) | 5 | Wireless, traffic, protocol, command-channel, and egress security |
  58. | [`binary-forensics`](plugins/binary-forensics) | 4 | Binary-fault, memory, and rootkit triage |
  59. | [`detection-validation`](plugins/detection-validation) | 6 | Detection engineering, validation, telemetry, resilience, and control evidence |
  60. | [`engagement-operations`](plugins/engagement-operations) | 7 | Planning, AI threat modeling, evidence proof, findings, and report assembly |
  61. | [`rag-security`](plugins/rag-security) | 3 | Retrieval-surface, integrity, tenant, data-exposure, and cleanup assessment |
  62. | [`ml-system-security`](plugins/ml-system-security) | 4 | Model artifacts, decision boundaries, datasets, and serving exposure |
  63. ## Skill index
  64. ### Agent and AI systems
  65. Install [`agent-security`](plugins/agent-security).
  66. | Skill | Use it when… |
  67. | --- | --- |
  68. | [`agent-surface-audit`](plugins/agent-security/skills/agent-surface-audit) | Reviewing agent tools for poisoning, excess privilege, unsafe parameters, and deployment blast radius |
  69. | [`agent-runtime-validation`](plugins/agent-security/skills/agent-runtime-validation) | Validating deployed tools, memory, hooks, approvals, identities, and scope controls with benign sentinels |
  70. | [`prompt-injection-assessment`](plugins/agent-security/skills/prompt-injection-assessment) | Assessing instruction influence and policy bypass across direct, indirect, retrieval, and tool-output channels |
  71. | [`agent-trust-boundary-audit`](plugins/agent-security/skills/agent-trust-boundary-audit) | Auditing authentication, authorization, delegated authority, and effect across agent handoffs |
  72. ### Reconnaissance and exposure mapping
  73. Install [`recon-operations`](plugins/recon-operations).
  74. | Skill | Use it when… |
  75. | --- | --- |
  76. | [`network-recon`](plugins/recon-operations/skills/network-recon) | Enforcing IP scope, planning reconnaissance, or auditing scan coverage |
  77. | [`osint-scanner`](plugins/recon-operations/skills/osint-scanner) | Mapping public exposure from third-party data without contacting the target |
  78. | [`social-engineering-recon`](plugins/recon-operations/skills/social-engineering-recon) | Mapping passive, privacy-preserving human-layer exposure |
  79. | [`physical-recon`](plugins/recon-operations/skills/physical-recon) | Assessing supplied public-vantage physical-security observations |
  80. | [`target-profile-synthesis`](plugins/recon-operations/skills/target-profile-synthesis) | Joining validated cross-domain evidence into exposure themes and priorities |
  81. | [`situational-awareness`](plugins/recon-operations/skills/situational-awareness) | Assessing a foothold without exceeding an operation's noise budget |
  82. | [`opsec-planning`](plugins/recon-operations/skills/opsec-planning) | Connecting objectives to artifacts, detection risk, abort conditions, and cleanup |
  83. | [`recon-automation-governance`](plugins/recon-operations/skills/recon-automation-governance) | Governing jobs, budgets, retries, stop controls, and evidence custody |
  84. | [`ai-surface-recon`](plugins/recon-operations/skills/ai-surface-recon) | Mapping models, retrieval paths, agents, tools, guardrails, endpoints, and privileged consumers |
  85. ### Retrieval-augmented AI security
  86. Install [`rag-security`](plugins/rag-security).
  87. | Skill | Use it when… |
  88. | --- | --- |
  89. | [`retrieval-integrity-assessment`](plugins/rag-security/skills/retrieval-integrity-assessment) | Assessing source, tenant, retrieval, context, citation, output, and cleanup integrity with benign canaries |
  90. | [`rag-surface-recon`](plugins/rag-security/skills/rag-surface-recon) | Mapping RAG sources, connectors, indexes, filters, ranking, caches, citations, and exposed fields |
  91. | [`rag-data-exposure-audit`](plugins/rag-security/skills/rag-data-exposure-audit) | Measuring tenant and authorization boundaries with controlled fixtures and explicit exposure states |
  92. ### Model and ML system security
  93. Install [`ml-system-security`](plugins/ml-system-security).
  94. | Skill | Use it when… |
  95. | --- | --- |
  96. | [`model-artifact-lifecycle-audit`](plugins/ml-system-security/skills/model-artifact-lifecycle-audit) | Auditing model artifacts from intake through loading, execution, revocation, and retirement |
  97. | [`ml-decision-boundary-assessment`](plugins/ml-system-security/skills/ml-decision-boundary-assessment) | Testing whether model-output changes alter downstream security decisions or protected effects |
  98. | [`dataset-integrity-assessment`](plugins/ml-system-security/skills/dataset-integrity-assessment) | Auditing dataset sources, transformations, review, lineage, retraining, and rollback evidence |
  99. | [`model-serving-exposure-audit`](plugins/ml-system-security/skills/model-serving-exposure-audit) | Auditing model-serving APIs, identities, administrative surfaces, data stores, and access evidence |
  100. ### Identity and directory security
  101. Install [`identity-security`](plugins/identity-security).
  102. | Skill | Use it when… |
  103. | --- | --- |
  104. | [`active-directory-attack-path`](plugins/identity-security/skills/active-directory-attack-path) | Analyzing evidence-backed AD paths while separating reachability from authorized traversal |
  105. | [`adcs-exposure-audit`](plugins/identity-security/skills/adcs-exposure-audit) | Auditing certificate templates, CA policy, PKI ACLs, enrollment, and mapping controls |
  106. | [`kerberos-exposure-audit`](plugins/identity-security/skills/kerberos-exposure-audit) | Auditing sanitized Kerberos policy, protection, monitoring, and evidence controls |
  107. | [`directory-persistence-audit`](plugins/identity-security/skills/directory-persistence-audit) | Auditing directory-service governance for durable-control exposure |
  108. | [`credential-exposure-audit`](plugins/identity-security/skills/credential-exposure-audit) | Auditing supplied credential evidence without using the credential material |
  109. | [`privilege-escalation-assessment`](plugins/identity-security/skills/privilege-escalation-assessment) | Ranking Windows, Linux, or cloud elevation paths without overstating achieved privilege |
  110. | [`lateral-movement-map`](plugins/identity-security/skills/lateral-movement-map) | Mapping movement routes without confusing transport reachability with access |
  111. | [`lateral-movement-readiness`](plugins/identity-security/skills/lateral-movement-readiness) | Reviewing movement candidates before a separate validation handoff |
  112. ### Application, cloud, and endpoint assessment
  113. Install [`application-endpoint-security`](plugins/application-endpoint-security).
  114. | Skill | Use it when… |
  115. | --- | --- |
  116. | [`cloud-attack-path`](plugins/application-endpoint-security/skills/cloud-attack-path) | Mapping cloud identity, workload, credential, and trust transitions |
  117. | [`web-assessment-coverage`](plugins/application-endpoint-security/skills/web-assessment-coverage) | Tracking application surfaces, roles, and test-family coverage |
  118. | [`mobile-application-assessment`](plugins/application-endpoint-security/skills/mobile-application-assessment) | Tracking evidence-backed Android and iOS assessment coverage |
  119. | [`firmware-hardware-assessment`](plugins/application-endpoint-security/skills/firmware-hardware-assessment) | Assessing device identity, firmware acquisition, update trust, and physical safety |
  120. | [`persistence-surface-assessment`](plugins/application-endpoint-security/skills/persistence-surface-assessment) | Measuring Windows and Linux persistence exposure from supplied evidence |
  121. | [`password-audit-plan`](plugins/application-endpoint-security/skills/password-audit-plan) | Planning bounded offline password audits and restricted result handling |
  122. ### Network, protocol, and channel security
  123. Install [`network-protocol-security`](plugins/network-protocol-security).
  124. | Skill | Use it when… |
  125. | --- | --- |
  126. | [`wireless-assessment-plan`](plugins/network-protocol-security/skills/wireless-assessment-plan) | Planning authorized Wi-Fi, Bluetooth, RFID/NFC, SDR, or other radio testing |
  127. | [`protocol-traffic-analysis`](plugins/network-protocol-security/skills/protocol-traffic-analysis) | Turning supplied captures into evidence-bound conversations and limitations |
  128. | [`protocol-exploitation-assessment`](plugins/network-protocol-security/skills/protocol-exploitation-assessment) | Assessing protocol candidates without promoting weak signals into proven vulnerabilities |
  129. | [`covert-channel-assessment`](plugins/network-protocol-security/skills/covert-channel-assessment) | Measuring whether bounded synthetic channels are blocked, visible, detected, and cleaned up |
  130. | [`command-channel-defense-assessment`](plugins/network-protocol-security/skills/command-channel-defense-assessment) | Measuring defensive coverage against opaque command-channel scenarios |
  131. ### Binary and forensic analysis
  132. Install [`binary-forensics`](plugins/binary-forensics).
  133. | Skill | Use it when… |
  134. | --- | --- |
  135. | [`binary-fault-triage`](plugins/binary-forensics/skills/binary-fault-triage) | Triaging supplied binary fault evidence without execution or weaponization |
  136. | [`binary-fault-validation-readiness`](plugins/binary-forensics/skills/binary-fault-validation-readiness) | Checking whether fault evidence is ready for separate isolated validation |
  137. | [`memory-forensics-triage`](plugins/binary-forensics/skills/memory-forensics-triage) | Triaging supplied volatile-memory images while preserving evidentiary limits |
  138. | [`rootkit-triage`](plugins/binary-forensics/skills/rootkit-triage) | Triaging suspected rootkits or bootkits with independent evidence views |
  139. ### Detection and purple-team validation
  140. Install [`detection-validation`](plugins/detection-validation).
  141. | Skill | Use it when… |
  142. | --- | --- |
  143. | [`detection-engineering`](plugins/detection-validation/skills/detection-engineering) | Building rules proven against known-bad and known-good cases |
  144. | [`detection-validate`](plugins/detection-validation/skills/detection-validate) | Running an authorized technique and confirming whether its detection fires |
  145. | [`detection-resilience-test-plan`](plugins/detection-validation/skills/detection-resilience-test-plan) | Planning bounded resilience tests using pre-approved opaque fixtures |
  146. | [`telemetry-coverage-audit`](plugins/detection-validation/skills/telemetry-coverage-audit) | Auditing passive coverage, retention, custody, and investigation readiness |
  147. | [`incident-validation-correlation`](plugins/detection-validation/skills/incident-validation-correlation) | Correlating incident observations with separate isolated validation receipts |
  148. | [`defensive-control-evidence-synthesis`](plugins/detection-validation/skills/defensive-control-evidence-synthesis) | Consolidating assessments into a lineage-preserving control matrix |
  149. ### Engagement planning, governance, and reporting
  150. Install [`engagement-operations`](plugins/engagement-operations).
  151. | Skill | Use it when… |
  152. | --- | --- |
  153. | [`findings-report`](plugins/engagement-operations/skills/findings-report) | Writing reproducible, severity-justified, evidence-bound findings |
  154. | [`social-engineering-engagement-plan`](plugins/engagement-operations/skills/social-engineering-engagement-plan) | Planning authorized human-security exercises with participant safeguards |
  155. | [`security-test-tool-governance`](plugins/engagement-operations/skills/security-test-tool-governance) | Reviewing supplied security-test artifacts before controlled lab handoff |
  156. | [`assessment-sequence-governance`](plugins/engagement-operations/skills/assessment-sequence-governance) | Checking a supplied assessment sequence's ordering, authority, and safeguards |
  157. | [`engagement-report-assembly`](plugins/engagement-operations/skills/engagement-report-assembly) | Assembling validated artifacts without rewriting source findings |
  158. | [`ai-threat-model`](plugins/engagement-operations/skills/ai-threat-model) | Modeling AI architecture, trust boundaries, assumptions, and attack-path hypotheses |
  159. | [`agent-action-proof`](plugins/engagement-operations/skills/agent-action-proof) | Grading what agent callbacks, tool traces, target receipts, and state changes actually prove |
  160. ## Compatibility
  161. The repository uses the standard Claude marketplace layout also supported by
  162. Codex. Each skill includes `agents/openai.yaml` for ChatGPT presentation and
  163. keeps its core instructions in `SKILL.md`. References, scripts, assets, tests,
  164. and evaluations are included only when the capability needs them.
  165. Installing a plugin provides every skill in that bundle. Copying one skill
  166. folder provides only that portable capability.
  167. ## Trust and safety
  168. Agent skills are executable instructions. Review them with the same care as
  169. code before giving an agent access to sensitive systems.
  170. This repository's release gate checks that:
  171. - every plugin is registered and its metadata agrees across manifests;
  172. - skill frontmatter and UI metadata are complete;
  173. - local paths and references resolve cleanly;
  174. - security skills reject common rationalizations that cause missed findings;
  175. - shell and Python helpers pass linting; and
  176. - every discovered test suite passes through `make check`.
  177. Scripts perform deterministic work only where the task benefits from it. Their
  178. output does not authenticate evidence, authorize testing, or prove that a
  179. target is secure.
  180. ## Repository structure
  181. ```text
  182. plugins/<bundle>/
  183. ├── .claude-plugin/plugin.json # installable bundle metadata
  184. ├── README.md # bundle overview and skill index
  185. ├── skills/
  186. │ └── <skill>/
  187. │ ├── SKILL.md # independently portable entry point
  188. │ ├── agents/openai.yaml # ChatGPT presentation metadata
  189. │ ├── assets/ # skill-local brand or deliverable assets
  190. │ ├── references/ # optional supporting guidance
  191. │ └── scripts/ # optional reusable tooling
  192. ├── tests/ # optional deterministic code tests
  193. └── evals/ # optional behavioral model evaluations
  194. ```
  195. The root [marketplace manifest](.claude-plugin/marketplace.json) registers the
  196. ten installable bundles. A plugin README describes the bundle; each skill's
  197. frontmatter controls when that capability activates.
  198. ## Contributing
  199. Read [CONTRIBUTING.md](CONTRIBUTING.md) and [AGENTS.md](AGENTS.md) for the
  200. submission workflow and authoring contract. Start new work from
  201. [`templates/plugin-template/`](templates/plugin-template/) and run:
  202. ```sh
  203. make check
  204. ```
  205. The same validator and plugin suites run in CI.
  206. ## Contributors
  207. See [CONTRIBUTORS.md](CONTRIBUTORS.md) for project attribution.
  208. ## Security
  209. Report vulnerabilities privately to
  210. [contact@zero-lab.ai](mailto:contact@zero-lab.ai). Do not open a public issue
  211. for a vulnerability in a shipped skill or script. See
  212. [SECURITY.md](SECURITY.md) for the review and reporting policy.
  213. ## License
  214. Licensed under [Apache-2.0](LICENSE).
plugins/agent-security/skills/agent-surface-audit/scripts/inspect_tools.py · Bundled script · 204 lines · 1 finding marked
  1. #!/usr/bin/env python3
  2. # /// script
  3. # requires-python = ">=3.11"
  4. # dependencies = []
  5. # ///
  6. """Deterministic first pass over an MCP server's tool manifest.
  7. Input: a JSON file containing either a `tools/list` response
  8. (`{"tools": [...]}`), a bare list of tool objects, or a JSON-RPC envelope
  9. (`{"result": {"tools": [...]}}`). Each tool has `name`, `description`, and
  10. `inputSchema` (JSON Schema).
  11. Output: one finding per line, `SEVERITY tool check detail`, sorted by
  12. severity. Exit codes: 0 = ran and found nothing above info, 1 = findings at
  13. medium or above, 2 = bad input or zero tools (a review of nothing is not a
  14. pass).
  15. No network, no file writes, stdlib only.
  16. """
  17. from __future__ import annotations
  18. import argparse
  19. import json
  20. import re
  21. import sys
  22. from pathlib import Path
  23. SEV_ORDER = {"high": 0, "medium": 1, "info": 2}
  24. IMPERATIVE = re.compile(
  25. r"\b(ignore|disregard|always|never|you must|must not|before (?:calling|using)|"
  26. r"do not (?:tell|mention|reveal)|system prompt|previous instructions|"
  27. r"override|instead of)\b",
  28. re.I,
  29. )
  30. HIDDEN = re.compile(r"<!--|-->|<IMPORTANT>|​|‌|‍|⁠|")
    • Note: Usual in code (tag names in paths and patterns): Contains a <important> block, a common wrapper for instructions hidden in a tool description
    • Line 37 on GitHub
  31. MENTIONS_OTHER_TOOL = re.compile(r"\b(call|use|invoke)\s+`?[a-z_]+(?:_[a-z]+)+`?", re.I)
  32. SINK_NAMES = re.compile(
  33. r"(cmd|command|shell|script|exec|query|sql|path|file|url|uri|href|code|expression|eval)",
  34. re.I,
  35. )
  36. DESTRUCTIVE = re.compile(
  37. r"\b(delete|remove|drop|destroy|purge|rm|truncate|wipe|reset|revoke|kill|terminate|force)\b",
  38. re.I,
  39. )
  40. CONFIRM = re.compile(r"(confirm|dry_run|dryrun|force|yes|i_understand)", re.I)
  41. def load_tools(path: Path) -> list[dict]:
  42. data = json.loads(path.read_text(encoding="utf-8"))
  43. if isinstance(data, list):
  44. return data
  45. if isinstance(data, dict):
  46. if "tools" in data and isinstance(data["tools"], list):
  47. return data["tools"]
  48. if "result" in data and isinstance(data["result"], dict):
  49. return data["result"].get("tools", [])
  50. return []
  51. def walk_props(schema: dict, prefix: str = "") -> list[tuple[str, dict]]:
  52. out = []
  53. props = schema.get("properties", {}) if isinstance(schema, dict) else {}
  54. for name, sub in props.items():
  55. full = f"{prefix}{name}"
  56. out.append((full, sub if isinstance(sub, dict) else {}))
  57. if isinstance(sub, dict) and sub.get("type") == "object":
  58. out.extend(walk_props(sub, full + "."))
  59. return out
  60. def check_tool(tool: dict) -> list[tuple[str, str, str, str]]:
  61. f: list[tuple[str, str, str, str]] = []
  62. name = str(tool.get("name", "<unnamed>"))
  63. desc = str(tool.get("description") or "")
  64. schema = tool.get("inputSchema") or tool.get("input_schema") or {}
  65. if not desc.strip():
  66. f.append(("high", name, "no-description", "tool has no description; model will invent one"))
  67. else:
  68. m = IMPERATIVE.search(desc)
  69. if m:
  70. f.append(
  71. ("high", name, "imperative-description", f"instruction-like text: {m.group(0)!r}")
  72. )
  73. if HIDDEN.search(desc):
  74. f.append(
  75. (
  76. "high",
  77. name,
  78. "hidden-content",
  79. "comment, tag, or zero-width characters in description",
  80. )
  81. )
  82. m = MENTIONS_OTHER_TOOL.search(desc)
  83. if m:
  84. f.append(
  85. (
  86. "medium",
  87. name,
  88. "cross-tool-reference",
  89. f"description steers other tool use: {m.group(0)!r}",
  90. )
  91. )
  92. if len(desc) > 1500:
  93. f.append(
  94. (
  95. "info",
  96. name,
  97. "long-description",
  98. f"{len(desc)} chars; review for buried instructions",
  99. )
  100. )
  101. if not isinstance(schema, dict) or not schema:
  102. f.append(("medium", name, "no-schema", "no inputSchema; parameters are unbounded"))
  103. else:
  104. if schema.get("additionalProperties") is True:
  105. f.append(
  106. ("medium", name, "additional-properties", "schema accepts arbitrary extra fields")
  107. )
  108. for pname, p in walk_props(schema):
  109. ptype = p.get("type")
  110. if not p.get("description"):
  111. f.append(("info", name, "param-no-description", f"`{pname}` has no description"))
  112. if (
  113. ptype == "string"
  114. and SINK_NAMES.search(pname)
  115. and not p.get("enum")
  116. and not p.get("pattern")
  117. ):
  118. f.append(
  119. (
  120. "high",
  121. name,
  122. "free-form-sink",
  123. f"`{pname}` is an unconstrained string named like a command/path/query/url",
  124. )
  125. )
  126. if ptype == "string" and p.get("maxLength", 0) and p["maxLength"] > 4000:
  127. f.append(
  128. ("info", name, "large-string", f"`{pname}` allows up to {p['maxLength']} chars")
  129. )
  130. name_words = re.sub(r"[_\-.]", " ", name)
  131. if DESTRUCTIVE.search(name_words) or DESTRUCTIVE.search(desc[:200]):
  132. params = " ".join(n for n, _ in walk_props(schema)) if isinstance(schema, dict) else ""
  133. if not CONFIRM.search(params):
  134. f.append(
  135. (
  136. "medium",
  137. name,
  138. "destructive-no-guard",
  139. "destructive verb with no confirm/dry_run parameter",
  140. )
  141. )
  142. return f
  143. def main() -> int:
  144. ap = argparse.ArgumentParser(
  145. description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter
  146. )
  147. ap.add_argument("manifest", type=Path)
  148. ap.add_argument("--json", action="store_true", help="emit findings as JSON")
  149. args = ap.parse_args()
  150. try:
  151. tools = load_tools(args.manifest)
  152. except (OSError, json.JSONDecodeError) as e:
  153. print(f"error: cannot read manifest: {e}", file=sys.stderr)
  154. return 2
  155. if not tools:
  156. print("error: manifest contains zero tools; nothing was reviewed", file=sys.stderr)
  157. return 2
  158. findings = []
  159. for t in tools:
  160. if not isinstance(t, dict):
  161. print(f"error: tool entry is not an object: {t!r}", file=sys.stderr)
  162. return 2
  163. findings.extend(check_tool(t))
  164. findings.sort(key=lambda x: (SEV_ORDER[x[0]], x[1], x[2]))
  165. if args.json:
  166. print(
  167. json.dumps(
  168. [
  169. dict(zip(("severity", "tool", "check", "detail"), x, strict=True))
  170. for x in findings
  171. ],
  172. indent=2,
  173. )
  174. )
  175. else:
  176. print(f"reviewed {len(tools)} tools, {len(findings)} findings")
  177. for sev, tool, check, detail in findings:
  178. print(f"{sev:<7} {tool:<28} {check:<24} {detail}")
  179. return 1 if any(s in ("high", "medium") for s, *_ in findings) else 0
  180. if __name__ == "__main__":
  181. sys.exit(main())

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.