T09 · Insecure Skill Coding Practices
- Location
scripts/jwt_token.py:32- Finding
Hardcoded Reusable API Credentials
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill performs its stated IQC conversion and submission workflow, but it embeds reusable credentials and sends/stores tokens and business data insecurely.
Review carefully before installing. Only use this in a controlled internal environment after rotating the exposed password, replacing hardcoded credentials with managed secrets, enforcing HTTPS, confirming the destination API is intended, restricting token file permissions, and deciding how long logs and run outputs should be retained.
scripts/jwt_token.py:32Hardcoded Reusable API Credentials
scripts/jwt_token.py:116Credentials, Bearer Tokens, and IQC Records Transmitted over Plaintext HTTP
scripts/jwt_token.py:160JWT Bearer Tokens Stored in Plaintext Files Without Explicit Access Restrictions
scripts/jwt_token.py:7Unpinned Third-Party Runtime Dependencies
The script sends a username and password to an HTTP endpoint at a private IP address, which provides no transport-layer confidentiality or integrity. Anyone with network visibility or man-in-the-middle capability on that network can intercept credentials and the returned JWT, then reuse them to authenticate as the user.
The username and password are hardcoded directly in the script, making credential exposure likely through source control, backups, logs, screenshots, and accidental sharing. Because the same credentials are then used for authentication, compromise of the codebase or artifact is equivalent to compromise of the account.
The workflow hardcodes a JWT secret key directly in the manifest while presenting the step as a security/authentication layer. A static embedded secret is easily disclosed through source access, logs, backups, or package distribution, allowing forged tokens and undermining the trust model of any downstream submission step.
The manifest includes a JWT generation step and a final data submission step, but the description does not warn users that authentication material is used and data may be transmitted outward. This lack of disclosure can cause users to run the skill without understanding that it may create tokens and submit processed enterprise data to another system.
The skill explicitly enables persistent logging, checkpoint saving, and output file retention but does not warn users that operational data may be written to disk. In a workflow that processes enterprise Excel/CSV/JSON data, this can expose sensitive business information through logs, saved intermediates, or retained artifacts beyond the user's expectations.
The docstring states that paths are determined solely by script-internal configuration, implying fixed configured locations. However, main() loads a run ID from current_run_id.txt and derives per-run INPUT_JSON_DIR_CONFIG and TOKEN_FILE_CONFIG dynamically, so the effective file paths are not solely the static configured ones described in the documentation.
The script transmits JSON payloads and a Bearer JWT to an HTTP endpoint using cleartext transport, which exposes both sensitive business data and authentication tokens to interception or modification by anyone on the network path. In an industrial data submission context, this materially increases the risk of credential theft, replay, tampering, and unauthorized API actions.
}
logging.info(f"发送 {len(parts)} 条记录 → {url}")
try:
resp = requests.post(url, json=parts, headers=headers, timeout=timeout)
resp.raise_for_status()
result = resp.json()
state = result.get("httpstate")
The script writes the JWT to output/jwt_token.txt and also caches it in token_cache without any access-control checks, encryption, or permission hardening. A local user, another process, or a later workflow step with filesystem access can read and reuse the bearer token until it expires.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
headers = {"Content-Type": "application/json; charset=utf-8"}
logging.info(f"请求登录接口: {url}")
resp = requests.post(url, json=payload, headers=headers, timeout=timeout)
# 先尝试解析响应体,以便在 raise_for_status 前记录服务端错误信息
try:
This code file contains natural-language strings exclusively in Chinese in the module docstring, CLI description, argument help, errors, and logs. Under the policy, forcing a specific language without user opt-in is a locale/language policy violation unless the constraint is explicitly justified, which is not present here.
The natural-language description and operational commentary are entirely in Chinese, with no indication that users may choose another language or that the skill is intentionally restricted to a Chinese-speaking or region-specific context. Per SQP-3, forcing a specific language without opt-in can violate language/locale policy expectations.
This file includes its module docstring, CLI description, help text, and runtime messages only in Chinese. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale constraint is explicitly justified.