T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:20
- Finding
- Unsafe Guidance Encourages Disclosure of the BrowserAct API Key to the Agent## Vulnerability Details **File Location**: `SKILL.md:20-23`; `scripts/devto_articles_search_scraper_api.py:95-102` **Vulnerability Type**: API credential exposure through insecure secret-handling guidance **Risk Level**: Medium ### Vulnerable Code `SKILL.md:20-23`: ```markdown Before running, check the `BROWSERACT_API_KEY` environment variable. If it is not set, do not take other measures; ask and wait for the user to provide it. Agent must tell 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=devto-articles-search-scraper) to get your Key." ``` `scripts/devto_articles_search_scraper_api.py:95-102`: ```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 tells the agent to ask the user to provide an API key, while the script similarly presents direct disclosure to the agent as an alternative to local environment configuration. API keys are authentication secrets and should not be entered into conversational channels. A key disclosed in conversation may be retained in chat history, model context, application telemetry, debugging traces, or Agent-platform logs. This exposure is unnecessary because the script already supports reading the credential from the `BROWSERACT_API_KEY` environment variable. The script subsequently uses the credential as a Bearer token: ```python headers = {"Authorization": f"Bearer {api_key}"} ``` Transmission of that token to the fixed `https://api.browseract.com` ...[truncated 1423 chars]
- Remediation
- ## Remediation Suggestions 1. Remove all instructions asking users to provide or paste the API key into the Agent conversation. 2. Require the key to be configured locally through `BROWSERACT_API_KEY`, a protected secret manager, or the execution platform's secret-injection facility. 3. Replace the script message with guidance that explicitly prohibits disclosure, for example: ```python print("Set BROWSERACT_API_KEY in your local environment or secret manager.", flush=True) print("Do not paste the API key into chat or command-line arguments.", flush=True) ``` 4. Update `SKILL.md` to instruct the Agent to stop execution and direct the user to configure the environment variable privately. 5. Ensure the key is never printed, serialized into output, included in exceptions, or stored in application logs. 6. Recommend revocation and rotation of any API key previously disclosed through a conversation or other logged channel. 7. Where supported, use a narrowly scoped BrowserAct credential with usage limits and only the permissions required to run and retrieve this template.
