T09 · Insecure Skill Coding Practices
- Location
scripts/security_scan.py:18- Finding
Dangerous-Code Scanner Can Be Bypassed Through Import Aliases and Indirect Calls
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is a disclosed skill-builder workflow, but it can run generated Python, write a local registry, and optionally push to GitHub using environment credentials without clear confirmation gates.
Review before installing. Use this only in a workspace where you are comfortable with generated files being written, do not expose broad GitHub tokens in the environment, and treat generated tests as untrusted code unless you run them in a real sandbox or container. Require an explicit confirmation step before registry writes or GitHub sync.
scripts/security_scan.py:18Dangerous-Code Scanner Can Be Bypassed Through Import Aliases and Indirect Calls
SKILL.md:97Generated Test Code Is Executed Without Security Scanning or Effective Sandboxing
scripts/security_scan.py:25Permission Validation Parses the Documented YAML Metadata as JSON and Reads the Wrong Field
The declared description promises a full-featured Skill generation/governance system with broad transformation capabilities, workflow enforcement, file generation, compatibility handling, and security checks. The supplied code instead only generates a candidate skill identifier and ensures it does not collide with entries in a local registry JSON file. While this could be a supporting helper inside a larger system, the code chunk by itself does not substantively implement the declared primary purpose. Therefore the description materially overstates what this code actually does.
The declared description presents a comprehensive skill-construction and governance system whose primary function is to transform arbitrary inputs into a standardized Skill package and validate it through a 5-layer process. The supplied code chunk does not do that transformation or packaging. It is a standalone security scanner focused on static checks over an existing Python implementation file and an optional adjacent skill.yaml. While this scanner loosely aligns with the 'security scan' portion of the declared purpose, it represents only a small subset of the claimed functionality and not the primary advertised behavior. Therefore the description materially overstates and misrepresents what this specific code chunk actually does.
The declared description presents a broad skill-generation and governance system whose primary function is to convert arbitrary resources into standardized, dependency-free Skills and produce multiple output artifacts under a structured workflow. The supplied code chunk does not do that. It only validates one implementation file with simple static checks and emits a JSON result. While validation could be a supporting part of a larger governance pipeline, this chunk’s actual primary behavior is much narrower and materially different from the declared end-to-end generation/governance purpose. Therefore this is a description-behavior mismatch.
The trigger conditions are extremely broad, covering nearly any request related to creating tools, functions, registries, or wrapping code. Overbroad activation materially increases risk because the skill includes guidance for file generation, command execution, secret access, and optional network sync, so it may be loaded in situations far outside its safe intended scope.
The skill explicitly instructs use of a GitHub Personal Access Token via environment variable. In the context of a broadly triggered agent skill with optional network write capability, credential access is security-relevant because it enables authenticated external modifications and creates a path for secret misuse or exfiltration if the workflow is subverted.
### Step 6: GitHub 同步(可选)
检测环境变量:
- `GITHUB_TOKEN`: GitHub Personal Access Token
- `GITHUB_REPO`: 格式 `owner/repo`
若缺失:输出 `[CONFIG REQUIRED]` 提示,继续本地注册。
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
## GitHub 同步(可选)
环境变量:
- `GITHUB_TOKEN`: GitHub Personal Access Token
- `GITHUB_REPO`: 格式 `owner/repo`
使用 urllib.request + json + os + base64 实现,零第三方依赖。
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
## GitHub 同步(可选)
环境变量:
- `GITHUB_TOKEN`: GitHub Personal Access Token
- `GITHUB_REPO`: 格式 `owner/repo`
使用 urllib.request + json + os + base64 实现,零第三方依赖。
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
## L5: 输出与信息泄露检测
- 禁止直接返回 `traceback.format_exc()` 或 `sys.exc_info()`
- 禁止返回 `os.environ`, `open('/etc/passwd').read()`, 密钥变量
- 修复:统一错误格式 `{'s':'err','e':'internal_error'}`,敏感信息脱敏
## 阻断行为
This markdown file contains user-facing operational instructions only in Chinese, including the authorization and publishing steps. Under the policy rule for language or locale constraints, forcing a specific language without user opt-in is a natural-language policy violation unless the locale limitation is explicitly documented and justified.
The skill describes capabilities involving environment variable access, network operations, and shell execution (python ..., cd ... && python ...) without an explicit permission boundary in the skill’s declared scope. In an agent setting, missing or implicit capability scoping can cause the skill to be invoked with broader privileges than users or orchestrators expect, increasing the chance of credential exposure or unintended command execution.
The skill markets itself as producing 'zero external dependency' artifacts while its workflow includes optional GitHub synchronization using network access and environment-provided tokens. This inconsistency can mislead operators into assuming the workflow is fully local and low-risk, when it may actually transmit artifacts externally and touch credentials.
The natural-language description is written as an instruction set in Chinese and presents the workflow as the default operating mode, without offering a language choice or stating that the skill is intentionally limited to Chinese-speaking users. This creates a locale/language policy concern because it implies a fixed language experience without explicit user opt-in.
The documented ability to push generated files to a GitHub repository broadens the skill from local transformation/governance into repository modification. In an agent environment, write access to external repositories can be abused for unauthorized content changes, data leakage, or supply-chain tampering if the skill is triggered too broadly or without explicit approval.
Mandating removal of docstrings and comments reduces transparency around behavior, inputs, side effects, and security assumptions in generated skills. In a skill-builder context, this is more dangerous because it systematically produces opaque code artifacts that are harder to review, audit, and govern at scale, allowing risky behavior to be concealed more easily.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
curl -X POST http://agent-cluster/skill/{skill-id} \
-H "Content-Type: application/json" \
-H "X-Skill-Version: {version}" \
-d '{"x": "input"}'
The entire skill document is written in Chinese and does not indicate that other languages are supported or that the user can opt into this locale. Under the stated policy, forcing a specific language without user choice is a natural-language policy violation.
The file is written entirely in Chinese and presents the security rules as mandatory instructions, with no indication that users may choose another language or locale. Under the stated policy, forcing a specific language without opt-in is a natural-language policy violation.
The spec explicitly directs the skill to write generated artifacts into a local registry and optionally push them to a GitHub repository, but it does not require explicit user confirmation, dry-run mode, or a visible warning before modifying files or transmitting data remotely. In an agent context, this can cause unintended persistence or exfiltration of generated content, especially when upstream resources may contain sensitive data.
compile() creates code objects from strings. When combined with exec()/eval(), it enables obfuscated code execution.
try:
with open(p)as f:c=f.read()
except Exception as e:r['d'].append(f'read_err: {e}');return r
try:compile(c,'<impl>','exec');r['syntax']=1
except SyntaxError as e:r['d'].append(f'syntax: {e}')
if'def run('in c:r['run_sig']=1
else:r['d'].append('missing_run')
Reading environment variables for GitHub credentials introduces credential access into a skill whose primary role is described as generation/governance. Even if common in CI workflows, this increases the blast radius of accidental invocation and makes the skill more dangerous in contexts where secrets are automatically injected.
The code template at L051 imports a large set of modules such as urllib.request, http.client, socket, and ssl, while the documented token-compression rule at L070 explicitly says imports should retain only actually used modules. In the shown implementation, run() only echoes input and uses sys/json, so the documentation and template behavior are in direct conflict.
The spec documents use of sensitive environment variables, including a GitHub personal access token, without requiring any warning, secret-handling guidance, or restrictions on logging and exposure. In an automated skill-generation workflow, this increases the chance that credentials are used implicitly or surfaced in generated code, debug output, or remote requests without informed consent.
Detected: suspicious.dynamic_code_execution