Back to skill

Security audit

json-tidy

Security checks for vulnerabilities and agentic risk

Overview

The skill is a small JSON formatter, but its documentation claims dry-run safeguards that the script does not implement, so using an output file can overwrite data unexpectedly.

Review before installing. The runtime script is simple and does not show exfiltration or persistence, but do not rely on the documented --apply safeguard: using --out can overwrite an existing file immediately. Prefer copying output to stdout or testing on disposable files, and avoid the unpinned npx install command unless you trust the resolved CLI version.

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)

T08 · Insecure Dependencies

Warning
Location
SKILL.md:75
Finding
Unpinned npm Package Execution in Installation Instructions## Vulnerability Details **File Location**: `SKILL.md:75` **Vulnerability Type**: Supply-chain exposure through unpinned package execution **Risk Level**: Medium **Vulnerable Code Snippet**: ```bash npx skills add zhaoxinghua09-cell/agent-skills -g ``` ### Technical Analysis The installation instructions invoke the `skills` npm package through `npx` without specifying an exact package version or integrity value. If the package is not already installed locally, `npx` may retrieve and execute it from the configured npm registry. Because package resolution is not pinned to an audited release, the code executed by this command can change after the skill itself has been reviewed. A compromised maintainer account, registry package, dependency, or unexpectedly changed future release could therefore introduce arbitrary installation-time behavior. The repository identifier passed to the command does not mitigate the risk associated with executing the unpinned `skills` package itself. ### Attack Path 1. An attacker compromises the npm package, its maintainer account, or one of its install-time dependencies. 2. The attacker publishes a malicious version under the package name resolved by `npx skills`. 3. A user follows the documented installation command. 4. `npx` downloads and runs the currently resolved package version. 5. Malicious package code executes with the privileges of the invoking user before or during skill installation. ### Impact Assessment Successful exploitation could execute arbitrary code with the invoking user's privileges. Depending on those privileges and the malicious package behavior, the affected scope could include user files, environment variables, credentials available to the process, development configuration, and globally installed skill files. The command does not itself request administrative privileges, so impact is normally limited to the invoking account unless it is run from an elevated shell.
Remediation
## Remediation Suggestions - Pin the installation CLI to a specifically reviewed version instead of resolving the latest available release. - Where supported, verify package integrity using a lockfile, checksum, signature, or package-manager integrity metadata. - Prefer a two-step process that installs a pinned CLI version and then invokes it, making the executed dependency explicit. - Alternatively, document installation from the source repository at a pinned commit hash and instruct users to verify the commit before installation. - Avoid recommending execution from an elevated shell. - Periodically review and update the pinned version through a controlled dependency-update process.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/json_tidy.py:24
Finding
Output File Is Overwritten Without the Documented Apply Safeguard## Vulnerability Details **File Location**: `scripts/json_tidy.py:24-26`; related claims at `SKILL.md:52` and `README.md:5` **Vulnerability Type**: Unsafe file overwrite and misleading safety control **Risk Level**: Medium **Vulnerable Code Snippet**: ```python if a.out: open(a.out, "w", encoding="utf-8").write(out) print("Output written") ``` The final display line above is normalized to English for reporting; the security-relevant file operation is the exact `open(a.out, "w", encoding="utf-8").write(out)` behavior found in the source. The documented safety expectation states that disk-writing operations are previews by default and require `--apply` to execute. However, the argument parser only defines the output destination: ```python ap.add_argument("--out", help="Output file") ``` No `--apply` argument or equivalent confirmation control is implemented. ### Technical Analysis Opening a path with Python mode `"w"` immediately creates the file if it does not exist or truncates it if it already exists. Consequently, supplying `--out` performs a destructive write without preview, confirmation, backup, exclusive creation, or atomic replacement. This contradicts the documented dry-run boundary. Users and automated agents may reasonably rely on that documentation and provide an existing destination while expecting only a preview. The program instead replaces the destination immediately. The destination is directly selected by the caller. There is no path traversal across a server-side trust boundary in this standalone CLI, and the operation does not elevate privileges. Nevertheless, any writable file accessible to the invoking account can be replaced with formatted JSON. ### Attack Path 1. A user or agent reads the documentation and expects file-writing operations to remain in dry-run mode unless `--apply` is supplied. 2. The caller invokes the utility with `--out` pointing to an existing writable file. ...[truncated 992 chars]
Remediation
## Remediation Suggestions - Implement the documented `--apply` option and ensure that `--out` only previews the intended destination unless `--apply` is explicitly present. - Refuse to replace an existing destination by default. Require a separate explicit option such as `--force` for overwrites. - Use exclusive creation mode when creating new files if replacement is not requested. - Write output to a temporary file in the same directory, flush and synchronize it as appropriate, and atomically replace the destination only after successful serialization. - Preserve file permissions where replacement is intended and create a backup when operating on important existing files. - Use context managers so file handles are reliably closed: ```python with open(destination, "w", encoding="utf-8") as output_file: output_file.write(out) ``` - If dry-run behavior will not be implemented, remove the dry-run and `--apply` claims from all documentation and clearly state that `--out` immediately overwrites an existing file. - Add automated tests confirming that existing files remain unchanged without explicit overwrite authorization.
Vulnerability Patterns
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (9)

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
This markdown file contains user-facing natural language primarily in Chinese, including key attestation and safety statements, but does not offer an English alternative or user opt-in for the language. That can violate language/locale policy when a skill forces a specific language presentation without giving the user a choice.

