Back to skill

Security audit

WeChat Mini Program Builder

Security checks for vulnerabilities and agentic risk

Overview

This WeChat mini-program builder is mostly purpose-aligned, but it has under-disclosed remote AI data sharing and unsafe local file-write behavior that users should review before installing.

Review this before installing or running it. Avoid entering secrets or confidential requirements in prompts, use it only in a dedicated workspace, do not pass path-like names, and pin/review npm dependencies before using generated cloud functions. There is no evidence of intentional deception or destructive behavior, but the file-write and data-sharing controls are not strong enough for a clear benign approval.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
mp_builder.py:48
Finding

Unvalidated CLI Names Permit Writes Outside the Intended Project Directory

Content
View full analysis

Vulnerability Details

File Location: mp_builder.py:48-66, mp_builder.py:99-103, and mp_builder.py:152-159
Vulnerability Type: Path traversal and arbitrary file overwrite
Risk Level: High

Vulnerable Code

python
project_dir = Path(project_name)
project_dir.mkdir(exist_ok=True)

(project_dir / "pages").mkdir(exist_ok=True)
(project_dir / "utils").mkdir(exist_ok=True)
(project_dir / "components").mkdir(exist_ok=True)
(project_dir / "cloudfunctions").mkdir(exist_ok=True)

# Create app.json
template_data = self.TEMPLATES[template]
app_json = {
    "pages": [f"pages/{p}/main" for p in template_data["pages"]],
    "window": {
        "navigationBarTitleText": project_name,
        "navigationBarBackgroundColor": "#ffffff"
    }
}

with open(project_dir / "app.json", "w") as f:
    json.dump(app_json, f, indent=2, ensure_ascii=False)
python
page_dir = Path("pages") / page_name
page_dir.mkdir(exist_ok=True)

with open(page_dir / "generated.md", "w") as f:
    f.write(code)
python
func_dir = Path("cloudfunctions") / func_name
func_dir.mkdir(exist_ok=True)

with open(func_dir / "index.js", "w") as f:
    f.write(templates[func_name])

with open(func_dir / "package.json", "w") as f:
    json.dump({"name": func_name, "version": "1.0.0", "dependencies": {"wx-server-sdk": "latest"}}, f, indent=2)

Technical Analysis

The project_name, page_name, and func_name values originate from the command-line --name argument and are used directly to construct filesystem paths. The application does not reject absolute paths, path separators, or parent-directory components such as ...

With pathlib, joining a base path to an absolute user-supplied path discards the base path. Relative paths containing ../ can similarly resolve outside the expected pages or cloudfunctions directory. The application then opens fixed filenames in write mode, whi ...[truncated 1678 chars]

Remediation
View remediation

Remediation Suggestions

  • Treat names as identifiers rather than arbitrary paths. Apply an allowlist such as:
    python
    import re
    
    NAME_PATTERN = re.compile(r"^[A-Za-z0-9_-]+$")
    
    def validate_name(value: str) -> str:
        if not NAME_PATTERN.fullmatch(value):
            raise ValueError("Name may contain only letters, numbers, underscores, and hyphens")
        return value
    
  • Define an explicit workspace root, resolve both the root and candidate path, and verify containment:
    python
    def safe_child(root: Path, name: str) -> Path:
        validate_name(name)
        root = root.resolve()
        candidate = (root / name).resolve()
        if candidate.parent != root:
            raise ValueError("Destination escapes the workspace")
        return candidate
    
  • Reject absolute paths, . and .. components, directory separators, null characters, and platform-specific alternate separators.
  • Consider refusing to overwrite existing files by using exclusive creation mode ("x") or by requiring an explicit --force option.
  • Check for symbolic links in destination components where the workspace may be writable by another user.
  • Run generation with minimal filesystem privileges and isolate the workspace from sensitive source, configuration, and deployment directories.

T08 · Insecure Dependencies

Warning
Location
mp_builder.py:158
Finding

