T09 · Insecure Skill Coding Practices
- Location
scripts/track_flight.py:32- Finding
API Credential and Flight Query Transmitted Over Plaintext HTTP
- Content
View full analysis
Vulnerability Details
File Location:
scripts/track_flight.py, lines 32-46
Vulnerability Type: Plaintext transmission of sensitive credentials
Risk Level: Highpython def fetch_flight_data(flight_number: str, api_key: str) -> dict: """Fetch flight data from AviationStack API""" base_url = "http://api.aviationstack.com/v1/flights" params = { 'access_key': api_key, 'flight_iata': flight_number.upper() } try: response = requests.get(base_url, params=params, timeout=10) response.raise_for_status() return response.json() except requests.exceptions.RequestException as e: print(f"Error fetching flight data: {e}") sys.exit(1)Technical Analysis
The script sends the AviationStack API key as the
access_keyURL query parameter through an unencrypted HTTP connection. Therequestslibrary serializes these parameters into a URL resembling:text http://api.aviationstack.com/v1/flights?access_key=SECRET&flight_iata=AA100Because HTTP provides neither transport encryption nor server authentication, network intermediaries can observe the API key and requested flight number. URL query parameters can also be retained in server, proxy, gateway, or monitoring logs.
An active network attacker could modify the response because its integrity is not protected. The application subsequently trusts the returned JSON and displays flight status, gates, times, and live-position information without an independent authenticity check.
Contacting a flight-data provider is necessary for the Skill's declared functionality. Transmitting reusable credentials and flight queries over plaintext transport, however, exceeds an acceptable least-exposure design. The insecure limitation is disclosed in
SKILL.mdandreferences/api-setup.md, but disclosure does not mitigate interception or tampering.Attack
...[truncated 1364 chars]
- Remediation
View remediation
Remediation Suggestions
- Replace the endpoint with an HTTPS endpoint:
python base_url = "https://api.aviationstack.com/v1/flights" - Use an AviationStack subscription that supports HTTPS, or select another flight-data provider that provides TLS on the required service tier.
- Do not silently fall back to HTTP when HTTPS is unavailable. Fail closed with an explicit error instead.
- If the provider supports it, transmit the credential in an authorization header rather than a URL query parameter. HTTPS remains mandatory even when headers are used.
- Rotate API keys that have already been transmitted through this implementation.
- Update
SKILL.mdandreferences/api-setup.mdso they no longer recommend or normalize credential transmission over HTTP. - Consider redacting request URLs from exception and diagnostic output to prevent future credential leakage if logging is added.
- Replace the endpoint with an HTTPS endpoint:
