T09 · Insecure Skill Coding Practices
- Location
scripts/generate_auth_token.py:27- Finding
Reversible API Credentials Exposed Through Process Arguments and Standard Output
- Content
View full analysis
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: MediumVulnerable 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_secretto standard output. Base64 is an encoding mechanism, not encryption; the resulting Basic-auth token can be decoded trivially or reused directly in an HTTPAuthorizationheader.Supplying the secret through
sys.argvcan 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.mddocuments 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.pyis 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
- A user or Age ...[truncated 1485 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove the helper's printing of the complete Basic-auth token. Authentication headers should be constructed and used internally by the API client.
- Do not accept
app_secretthrough ordinary command-line arguments. Read it from an interactivegetpass.getpass()prompt, a protected secret manager, or a narrowly scoped environment-based secret injection mechanism. - 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.
- Redact Authorization headers, application secrets, and generated tokens from exceptions, debug logs, telemetry, and Agent responses.
- Update
SKILL.mdso its quick-start instructions use a non-echoing credential flow and accurately describe every location where credentials may be exposed. - Rotate any application credentials previously processed in environments where command history or stdout may have been retained.
- Where supported by the provider, apply least-privilege scopes, usage limits, expiration, and credential rotation to reduce the impact of future disclosure.