Vague Triggers

Medium
Confidence
87% confidence
Finding
The phrase "One command for daily file/text chores" is very broad and overlaps with many common user requests, without clearly constraining when this skill should be invoked versus other file or text utilities. The README does not provide specific trigger phrases, scope boundaries, or negative examples to prevent unintended activation.

Lp3

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding
The skill advertises operational behavior that may write files, but it does not declare any explicit tool scope or permissions boundary. In an agent ecosystem, this mismatch can cause the agent or user to trust the skill as low-risk while it can invoke file-modifying behavior, increasing the chance of unintended workspace changes.

Description-Behavior Mismatch

Medium
Confidence
91% confidence
Finding
The documentation claims write operations exist and are dry-run by default, but the skill is presented as a JSON formatter/minifier/sorter and does not establish file-modifying scope. This inconsistency is dangerous because it obscures the real behavior of the skill and can mislead users or agents into approving actions they did not expect.

Intent-Code Divergence

Medium
Confidence
95% confidence
Finding
References to unrelated tools such as `text-replace/dup-finder` and backup/write behavior indicate copy-pasted or misleading documentation that does not match the stated JSON-tidy purpose. In security-sensitive agent workflows, such inconsistencies reduce auditability and may hide broader capabilities than the skill title suggests.

Rp1

Medium
Category
MCP Rug Pull
Confidence
76% confidence
Finding
The installation instructions reference `npx skills` without a pinned version, which creates a supply-chain risk because different code may be fetched and executed over time. An attacker who compromises the package or a dependency path could cause users to run unexpected code during installation.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
This code's natural-language interface is presented in Chinese in the argument parser description and help text, which imposes a specific language on users without offering an opt-in or alternative. The policy explicitly flags language or locale constraints when they are forced and not justified as region-specific.

Intent-Code Divergence

Low
Confidence
92% confidence
Finding
The manifest context and Chinese README text describe a focused JSON formatter/minifier/key-sorting utility, but the English line broadens the tool into a generic file/text chore command. This is not merely incomplete wording; it materially changes the apparent intent and scope presented to users.

Natural-Language Policy Violations

Low
Confidence
92% confidence
Finding
The manifest-facing fields and the body content present the skill in Chinese, including the primary display name, title, description, and usage text, while only a secondary English display name is provided. This can violate a language/locale policy when users are not given an explicit opt-in or choice of language.

Static analysis

No suspicious patterns detected.