Back to skill

Security audit

CodeWiki Generator

Security checks for vulnerabilities and agentic risk

Overview

This skill is a repository documentation generator whose file reads, metadata generation, and documentation-site setup match its stated purpose, though users should be cautious with dependency installation and private-code metadata.

Install and run this only in a repository you are comfortable having summarized into codewiki/.meta and Markdown files. Prefer a clean branch, review generated files before committing, pin npm and wrangler versions or add a lockfile before installation, and avoid running the optional Cloudflare deployment unless you intend to use your Cloudflare account for publishing.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T08 · Insecure Dependencies

Warning
Location
assets/vitepress/package.json:9
Finding
Unpinned npm Dependencies Permit Unreviewed Supply-Chain Code Execution<![CDATA[ ## Vulnerability Details **File Location**: `assets/vitepress/package.json:9-13` **Related Locations**: `SKILL.md:78-93`, `references/deploy-cloudflare.md:13-16` **Vulnerability Type**: Unpinned third-party dependencies and mutable package execution **Risk Level**: Medium ### Vulnerable Code `assets/vitepress/package.json:9-13` ```json "devDependencies": { "mermaid": "*", "vitepress": "*", "vitepress-plugin-mermaid": "*" } ``` `SKILL.md:78-93` ```bash npm --prefix codewiki install ``` ```bash npx -p vitepress -p vitepress-plugin-mermaid -p mermaid vitepress dev codewiki ``` `references/deploy-cloudflare.md:13-16` ```bash npm install -g wrangler ``` ### Technical Analysis The packaged VitePress dependencies use the wildcard version constraint `*`, and the documented `npx` and global Wrangler installation commands do not specify versions. No lockfile is included to constrain transitive dependency resolution. As a result, separate executions of the documented workflow can retrieve different package releases that were not present during this audit. Both npm installation and `npx` execution may run package lifecycle scripts or package-provided executables with the permissions of the invoking user. The project does not itself contain a malicious dependency payload, and no evidence was found that the current packages are intentionally malicious. The vulnerability is the absence of dependency integrity and version controls, which creates an execution path for a future compromised, malicious, or unexpectedly changed upstream release. Installing Wrangler globally additionally modifies the user-wide Node.js environment, increasing the persistence and scope of any compromised package compared with a project-local installation. ### Attack Path 1. An attacker compromises a maintainer account, package release process, or transitive dependency associated with `vitepress`, `vitepress-plugin-mermaid`, `mermaid`, or `wrangler`. 2. The attacker pub ...[truncated 1538 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Replace wildcard constraints with exact, reviewed versions: ```json { "devDependencies": { "mermaid": "<reviewed-exact-version>", "vitepress": "<reviewed-exact-version>", "vitepress-plugin-mermaid": "<reviewed-exact-version>", "wrangler": "<reviewed-exact-version>" } } ``` 2. Generate, review, and commit `package-lock.json` so direct and transitive dependency versions and integrity hashes are reproducible. 3. Replace: ```bash npm --prefix codewiki install ``` with: ```bash npm --prefix codewiki ci ``` 4. Avoid unversioned ephemeral execution. Pin every `npx` package explicitly, or preferably execute binaries from the lockfile-controlled local installation: ```bash npm --prefix codewiki exec -- vitepress dev . ``` 5. Replace the global Wrangler installation with a project-local, pinned development dependency. Execute it through the local package context rather than modifying the user-wide environment. 6. Where compatible with the selected packages, consider disabling lifecycle scripts during installation: ```bash npm --prefix codewiki ci --ignore-scripts ``` Confirm first that no required dependency legitimately relies on an installation script. 7. Use a controlled dependency-update process that includes automated vulnerability scanning, integrity review, changelog inspection, and testing before lockfile updates are accepted. 8. Run documentation builds in a restricted environment with minimal filesystem access, no unnecessary secrets, and limited outbound network connectivity. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Rogue AgentSelf-Modification, Session Persistence
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
Findings (18)

Ae1

High
Category
analysis-evasion
Content
Execute the analyzer script to scan the codebase and generate structured metadata. `<skill-root>` refers to the directory containing this `SKILL.md`.
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

YARA rule 'agent_skill_mcp_tool_poisoning_metadata': MCP/tool metadata poisoning indicators in tool schemas or skill manifests [agent_skills]

High
Category
YARA Match
Content
il
from pathlib import Path
import json


SCRIPT_DIR = Path(__file__).resolve().parent
SKILL_DIR = SCRIPT_DIR.parent
ASSETS_DIR = SKILL_DIR / "assets" / "vitepress"

REQUIRED_DIRS = [
    "getting-started",
    "architecture",
    "core-components",
    "development",
]

REQUIRED_FILES = {
    "overview.md": """# Overview\n\n```text\n# Related Code:\n- path/to/file\n```\n\n## One-Line Definition\n<!-- Replace with a one-sentence definition of the system. -->\n\n## Tech Stack Radar\n<!-- List core language, framework, infra, and key deps. -->\n\n## System Context Diagram\n<!-- Use Mermaid. -->\n""",
    "architecture/overview.md": """# Architecture Overview\n\n```text\n# Related Code:\n- path/to/file\n```\n\n## Design Rationale\n<!-- Explain why this architecture exists. -->\n""",
    "core-components/overview.md": """# Core Components Overview\n\n```text\n# Related Code:\n- path/to/file\n```\n\n## Component Map\n<!-- Summarize major components and why they exist. -->\n""",
    "develop
Confidence
80% confidence
Finding
YARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).

Self-Modification

High
Category
Rogue Agent
Content
parser.add_argument("--repo-root", default=os.getcwd(), help="Repo root path")
    parser.add_argument("--out-dir", default="codewiki", help="Output directory")
    parser.add_argument("--no-copy-images", action="store_true", help="Skip copying image assets")
    parser.add_argument("--force", action="store_true", help="Overwrite existing files")
    parser.add_argument(
        "--refresh-sidebar",
        action="store_true",
Confidence
85% confidence
Finding
Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.

Lp3

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding
The skill directs the agent to read the repository, write many files under `codewiki/`, and execute shell commands, but it declares no explicit tool scope or permission boundaries. This creates unnecessary risk because a host agent may grant broader file-system or shell access than intended, making accidental modification of unrelated files or execution in an unsafe environment more likely.

Rp1

Medium
Category
MCP Rug Pull
Confidence
91% confidence
Finding
The skill recommends `npx -p vitepress -p vitepress-plugin-mermaid -p mermaid vitepress dev codewiki`, which pulls and executes packages at runtime without pinning versions. This is dangerous because it exposes users to supply-chain risk, including malicious or compromised upstream package releases being fetched and executed immediately.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
def _run(cmd: list[str], cwd: Path | None = None) -> tuple[int, str]:
    try:
        proc = subprocess.run(cmd, cwd=str(cwd) if cwd else None, capture_output=True, text=True)
        return proc.returncode, proc.stdout.strip()
    except FileNotFoundError:
        return 127, ""
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
The code invokes external tooling such as go, cargo, and swift to extract metadata, which can have side effects, leak information to toolchains, or execute in attacker-influenced environments. In a repository-analysis skill, silent execution of local build ecosystem tools is more dangerous because untrusted repositories may be analyzed and users may not realize code-adjacent tooling will run.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
The analysis pipeline recursively scans the repository, extracts structural details, symbols, dependencies, commands, and entrypoints, then serializes them for later use. That behavior can unintentionally collect and persist sensitive project intelligence, especially when used on private codebases where file names, service names, and architecture metadata are confidential.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The script writes detailed repository metadata, symbol inventories, dependency lists, evidence, planning data, and generated documentation to disk automatically. In an agent skill context, that can expose sensitive internal structure, secrets-adjacent filenames, or proprietary architecture details into a new output tree without explicit user awareness or consent.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
]
    if force:
        cmd.append("--force")
    subprocess.run(cmd, check=False)


def refresh_sidebar(repo_root: Path, out_dir: Path, language: str) -> None:
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
]
    if force:
        cmd.append("--force")
    subprocess.run(cmd, check=False)


def refresh_sidebar(repo_root: Path, out_dir: Path, language: str) -> None:
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Missing User Warnings

Low
Confidence
89% confidence
Finding
The skill instructs the agent to generate documentation directly into the repository's `codewiki/` directory and later install dependencies there, but it does not clearly warn the user that local project contents will be created or modified. In this context the writes are expected, yet the lack of an explicit modification warning can still lead to unintended repository changes, noisy diffs, or accidental commits.

Unpinned Dependencies

Low
Category
Supply Chain
Content
"docs:preview": "vitepress preview ."
  },
  "devDependencies": {
    "mermaid": "*",
    "vitepress": "*",
    "vitepress-plugin-mermaid": "*"
  }
