T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/generate_auth_token.py:27
- Finding
- Reversible API Credentials Exposed Through Process Arguments and Standard Output## Vulnerability Details **File Location**: `scripts/generate_auth_token.py`, lines 27–28 and 38–42 **Vulnerability Type**: Credential exposure through command-line arguments and stdout **Risk Level**: Medium **Vulnerable Code**: ```python credentials = f"{app_key}:{app_secret}" access_token = base64.b64encode(credentials.encode()).decode() ``` ```python app_key = sys.argv[1] app_secret = sys.argv[2] token = generate_access_token(app_key, app_secret) print(f"Access Token: {token}") print(f"\nUse in Authorization header as: Basic {token}") ``` ### Technical Analysis The helper accepts the application secret as a command-line argument and prints a Base64 representation of `app_key:app_secret` to standard output. Base64 is an encoding mechanism, not encryption; the resulting Basic-auth token can be decoded trivially or reused directly in an HTTP `Authorization` header. Supplying the secret through `sys.argv` can expose it through shell history, process inspection, command logging, automation logs, or Agent execution records. Printing the generated token creates an additional disclosure channel because stdout may be retained by terminals, CI systems, orchestration platforms, or Agent transcripts. This behavior is especially significant because `SKILL.md` documents use of this helper while also stating that credentials remain only in process memory. Process arguments and printed output can leave externally observable or persistent records, so the implementation does not fully satisfy that claim. The equivalent Base64 construction in `scripts/tomoviee_img2img_client.py` is not independently considered a vulnerability: that client uses the token internally in the required Basic-auth header and sends it only to the declared HTTPS API host. The confirmed issue is the helper's explicit exposure of the secret-derived token and its collection of the secret through command-line arguments. ### Attack Path 1. A user or Age ...[truncated 1485 chars]
- Remediation
- ## Remediation Suggestions 1. Remove the helper's printing of the complete Basic-auth token. Authentication headers should be constructed and used internally by the API client. 2. Do not accept `app_secret` through ordinary command-line arguments. Read it from an interactive `getpass.getpass()` prompt, a protected secret manager, or a narrowly scoped environment-based secret injection mechanism. 3. If an environment variable is supported, document that it must not be committed, echoed, or included in diagnostic output. Prefer a platform secret store for automated deployments. 4. Redact Authorization headers, application secrets, and generated tokens from exceptions, debug logs, telemetry, and Agent responses. 5. Update `SKILL.md` so its quick-start instructions use a non-echoing credential flow and accurately describe every location where credentials may be exposed. 6. Rotate any application credentials previously processed in environments where command history or stdout may have been retained. 7. Where supported by the provider, apply least-privilege scopes, usage limits, expiration, and credential rotation to reduce the impact of future disclosure.
