T09 · Insecure Skill Coding Practices
- Location
scripts/batch_generate.py:23- Finding
Arbitrary File Overwrite Through Unvalidated Batch Filenames
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is a coherent QR/barcode toolkit, but its batch generator can write outside the chosen output folder and its logging can expose sensitive QR contents such as WiFi passwords.
Review this skill before installing. Use it only in a dedicated working directory, avoid untrusted batch CSV/JSON files, do not run batch generation with privileged filesystem access, and assume terminal logs may contain QR payload data until logging is changed. Pin and review dependencies before using it in CI or sensitive environments.
scripts/batch_generate.py:23Arbitrary File Overwrite Through Unvalidated Batch Filenames
scripts/generate_qr.py:43WiFi Credentials Disclosed Through Standard Output
requirements.txt:1Unpinned Dependencies Permit Unreviewed Package Updates
The supplied code chunk is limited to recognition/decoding functionality. It reads image files, decodes QR codes or barcodes using pyzbar, supports batch processing over a directory, and can save batch decode results to JSON. The declared description, however, presents the skill as an all-in-one toolkit covering generation, beautification, and multiple creation scenarios such as WiFi, contact cards, payments, and barcode generation. Those capabilities are not present in this code chunk. While batch recognition is consistent with the description, the broader declared purpose materially overstates the implemented functionality in this code sample.
The declared description presents a comprehensive QR/barcode toolkit, but the supplied code chunk only performs single QR code generation. It does support limited customization via colors and sizing, which partially aligns with '美化' and generation claims, but it does not implement scanning/decoding, barcode support, batch operations, payment/WiFi/contact-specific helpers, or advanced beautification like logo embedding. The code’s actual scope is materially narrower than the declared purpose, so this is a description-behavior mismatch.
The skill advertises scripts that read input files and write output images/results, but the manifest does not declare any tool scope or allowed-tools boundaries. Missing capability declarations weaken least-privilege controls and make it harder for reviewers and runtime policy to constrain filesystem access appropriately.
This code writes a QR image containing the WiFi SSID and password to disk via the output path, but the only nearby user-facing message prints the SSID and security type. There is no confirmation prompt or warning in the docstring/comments that the generated file contains reusable network credentials and should be handled carefully.
The documentation promotes camera-based QR scanning without warning that live camera input may capture sensitive surroundings, documents, or bystanders. In a user-facing skill, omission of privacy guidance can lead to unintentional exposure of personal or confidential information during use.
The skill advertises bulk generation/recognition and export workflows but does not warn that many user files may be read from and written to disk at once. This increases the chance of accidental processing of sensitive datasets, overwriting files, or broad data exposure if users misunderstand the scope of operation.
The dependency is specified with a lower bound only, so builds may resolve to different versions over time. That weakens reproducibility and makes it harder to verify whether a deployed version includes a vulnerable release or an unexpected breaking change from the package index or lock resolution process.
qrcode>=7.4.2
pillow>=10.0.0
opencv-python>=4.8.0
pyzbar>=0.1.9
Pillow is declared as ">=10.0.0" rather than an exact version, which allows any newer release to be installed. For an image-processing skill, this increases supply-chain and patch-verification risk because the exact code being run is not fixed or auditable from this manifest alone.
qrcode>=7.4.2
pillow>=10.0.0
opencv-python>=4.8.0
pyzbar>=0.1.9
python-barcode>=0.15.1
Pillow has multiple historical advisories, and because the manifest does not pin a specific version, it is impossible to verify from this file alone whether the installed release is safe. In this skill, Pillow processes attacker-controlled image content, which makes unverifiable patch status more concerning than in a non-parser dependency.
OpenCV is a large native-code dependency and using an unpinned ">=" constraint means the installed version can vary between environments or over time. That makes builds non-reproducible and complicates assurance that vulnerable or unstable releases are excluded.
qrcode>=7.4.2
pillow>=10.0.0
opencv-python>=4.8.0
pyzbar>=0.1.9
python-barcode>=0.15.1
numpy>=1.24.0
opencv-python has many published advisories and is commonly used to parse complex image data. Since the manifest allows any version at or above a minimum, the actual installed build may still be vulnerable or otherwise unreviewed, and this cannot be determined statically from the file.
pyzbar is also unpinned, so dependency resolution may select different releases across installations. This creates avoidable supply-chain uncertainty and makes vulnerability triage harder because the manifest does not identify the exact package version in use.
qrcode>=7.4.2
pillow>=10.0.0
opencv-python>=4.8.0
pyzbar>=0.1.9
python-barcode>=0.15.1
numpy>=1.24.0
python-barcode is not pinned to a single version, which reduces reproducibility and weakens confidence that only reviewed code will be installed. While not an immediate exploit by itself, it is a real supply-chain hygiene issue.
pillow>=10.0.0
opencv-python>=4.8.0
pyzbar>=0.1.9
python-barcode>=0.15.1
numpy>=1.24.0
NumPy is a widely used package with native components, and an unpinned version range means different environments may receive different code. This makes it difficult to confirm whether deployed instances are patched and increases exposure to dependency-related regressions or advisories.
opencv-python>=4.8.0
pyzbar>=0.1.9
python-barcode>=0.15.1
numpy>=1.24.0
NumPy has known advisories, and the unpinned requirement prevents verification that deployed versions are outside affected ranges. Although NumPy may be less directly exposed than the image decoders, it is still part of the processing pipeline and should be version-controlled for security assurance.
The module docstring uses a Chinese-only description ('二维码/条形码识别器'), which is a natural-language locale choice embedded in the skill without offering any language option or documenting a region-specific requirement. Under the policy rules, forcing a specific language without opt-in is a locale-policy violation.
The module docstring describes the tool in Chinese only: "条形码生成器 - 支持 EAN/UPC/Code128/Code39". This is a natural-language locale choice embedded in the file without any indication that users can opt into another language, which fits the language/locale policy violation category.
This code file contains user-facing natural language in Chinese ("基础二维码生成器") without any indication that the skill is region-specific or that language is user-selectable. Per the policy, forcing a specific language without opt-in can be a locale-policy violation even when it appears in code comments or docstrings.
The file-level description uses Chinese ('vCard 名片二维码生成器') while the skill provides no indication that language selection is configurable or user-driven. This can violate a language/locale policy when a skill implicitly fixes output or documentation to a specific language without opt-in.
The natural-language description on L04 is written exclusively in Chinese, which can impose a specific language on users without any visible opt-in or indication that the tool is intended only for a Chinese-speaking context. This matches the policy category for language or locale constraints expressed in natural language.