T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/amazon_buy_box_offers_scraper_api.py:100
- Finding
- API Key Solicitation Through Insecure Conversational Channels< to get your Key." ``` `scripts/amazon_buy_box_offers_scraper_api.py:100-107`: ```python api_key = os.getenv("BROWSERACT_API_KEY") if not api_key: print("\n[!] ERROR: BrowserAct API Key is missing.", flush=True) print("Please follow these steps:", flush=True) print(f"1. Go to: {API_KEY_URL}", flush=True) print("2. Copy your API Key.", flush=True) print("3. Provide it to me or set it as an environment variable (BROWSERACT_API_KEY).", flush=True) sys.exit(1) ``` ### Technical Analysis The Skill explicitly instructs the Agent to ask the user to provide a BrowserAct API key and the script repeats that the key may be provided “to me.” This encourages users to disclose a reusable bearer credential through the conversational interface. Credentials submitted through chat may be retained in conversation history, Agent execution records, telemetry, debugging output, or other logging systems. This violates secure secret-handling principles because the key does not need to enter the conversational context for the declared scraping operation. The script already supports reading the key from the `BROWSERACT_API_KEY` environment variable, which is the appropriate minimum-privilege mechanism. The actual API calls send the bearer credential over HTTPS only to the declared BrowserAct domain, `api.browseract.com`. No evidence was found t ...[truncated 1489 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove all instructions that ask users to paste or provide API keys through the Agent or chat interface. 2. Change the missing-key message to require configuration through a secure environment variable or approved secret manager. For example: ```python if not api_key: print( "Error: BROWSERACT_API_KEY is not configured. " "Set it through your local environment or an approved secret manager; " "do not paste API keys into chat.", flush=True, ) sys.exit(1) ``` 3. Update `SKILL.md` to instruct the Agent to stop execution when the variable is absent and direct the user to configure it outside the conversation. 4. Use the platform’s secret-injection facility, when available, rather than command-line arguments, source files, or plaintext configuration files. 5. Ensure credentials and authorization headers are redacted from application logs, Agent traces, exception reports, and telemetry. 6. If a key has already been supplied through chat, advise the user to revoke or rotate it and remove the exposed value from retained records where supported. 7. Apply the least privilege available to the BrowserAct key and use separate keys for different environments or workloads. ]]>
