Scanner security checks and rules
The scanner reviews a plugin or repository against release, catalog, source, automation, MCP, skill, package, and code-quality policies. Each check produces a clear result for the scan, while the rule registry gives policy tools stable names and shared handling for those results. See scanner and plugin analysis for the full scan lifecycle, ecosystem detection and adapters for target selection, and AI BOM and agent inventory for inventory context.
Policy scan surface
The scan engine selects checks for the target and keeps their results with the rule inventory. This lets a policy distinguish a passed check from a check that did not apply because the target has no matching surface. scanner.py• L247-291 models.py• L45-64
The policy path turns source content into a gate decision:
flowchart LR
Target[Plugin or repository] --> Checks[Security and quality checks]
Checks --> Findings[Results and findings]
Findings --> Registry[Rule registry]
Registry --> Inventory[Executed-rule inventory]
Findings --> Inventory
Inventory --> Profile[Policy profile]
Profile --> Gate[Report or lint gate]
Check applicability
Surface-specific checks report not applicable when their input is absent. Marketplace checks need a marketplace file. MCP checks need .mcp.json. Skill checks need a safe declared skills directory. This keeps an optional feature separate from a failed review. marketplace.py• L53-61 skill_security.py• L290-341 mcp_security.py• L183-193
References: src/…/marketplace.py• L53-61 src/…/skill_security.py• L290-341 src/…/mcp_security.py• L183-193
Finding and policy flow
A finding identifies the rule, severity, category, source, and optional file location. The command layer applies rule settings and builds the executed-rule inventory. The selected profile then checks required execution, passed rules, severity limits, and score limits. models.py• L30-43 _scanner_commands.py• L97-124 policy.py• L85-133
References: src/…/models.py• L30-43 src/…/_scanner_commands.py• L97-124 src/…/policy.py• L85-133
Manifest validation
Manifest checks validate the plugin declaration before other checks rely on it. The main contract is .codex-plugin/plugin.json, which must provide identity data and safe references to content inside the plugin. manifest.py• L27-64
Plugin declaration
The declaration requires a name, version, and description. The name and version follow basic format rules. Author, home page, repository, license, and keyword data add useful release context but are not required. manifest.py• L90-134 manifest.py• L137-262
References: src/…/manifest.py• L90-134 src/…/manifest.py• L137-262
Interface metadata
An optional interface object describes how a plugin appears to users. When present, it must provide valid display, developer, category, capability, link, and asset data. manifest.py• L265-435 manifest_support.py• L11-61
References: src/…/manifest.py• L265-435 src/…/manifest_support.py• L11-61
Manifest paths
Declared skill and app paths must be relative and must resolve inside the plugin. This prevents later scans from following an absolute path or a path traversal reference. manifest.py• L438-500 path_support.py• L19-44
References: src/…/manifest.py• L438-500 src/…/path_support.py• L19-44
Ecosystem package declarations
Ecosystem checks extend the same declaration goal to Claude and DeepSeek Harness packages. They verify package identity, marketplace or bundle shape, safe paths, and required runtime or content declarations. claude.py• L31-303 deepseek_harness.py• L10-68 ecosystem_common.py• L7-20
References: src/…/claude.py• L31-303 src/…/deepseek_harness.py• L10-68 src/…/ecosystem_common.py• L7-20
Kimi package declarations
Kimi checks validate the Kimi manifest and the content it declares. They cover plugin identity, bundle paths, interface and prompt shapes, MCP server declarations, and safe local resources. The declared bundle then receives the shared release, credential, approval, and code-quality checks. kimi.py• L69-261 kimi.py• L267-464 kimi.py• L467-497
References: src/…/kimi.py• L69-261 src/…/kimi.py• L267-464 src/…/kimi.py• L467-497
Marketplace validation
Marketplace checks validate the catalog that publishes local plugins. Discovery prefers .agents/…/marketplace.json and falls back to the root marketplace.json. If neither file exists, the checks do not apply. marketplace_support.py• L12-53 marketplace.py• L12-61
Marketplace entry shape
The catalog must define a name and a plugin list. Each entry needs a local source and a policy description. The policy gives users installation, authentication, and category context for the listed plugin. marketplace.py• L62-269
References: src/…/marketplace.py• L62-269
Marketplace source boundaries
Each local source is checked against the repository root. It must use the expected relative form and remain inside that root. This prevents a catalog from directing the scanner to an external directory. marketplace.py• L273-327 marketplace_support.py• L60-102
References: src/…/marketplace.py• L273-327 src/…/marketplace_support.py• L60-102
Security baseline checks
Security baseline checks review release trust and source content. They look for disclosure guidance, license terms, hardcoded secret material, packaged executables that text checks cannot inspect, and defaults that remove user approval or sandbox limits. security.py• L658-801 security.py• L1209-1297
Release trust documents
The scanner gives a low-severity finding when SECURITY.md or a license file is missing. These files explain how users can report security issues and what rights apply to the plugin. Common MIT and Apache-2.0 forms receive the same basic license credit. security.py• L658-729
References: src/…/security.py• L658-729
Secret and approval review
The source review looks for provider keys, private keys, generic secret assignments, and runtime reads of credential files. It recognizes complete runtime substitutions, symbolic references, and bounded metadata maps as non-secret. It also accepts fully enclosed word-like placeholders such as <password> or [redacted]. Malformed or credential-shaped bracket values remain candidates. Clear synthetic or incomplete provider tokens can pass on example surfaces when nearby text shows that the content is illustrative. security.py• L297-625 security_secret_patterns.py• L18-214
The approval review rejects defaults that bypass approval or allow unrestricted access. This check covers JSON, Markdown, YAML, and TOML surfaces because policy defaults can appear in both configuration and documentation. security.py• L1043-1281
References: src/…/security.py• L297-625 src/…/security_secret_patterns.py• L18-214 src/…/security.py• L1043-1281
Scan input safety
Content checks fail closed when the scanner cannot safely read the input tree. They also return a separate resource-budget failure when the tree is too deep, too large, or too broad for complete analysis. An incomplete review therefore cannot appear as a clean pass. security.py• L209-285 security.py• L638-655 security_failures.py• L1-40
Large files that are structurally recognized as packaged Mach-O executables are not read as text. The scanner reports them as uninspected binaries, with code-signature data shown only as context. A recognized format or signature does not prove that the binary is safe or matches its source. security.py• L209-285 security.py• L1285-1297 security_binaries.py• L1-7 security_binaries.py• L189-260
References: src/…/security.py• L209-285 src/…/security.py• L1285-1297 src/…/security_failures.py• L1-40 src/…/security_binaries.py• L1-7 src/…/security_binaries.py• L189-260
Operational security checks
Operational-security checks review automation and dependency surfaces that can change or build a plugin. Their goal is supply-chain control rather than manifest or runtime behavior. operational_security.py• L1-24
Workflow controls
Workflow checks require third-party actions and reusable workflows to use full commit SHAs. They also reject broad write-all permissions and privileged triggers that check out pull-request or workflow-run head content. operational_security.py• L88-222
References: src/…/operational_security.py• L88-222
Dependency update controls
Dependency checks expect Dependabot coverage when workflows or supported dependency manifests exist. They also expect lockfiles for Node and Python manifests, or fully pinned entries in requirements.txt. operational_security.py• L225-346
References: src/…/operational_security.py• L225-346
MCP security checks
MCP means Model Context Protocol. It lets a plugin describe servers and tools that an agent can call. Native checks protect the configuration itself. Optional Cisco analysis adds static review of the MCP configuration and supported source files. security.py• L836-1040 mcp_security.py• L183-216
Native MCP configuration checks
Native checks look for dangerous commands, invalid MCP JSON, insecure remote URLs, and defaults that bypass approval or sandbox limits. Remote endpoints must use HTTPS. Plain HTTP is allowed only for loopback development targets. A configuration with no remote URL is not applicable to transport hardening. security.py• L836-1040
References: src/…/security.py• L836-1040
Cisco MCP analysis
When .mcp.json exists, the Cisco integration scans the configuration and safe supported source files without running the MCP server. The result records whether scanning ran, which targets were reviewed, which analyzers succeeded, and which findings were returned. The MCP check keeps scanner availability, elevated findings, and analyzability separate so an empty analysis is visible as a failure rather than a clean pass. cisco_mcp_scanner.py• L296-339 cisco_mcp_scanner.py• L494-665 mcp_security.py• L56-181
References: src/…/cisco_mcp_scanner.py• L296-339 src/…/cisco_mcp_scanner.py• L494-665 src/…/mcp_security.py• L56-181
MCP integration modes
The MCP integration supports off, auto, and on. In auto, an unavailable Cisco scanner is not applicable. In on, that availability problem becomes a low-severity failed check. Medium and higher Cisco findings fail the elevated-findings check. mcp_security.py• L66-109 models.py• L89-97
References: src/…/mcp_security.py• L66-109 src/…/models.py• L89-97
Skill security checks
Skill security reviews instruction files that a plugin exposes to an agent. It first resolves the manifest-declared skills directory and confirms that the scan stays inside the plugin. It then combines Cisco skill analysis with a local review of commands that can read secrets, run shell wrappers, or send workspace data to a remote endpoint. skill_security.py• L204-287 skill_security.py• L290-341
Skill content analysis
The Cisco integration scans safe SKILL.md files and reports its policy preset, analyzers, findings, and skipped skills. A completed scan has separate results for availability, elevated findings, and analyzability. Advisory findings remain visible. Medium and higher findings fail the elevated-findings check. skill_security.py• L69-200 cisco_skill_scanner.py• L345-429
References: src/…/skill_security.py• L69-200 src/…/cisco_skill_scanner.py• L345-429
Local instruction review
The local review gives a high-severity finding to instructions that read .env or SSH material, use shell wrappers, or transfer workspace data with network commands. It handles shell comments and physical line continuations before matching commands. A complete fenced block is exempt only when every command is a literal read-only curl retrieval with approved options. Uploads, shell composition, authentication, unknown options, unsafe URLs, and unsafe continuations remain findings. skill_security.py• L28-37 skill_security.py• L214-287 skill_curl_context.py• L22-139
References: src/…/skill_security.py• L28-37 src/…/skill_security.py• L214-287 src/…/skill_curl_context.py• L22-139
Skill scan modes
Skill scanning uses auto by default and accepts off or on. The configured Cisco policy preset is passed to the external scanner. If the scanner is required but unavailable, the availability check fails. Otherwise the deep scan is skipped and the result states why. skill_security.py• L69-118 cisco_skill_scanner.py• L345-390
References: src/…/skill_security.py• L69-118 src/…/cisco_skill_scanner.py• L345-390
Code quality checks
Code-quality checks scan supported Python and JavaScript or TypeScript source for patterns that turn data into code or shell commands. They skip common generated, dependency, build, and virtual-environment directories. code_quality.py• L11-73
Dynamic execution
The dynamic-execution check flags direct eval() calls, explicit global eval calls, and the JavaScript Function constructor. It ignores member methods such as $eval or client.eval, and it does not treat declarations named eval as calls. These distinctions reduce findings for APIs that do not execute arbitrary global code. code_quality.py• L14-22 code_quality.py• L123-178
References: src/…/code_quality.py• L14-22 src/…/code_quality.py• L123-178
Shell command construction
The shell-injection check flags interpolated template values passed directly to process or shell execution calls such as exec, spawn, os.system, or subprocess. It also follows a template value assigned to a variable before that variable reaches a supported process call. The finding points authors toward structured arguments and controlled input. code_quality.py• L33-94
References: src/…/code_quality.py• L33-94
Rule registry and policy profiles
The rule registry is the shared policy catalog. A rule specification gives a stable ID its category, default severity, score weight, documentation link, remediation text, fix status, and supported profiles. Check modules decide when a finding exists. The registry tells reports and policy tools how to describe and handle it. specs.py• L10-26 registry.py• L18-40
Registry lookup
The built-in catalog covers manifest, marketplace, workflow, dependency, native MCP, secret, and code-quality rules. It also includes the Cisco skill-scanner availability rule. list_rule_specs() supports rule listing. get_rule_spec() supports explanation and fix lookup. has_rule_spec() supports presence checks. registry.py• L44-100 _scanner_commands.py• L50-62 _scanner_commands.py• L193-241
References: src/…/registry.py• L44-100 src/…/_scanner_commands.py• L50-62 src/…/_scanner_commands.py• L193-241
Profile requirements
Policy profiles use registry IDs as contracts for required execution and required passes. The default profile requires core manifest, secret, and MCP checks. The public-marketplace profile adds marketplace, documentation, and skill-frontmatter requirements. Strict-security adds workflow and dependency controls. A disabled required rule can therefore fail a profile because it did not execute. policy.py• L37-81 _scanner_commands.py• L116-121
References: src/…/policy.py• L37-81 src/…/_scanner_commands.py• L116-121
External finding metadata
Cisco findings are converted into the local Finding shape. MCP findings can derive IDs from external threat categories. Skill findings keep their external IDs. If an ID is not in the built-in registry, lint can still show the finding but cannot add registry metadata such as fix status. cisco_mcp_scanner.py• L247-293 cisco_skill_scanner.py• L283-306
References: src/…/cisco_mcp_scanner.py• L247-293 src/…/cisco_skill_scanner.py• L283-306
Change checklist
When these files or sections are changed, remember to consider these:
- When a check changes a
rule_id, update its registry entry, profile requirements, documentation link, and report consumers together. - When a check becomes conditional, review required-executed rules because not-applicable results are not executed rules.
- When manifest or marketplace path rules change, review shared path containment and the ecosystem adapter assumptions that select scan roots.
- When shared ecosystem declaration helpers change, review frontmatter and version checks in every ecosystem check that uses them.
- When Cisco result states or finding IDs change, review availability, analyzability, integration reporting, and registry lookup together.
- When check point limits or registry weights change, review score thresholds separately because check scores and registry metadata are different contracts.
- When security input handling changes, review unreadable-input, resource-budget, and uninspected-binary results with every affected check and policy profile.
- When packaged-binary recognition changes, review bounded header validation, binary limits, signature wording, and the assurance boundary for skipped content together.
- When secret exemptions change, review provider tokens, private keys, symbolic references, metadata maps, placeholders, example context, and match budgets together.
- When local skill command recognition changes, review shell continuation, comment handling, whole-block
curlexemptions, URL validation, and risky command matching together. - When code-quality patterns change, review direct calls, member calls, declaration syntax, assigned template values, and excluded source paths together.
- When Kimi manifest rules change, review declared bundle selection, shared security checks, Kimi rule IDs, and path containment together.
- When Claude or DeepSeek Harness declaration rules change, review package normalization and related stable rule IDs together.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| The preferred .agents/…/marketplace.json exists but is malformed. | The root marketplace file is not selected, so the catalog check fails even if the root file is valid. | Keep the preferred file valid or remove it when the root file is the intended catalog. |
| plugin.json is missing or invalid. | Required manifest fields cannot be checked, and skill security cannot resolve its directory. | Repair the manifest before reviewing dependent content. |
| A manifest or marketplace path escapes its root. | The target is rejected or skipped instead of being scanned. | Use safe relative paths inside the declared root. |
| A privileged workflow checks out a pull-request or workflow-run head ref. | Untrusted code can run in a privileged automation context. | Avoid untrusted checkout patterns in privileged workflows. |
| A security check cannot read its input tree safely. | The check fails with an unreadable-input result instead of passing an incomplete review. | Keep scanned paths readable and inside the plugin. |
| A scan exceeds its depth, file, match, or byte budget. | The check fails with a resource-budget result and does not claim complete analysis. | Reduce generated or vendored input, or scan the intended plugin directory directly. |
| A large packaged Mach-O executable is recognized and skipped. | Text checks do not inspect its content, and an uninspected-binary finding remains even when the file declares a code signature. | Publish source or reproducible build evidence and review the executable before trust. |
Cisco skill or MCP scanning is on but the dependency is unavailable or fails. | The integration availability check fails and can block the policy gate. | Install the scanner from a trusted source or choose a mode that matches the review policy. |
| A required policy rule is disabled or not marked as executed. | The profile fails even when no finding was emitted for that rule. | Keep required rules enabled and preserve their registry IDs. |
| A real secret matches an exemption for generated, metadata, placeholder, or example content. | Sensitive material can pass the hardcoded-secret check. | Keep exemptions narrow and reject unclosed or credential-shaped bracket values. |
A skill example contains one unsafe command inside a read-only curl fence. | The whole block remains a finding. | Exempt only complete blocks whose commands all pass the literal retrieval rules. |
Key files
| File | Why to read it |
|---|---|
| src/…/scanner.py | Shows how the scanner assembles check families for plugin and repository scopes. |
| src/…/manifest.py | Defines the plugin declaration and interface contracts. |
| src/…/claude.py | Defines Claude plugin and marketplace declaration checks. |
| src/…/deepseek_harness.py | Defines DeepSeek Harness package and runtime declaration checks. |
| src/…/kimi.py | Defines Kimi manifest, declared bundle, MCP, and shared content checks. |
| src/…/ecosystem_common.py | Defines shared ecosystem version and frontmatter checks. |
| src/…/marketplace.py | Defines catalog shape, policy fields, and source checks. |
| src/…/marketplace_support.py | Defines marketplace discovery and source-root rules. |
| src/…/operational_security.py | Defines workflow and dependency hygiene checks. |
| src/…/security.py | Defines release, secret, MCP configuration, transport, approval, and fail-closed input checks. |
| src/…/security_binaries.py | Defines bounded recognition and reporting for packaged Mach-O executables that text checks skip. |
| src/…/security_secret_patterns.py | Defines the secret detector catalog and safe non-secret rules. |
| src/…/security_failures.py | Defines shared failure results for unreadable security input. |
| src/…/mcp_security.py | Connects MCP scan status and findings to check results. |
| src/…/cisco_mcp_scanner.py | Shows the static MCP target and external analyzer boundary. |
| src/…/skill_security.py | Connects the manifest skills path, Cisco analysis, and local instruction review. |
| src/…/skill_curl_context.py | Defines safe read-only curl example rules. |
| src/…/cisco_skill_scanner.py | Shows how external skill results become local findings and integration status. |
| src/…/code_quality.py | Defines source patterns that produce code-quality findings. |
| src/…/registry.py | Defines stable rule metadata and category metadata for lint and policy surfaces. |
| src/…/specs.py | Defines the rule metadata contract. |
| src/…/policy.py | Defines profile requirements and policy decisions. |
| src/…/_scanner_commands.py | Shows how configuration, registry IDs, findings, and profiles form the lint or scan gate. |