T09 · Insecure Skill Coding Practices
- Location
scripts/wa_llm.py:139- Finding
Wolfram AppID Exposure Through Query-Authentication Error Logging
- Content
View full analysis
Vulnerability Details
File Location:
scripts/wa_llm.py, lines 139–143 and 167–170
Vulnerability Type: Credential disclosure through sensitive URL logging
Risk Level: MediumVulnerable Code
python # Auth authorization: Optional[str] = None if args.auth == "query": params.insert(0, ("appid", appid)) else: authorization = f"Bearer {appid}" url = build_url(params)python # Non-2xx => signal failure for scripting. exit_code = 0 if status >= 400: print(f"\n\n[wa_llm] HTTP {status} for URL: {url}", file=sys.stderr) exit_code = 1Technical Analysis
When the user selects
--auth query, the Wolfram AppID is inserted into the URL as theappidquery parameter. If the API returns an HTTP error, the complete URL is printed to standard error without redaction.Although bearer authentication is the default, query authentication is an explicitly supported mode. Standard error is commonly captured by CI systems, agent execution transcripts, shell redirection, centralized logging systems, and monitoring tools. Consequently, an API error can cause the credential to be retained in systems with a broader readership and a longer retention period than the original process environment.
TLS protects the request in transit, but it does not prevent disclosure through local or centralized logs generated by this code.
Attack Path
- A user or automation process invokes the wrapper with
--auth query. - The script reads
WOLFRAM_APP_IDand embeds it in the request URL. - An HTTP failure is triggered, such as by supplying invalid parameters, using an invalid or quota-exhausted AppID, or receiving a service-side error.
- The script writes the full URL, including the
appidvalue, to standard error. - Standard error is captured in an agent transcript, CI log, terminal history capture, or centralized logging service.
- An individual with access to those log ...[truncated 533 chars]
- A user or automation process invokes the wrapper with
- Remediation
View remediation
Remediation Suggestions
- Never log a URL that may contain credentials. Log only the HTTP status, hostname, and path.
- Redact sensitive query parameters before logging. At minimum, replace the value of
appidwith[REDACTED]. - Preferably remove
--auth queryand exclusively use theAuthorizationheader. - If query authentication must remain for compatibility, construct a separately sanitized diagnostic URL rather than printing the request URL.
- Add automated tests that verify the AppID never appears in stdout, stderr, exceptions, or cached data.
A safer error message would be:
python if status >= 400: print( f"\n\n[wa_llm] HTTP {status} from Wolfram|Alpha LLM API", file=sys.stderr, ) exit_code = 1
