T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:23
- Finding
- API Key Disclosure Through Agent Conversation< to get your Key." ``` `scripts/company_career_page_finder_api.py:93-98`: ```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) sys.exit(1) ``` ### Technical Analysis The Skill explicitly directs the agent to ask the user for a BrowserAct API key and wait for the user to provide it. The executable helper reinforces this behavior by presenting disclosure to the agent as an alternative to configuring the environment variable. An API key is an authentication secret and should not be transmitted through a conversational interface. Conversation messages may be retained in chat history, operational logs, telemetry, or other processing systems. Consequently, asking the user to paste the key exposes it to systems and personnel that do not need access to it. This behavior exceeds minimum privilege. The script only requires the key to be available through `BROWSERACT_API_KEY`; the agent does not need to read, receive, store, or relay the credential. The script otherwise sends the Bearer token only to the decl ...[truncated 1374 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove all instructions asking users to provide API keys to the agent or through conversation. 2. Change `SKILL.md` to instruct users to configure `BROWSERACT_API_KEY` locally using an environment variable or an approved secret manager. 3. Replace the script message with wording such as: ```python print( "Set BROWSERACT_API_KEY securely in the local environment, then run the command again. " "Do not paste the API key into chat.", flush=True, ) ``` 4. Permit the agent to check only whether the variable exists; it must not print, inspect, repeat, store, or request the value. 5. Document secure configuration examples that avoid shell-history exposure, such as deployment-platform secret settings or an operating-system credential store. 6. If a key has already been shared through a conversation, instruct the user to revoke or rotate it and remove retained copies where possible. 7. Apply least-privilege restrictions, usage limits, and rotation policies to BrowserAct API credentials where supported. ]]>
