T09 · Insecure Skill Coding Practices
- Location
scripts/query_company_information.py:35- Finding
API Credential Exposed Through Plaintext HTTP and URL Query Parameters
- Content
View full analysis
Vulnerability Details
File Location:
scripts/query_company_information.py, lines 35 and 70–103
Vulnerability Type: Plaintext credential transmission and credential disclosure through URLs
Risk Level: HighVulnerable Code
python FEEDAX_BASE_URL = "http://221.6.15.90:18011"python url = f"{FEEDAX_BASE_URL}/data-service/v1/news/company/external/query?apiKey={api_key}" params = {"apiKey": api_key} headers = { "Content-Type": "application/json", "x-api-key": api_key } try: response = requests.post( url, params=params, headers=headers, json=payload, timeout=60 ) response.raise_for_status() return response.json() except requests.exceptions.RequestException as e: print(f"Request failed: {e}") sys.exit(1)Technical Analysis
The FEEDAX API is accessed using unencrypted HTTP. The API key is included in the URL query string and is also supplied through both
paramsand thex-api-keyheader.Plain HTTP provides neither transport confidentiality nor server authentication. An attacker capable of observing or modifying network traffic can recover the API key, inspect company searches, alter API responses, or impersonate the server.
Placing credentials in query parameters creates additional exposure because complete URLs are commonly recorded by:
- Reverse proxies and HTTP access logs
- Network monitoring products
- Debugging and error-reporting systems
- Application performance monitoring tools
- Gateway and intermediary infrastructure
Because the URL already contains
apiKeyandparamscontains it again, the resulting request may contain the secret twice in the query string. Sending it in a header as well does not reduce the exposure.Attack Path
- A user configures a valid FEEDAX API key and invokes the query script.
- The script constructs an HTTP request cont ...[truncated 1264 chars]
- Remediation
View remediation
Remediation Suggestions
- Replace the IP-based HTTP endpoint with an authenticated HTTPS hostname operated by FEEDAX:
python FEEDAX_BASE_URL = "https://api.feedax.example" - Refuse to send credentials when the configured URL does not use HTTPS.
- Send the API key exactly once, preferably in an authorization header:
python url = f"{FEEDAX_BASE_URL}/data-service/v1/news/company/external/query" headers = { "Content-Type": "application/json", "Authorization": f"Bearer {api_key}", } response = requests.post(url, headers=headers, json=payload, timeout=60) - Do not place credentials in URLs or query parameters.
- Use a DNS hostname whose certificate can be validated rather than disabling TLS verification or connecting directly to an IP address.
- Rotate any API key previously transmitted through this implementation.
- Review proxy, gateway, and monitoring logs for leaked query-string credentials.
- Add automated tests that reject non-HTTPS endpoint configuration and verify that generated URLs never contain the API key.
- Replace the IP-based HTTP endpoint with an authenticated HTTPS hostname operated by FEEDAX:
