T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/amazon_product_details_scraper_api.py:101
- Finding
- Unsafe Solicitation of BrowserAct API Keys Through the Agent Conversation## Vulnerability Details **File Location**: `SKILL.md:26-29`; `scripts/amazon_product_details_scraper_api.py:101-106` **Vulnerability Type**: Credential exposure through insecure secret-handling instructions **Risk Level**: Medium ### Vulnerable Code and Instructions `SKILL.md:26-29`: ```markdown ## 🔑 API Key Guide Before running, check the `BROWSERACT_API_KEY` environment variable. If not set, do not take other measures; ask and wait for the user to provide it. **Agent must inform the user**: > "Since you haven't configured the BrowserAct API Key yet, please go to the [BrowserAct Console](https://www.browseract.com/reception/integrations?co-from=amazon-product-details-scraper) to get your Key." ``` `scripts/amazon_product_details_scraper_api.py:101-106`: ```python 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) ``` ### Technical Analysis The Skill explicitly instructs the user to provide an API key to the Agent when the environment variable is absent. The script reinforces this by presenting disclosure to the Agent as an alternative to configuring `BROWSERACT_API_KEY`. API keys are bearer credentials and should not be entered into conversational context. Agent conversations may be retained in transcripts, diagnostic logs, observability systems, or made available to integrated tools. Consequently, asking a user to paste the key into a conversation unnecessarily expands the credential's exposure boundary. The script itself does not print the value of the key. Its use of the key in an `Authorization: Bearer` header sent over HTTPS to the declared BrowserAct API is necessary for the documented functionality. The vulnerabili ...[truncated 1442 chars]
- Remediation
- ## Remediation Suggestions 1. Remove every instruction suggesting that users provide or paste the API key into the Agent conversation. 2. Require `BROWSERACT_API_KEY` to be configured locally through an environment variable, runtime secret injection, or an operating-system/cloud secret manager. 3. Replace the vulnerable script message with guidance such as: ```python print( "Set BROWSERACT_API_KEY securely in your local environment or secret manager. " "Do not paste API keys into chat.", flush=True, ) ``` 4. Update `SKILL.md` to require the Agent to report only that the environment variable is missing and to wait until the user confirms that it has been configured locally. 5. Ensure exceptions, HTTP diagnostics, and debug logs never include request headers or the credential value. 6. Recommend revocation and rotation of any API key previously pasted into a conversation. 7. Where supported, use narrowly scoped, short-lived credentials and enforce account-level usage and billing alerts.
