T09 · Insecure Skill Coding Practices
- Location
ghostshield/obfuscator.py:177- Finding
PII Sanitization Fails Because File Paths and Match Offsets Are Inconsistent
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
GhostShield is a privacy/protection tool, but its implementation can silently leave secrets in output, copy files outside the chosen repository through symlinks, and persist hidden watermarks in generated code.
Install only after reviewing the code and use it on disposable copies of repositories. Do not rely on it as a sanitizer for secrets, do not process untrusted repositories with symlinks, avoid custom watermark IDs, and inspect generated output before publishing or running it.
ghostshield/obfuscator.py:177PII Sanitization Fails Because File Paths and Match Offsets Are Inconsistent
ghostshield/obfuscator.py:80Repository Copy Dereferences Symbolic Links and Can Export Files Outside the Input Tree
ghostshield/obfuscator.py:294Unvalidated Watermark Identifier Allows Python Source Injection
ghostshield/obfuscator.py:120Silent Exception Handling Causes Security Transformations to Fail Open
The watermark example contains invisible Unicode characters after the visible token, which can act as hidden instructions, covert markers, or steganographic content. In a skill centered on watermarking and obfuscation, this is more concerning because it normalizes embedding non-obvious data into code/comments, which can mislead reviewers, poison downstream processing, or bypass simplistic filters.
# Author: [email-removed]
# Watermark: GS-20260404230500
# Note: Alternative approach considered
def get_user_data(user_id):
The skill claims a three-level obfuscation system, but findings indicate it also performs style fingerprinting, similarity comparison, and Git commit analysis while apparently not fully implementing the advertised protections. A tool that extracts fingerprints while overstating protective features can invert user expectations and increase privacy risk rather than reduce it.
The skill claims a three-level obfuscation system, but findings indicate it also performs style fingerprinting, similarity comparison, and Git commit analysis while apparently not fully implementing the advertised protections. A tool that extracts fingerprints while overstating protective features can invert user expectations and increase privacy risk rather than reduce it.
The skill claims a three-level obfuscation system, but findings indicate it also performs style fingerprinting, similarity comparison, and Git commit analysis while apparently not fully implementing the advertised protections. A tool that extracts fingerprints while overstating protective features can invert user expectations and increase privacy risk rather than reduce it.
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
},
"github_token": {
"pattern": r'ghp_[a-zA-Z0-9]{36}',
"description": "GitHub Personal Access Token",
},
}
This module performs broad sensitive-data discovery and local identity harvesting functions that do not align with the stated purpose of code-style obfuscation against distillation. That mismatch increases the risk that the skill collects emails, names, tokens, internal URLs, and other secrets from a user's workspace without a clear, necessity-bound reason.
Extracting all Git commit authors via git log collects contributor identities and emails across the repository history, which exceeds what is reasonably needed for code-style protection. In the context of a 'ghostshield' obfuscation skill, this looks like unnecessary local identity enumeration and increases privacy and insider-profiling risk.
The skill claims to protect against style distillation, but this file actually profiles a user's code, documentation, and commit habits and generates a persistent style fingerprint. In skill context, that is dangerous because it enables attribution, behavioral tracking, and privacy-invasive analysis that is opposite to the advertised shielding purpose, making user consent and expectation mismatch especially severe.
The markdown shows ghostshield process producing a rewritten repository, including Level 2/3 behaviors such as renaming, timestamp shifts, noise injection, and contradictory decision comments. Because these operations alter user files and may affect correctness or maintainability, the skill description should explicitly warn users to review outputs and avoid using transformed code blindly.
The skill advertises CLI-style processing over repositories and examples imply file reads, file writes, and shell/Git invocation, but it declares no explicit tool scope or permissions. This increases the chance an agent executes broader filesystem or shell actions than a user expects, especially when operating on entire repositories and Git metadata.
The markdown promotes repository-wide transformation, watermark insertion, and export workflows without a clear warning that source files may be modified and behavior may change. In this context, silent or poorly signposted mutation is risky because users may run it on production code, commit hidden markers, or degrade functionality across an entire repository.
This code's natural-language interface is consistently presented in Chinese, including the CLI description, help text, status messages, and reports. Because the skill does not offer any language/locale opt-in or indicate that it is intentionally limited to a Chinese-speaking context, it violates the policy against forcing a specific language without user choice.
This Python file contains natural-language documentation and usage text entirely in Chinese, with no indication that the skill supports other languages or that Chinese is a region-specific requirement. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation.
The natural-language descriptions, docstrings, and usage explanations are presented in Chinese only, which effectively forces a specific language for operators or maintainers of the skill. The file does not offer a language choice, opt-in, or documented justification for this locale restriction.
The code copies an input tree and then silently overwrites or appends to many files during processing without any confirmation, dry-run mode, backup, or per-file disclosure. In a tool explicitly designed to conceal stylistic signals, broad silent mutation increases the risk of unreviewed destructive changes, hidden watermarking, and unintended corruption of source or documentation.
This skill includes Git history inspection and purported rewrite-oriented obfuscation features that go beyond simple file/style sanitization. In context, rewriting or staging metadata obfuscation can destroy provenance, hinder audits, and facilitate anti-forensics or policy evasion, especially because the feature is framed as concealment rather than ordinary privacy protection.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
try:
# 获取所有作者
import subprocess
result = subprocess.run(
["git", "log", "--format=%an", "--all"],
cwd=input_path,
capture_output=True,
The reference-style injection capability is not necessary for defensive PII sanitization and instead enables deliberate imitation or contamination of another project's coding style. In context, that can be used to misattribute authorship, poison forensic signals, or mask origin, making the skill materially more dangerous than its stated protective purpose suggests.
This code file contains natural-language descriptions such as the module docstring that are exclusively in Chinese. Per the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale constraint is explicitly justified, which is not present here.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
try:
# 获取所有提交作者
result = subprocess.run(
["git", "log", "--format=%an <%ae>", "--all"],
cwd=repo_path,
capture_output=True,
Scanning .git/config specifically for user name and email gathers local identity information unrelated to the advertised anti-distillation function. Even if done locally, this creates unnecessary privacy exposure and can be combined with other collected data to profile the user or repository contributors.
Natural-language descriptions and docstrings in this file are consistently written in Chinese, with no indication that users may choose another language or locale. Under the language/locale policy, forcing a specific language without opt-in is a policy concern unless the constraint is explicitly justified.
The file inspects Git commit history, extracting prefixes, keywords, message lengths, and emoji usage, which can reveal personal work patterns and author-identifying traits. That capability is not necessary for a code-style protection tool, so in this context it increases privacy risk and expands the collected behavioral fingerprint beyond what users would reasonably expect.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
try:
# 获取 commit messages
cmd_result = subprocess.run(
["git", "log", "--format=%s", "--all", "-n", "500"],
cwd=repo_path,
capture_output=True,
The code reads up to 500 commit subjects from the repository without any visible disclosure, prompt, or permission boundary. In a tool marketed as defensive style shielding, silent collection of commit-history signals is particularly risky because users are unlikely to expect that their development history is being mined for stylistic profiling.