T09 · Insecure Skill Coding Practices
- Location
SKILL.md:58- Finding
Insecure API Key Submission and Exposure Through Chat and Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:58-74,SKILL.md:98-108,scripts/get_economic_calendar.py:207-210
Vulnerability Type: Sensitive credential exposure through persistent communication and process channels
Risk Level: MediumVulnerable Code and Instructions
SKILL.md:58-74directs the agent to request an API key through chat when the environment variable is unavailable:markdown ### Step 1: Obtain FMP API Key **Check for API key availability:** 1. First check if FMP_API_KEY environment variable is set 2. If not available, ask user to provide API key via chat 3. If user doesn't have API key, provide instructions: - Visit https://financialmodelingprep.com - Sign up for free account (250 requests/day limit) - Navigate to API dashboard to obtain key **Example user interaction:**User: "Show me economic events for next week" Assistant: "I'll fetch the economic calendar. Do you have an FMP API key? I can use the FMP_API_KEY environment variable, or you can provide your API key now."
text SKILL.md:98-108recommends supplying the secret as a command-line argument:markdown **Basic usage (default 7 days):** ```bash python3 /path/to/economic-calendar-fetcher/scripts/get_economic_calendar.py --api-key YOUR_KEYWith specific date range:
bash python3 /path/to/economic-calendar-fetcher/scripts/get_economic_calendar.py \ --from 2025-01-01 \ --to 2025-01-31 \ --api-key YOUR_KEY \ --format jsontext The script implements the documented command-line credential channel at `scripts/get_economic_calendar.py:207-210`: ```python parser.add_argument( '--api-key', dest='api_key', help='FMP API key (overrides FMP_API_KEY environment variable)' )Technical Analysis
API keys are bearer credentials and must not be submitted through channels that are commonly retained or observable. Asking users to paste an FMP key into chat can place the credential in conversation transcripts, tele ...[truncated 2326 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove the instruction to request API keys through chat. Explicitly warn users never to paste credentials into conversations.
- Remove or deprecate the
--api-keyargument so secrets cannot be exposed through process arguments or shell history. - Require
FMP_API_KEYto be supplied through a protected environment-injection mechanism or platform secret manager. - Where interactive local execution is necessary, accept the key through a non-echoing prompt using
getpass.getpass()rather than through command-line arguments. - Update usage examples to show only secret-safe invocation:
bash FMP_API_KEY="$(secure-secret-tool read fmp-api-key)" \ python3 scripts/get_economic_calendar.py \ --from 2025-01-01 \ --to 2025-01-31- Never print the API key or a complete authenticated request URL. Sanitize exception messages, telemetry, proxy logs, and debug output so the
apikeyquery value is replaced with[REDACTED]. - Add documentation directing users to rotate the FMP key immediately if it has previously been pasted into chat, entered as a command-line argument, or included in logs.
- Apply least privilege at the FMP account level where supported, including restricted API products, rate limits, usage alerts, and periodic key rotation.