Confidence
97% confidence
Finding
The package manifest uses a wildcard version for `mermaid`, which makes builds non-reproducible and allows future installs to pull in any newly published version, including vulnerable or malicious releases. In a documentation-generation skill that depends on third-party rendering libraries, this increases supply-chain risk because the exact dependency version cannot be audited or consistently controlled.

Unverifiable Dependency: mermaid has 16 known advisory(ies) (CVE-2026-71436 (Mermaid XY Charts are vulnerable to an infinite loop DoS); CVE-2026-71437 (Mermaid Architecture diagrams are vulnerable to prototype pollution); CVE-2021-35513 (Cross-site Scripting in Mermaid) +13 more), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
88% confidence
Finding
`mermaid` has known security advisories, and because the manifest does not pin a version, there is no way to verify whether the installed release is affected. In this skill's context, Mermaid will likely render diagram content derived from repositories, so known issues such as XSS, prototype pollution, or denial of service can become more relevant if untrusted content is processed during doc generation or preview.

Unpinned Dependencies

Low
Category
Supply Chain
Content
},
  "devDependencies": {
    "mermaid": "*",
    "vitepress": "*",
    "vitepress-plugin-mermaid": "*"
  }
}
Confidence
97% confidence
Finding
The `vitepress` dependency is declared as `*`, so any version may be installed depending on when and where the package is resolved. This creates supply-chain and stability risk by preventing reproducible builds and making it possible to silently pick up vulnerable or compromised upstream releases.

Unpinned Dependencies

Low
Category
Supply Chain
Content
"devDependencies": {
    "mermaid": "*",
    "vitepress": "*",
    "vitepress-plugin-mermaid": "*"
  }
}
Confidence
97% confidence
Finding
Using `*` for `vitepress-plugin-mermaid` leaves the plugin version uncontrolled, which is especially risky because plugins execute within the documentation toolchain and may process repository-controlled content. This can expose builds to newly introduced vulnerabilities or malicious package updates without any manifest change.

Missing User Warnings

Low
Confidence
89% confidence
Finding
The script creates directories and writes multiple markdown files via mkdir() and write_text(), but there is no confirmation prompt, print/log message, or nearby comment warning the user that repository contents will be created or overwritten. Although this is a bootstrap utility, the code still performs direct filesystem changes and the only safeguard is the --force overwrite flag, which is not a user-facing disclosure at execution time.

Missing User Warnings

Low
Confidence
86% confidence
Finding
The function scans repository markdown, resolves local image references, and copies matching image files into the generated assets directory. This modifies the filesystem and potentially duplicates repository content, but the script does not emit any user-facing warning, logging, or inline documentation explaining that local assets will be copied unless --no-copy-images is set.

Static analysis

No suspicious patterns detected.