Unpinned and Mutable npm Dependencies Create Supply-Chain Exposure

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:21-24 and mp_builder.py:158-159
Vulnerability Type: Unpinned third-party dependencies
Risk Level: Medium

Vulnerable Code

bash
npm install -g miniprogram-cli
python
with open(func_dir / "package.json", "w") as f:
    json.dump({"name": func_name, "version": "1.0.0", "dependencies": {"wx-server-sdk": "latest"}}, f, indent=2)

Technical Analysis

The installation documentation directs users to perform a global installation of miniprogram-cli without specifying a reviewed version or integrity value. npm therefore resolves whichever version is current when the command is run. Global installation also increases exposure because package lifecycle scripts execute in the installation context and the resulting executable becomes broadly available to the user.

Generated cloud-function projects declare wx-server-sdk using the mutable latest tag. Consequently, two installations of the same generated project can resolve different code. No lockfile or integrity metadata is generated to make dependency resolution reproducible.

The documentation installs miniprogram-cli but subsequently invokes mp-builder. This naming inconsistency should be verified because it can cause users to search for or install unintended similarly named packages. The audited files do not establish that either package is malicious; the confirmed issue is the absence of version pinning and integrity controls.

Attack Path

  1. A user follows the documented command:
    bash
    npm install -g miniprogram-cli
    
  2. npm resolves the package version available from the configured registry at installation time.
  3. If the package account, registry, dependency chain, or newly published release has been compromised, unreviewed code and lifecycle scripts are installed and may execute.
  4. Separately, a user runs npm install in a generated cloud-function directo ...[truncated 854 chars]
Remediation
View remediation

Remediation Suggestions

  • Confirm the official npm package identity and make the documented package and executable names consistent.
  • Pin the global CLI to an exact reviewed version:
    bash
    npm install --global miniprogram-cli@X.Y.Z
    
  • Prefer a project-local development dependency over a global installation and invoke it through npm exec or a package script.
  • Replace "latest" with an exact reviewed wx-server-sdk version:
    json
    {
      "dependencies": {
        "wx-server-sdk": "X.Y.Z"
      }
    }
    
  • Generate and retain a lockfile with integrity hashes. Use npm ci in automated builds and deployments.
  • Review direct and transitive dependencies, monitor security advisories, and update pinned versions through a controlled review process.
  • Use a trusted registry configuration and enable package provenance or signature verification where supported.
  • Avoid running npm installation commands with elevated operating-system privileges.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (7)

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The title and core value proposition are presented entirely in Chinese, indicating the skill is intended to operate in Chinese without any opt-in or alternative language guidance. Under the policy, locale or language constraints should either offer user choice or be clearly justified as region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

Natural-language strings, descriptions, and prompts throughout the file are entirely in Chinese and the generation prompt specifically instructs output for a Chinese WeChat Mini Program workflow. The file does not offer language selection or explain that the skill is intentionally limited to Chinese-speaking users or a China-specific environment.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The file-level documentation describes a mini-program rapid builder for AI-assisted code generation, but it does not indicate any need to access local environment secrets. The code requires OPENCLAW_API_KEY and uses it to enable remote model calls, which is a capability beyond straightforward local project scaffolding and should be explicitly justified if intended.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This code creates directories and writes app.json as part of the create command, but there is no confirmation prompt or upfront disclosure that filesystem contents will be created or overwritten in the target path. Success messages appear only after the operation, so the user is not warned before data-affecting writes occur.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The tool sends user-supplied prompts to a third-party AI service over the network, which can expose sensitive project requirements or proprietary data if users include them in prompts. While this appears aligned with the AI generation feature, the lack of explicit disclosure and consent makes it a real privacy and data-handling risk.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Prompt content is transmitted to an external API without an explicit warning, creating a risk that users unknowingly disclose confidential business logic, credentials, or personal data. Because prompt text is fully user-controlled and may contain sensitive material, silent network transmission is security-relevant.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The code writes model output into pages//generated.md, affecting the local filesystem, but only prints a success message afterward. There is no pre-write disclosure or help text indicating that running the command will create directories and persist generated content.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.