T09 · Insecure Skill Coding Practices
- Location
huangli.py:38- Finding
API Credential Exposed in URL Query String
- Content
View full analysis
Vulnerability Details
File Location:
huangli.py, lines 38–47
Vulnerability Type: API credential exposure through URL-based authentication
Risk Level: Mediumpython params = { "appkey": appkey, "year": year, "month": month, "day": day, } try: resp = requests.get(HUANGLI_DATE_URL, params=params, timeout=10)Technical Analysis
The
appkeycredential is included in theparamsdictionary passed torequests.get. The Requests library serializes these parameters into the URL query string, producing a request resembling:text https://api.jisuapi.com/huangli/date?appkey=SECRET&year=2015&month=10&day=27HTTPS protects the request from passive interception while it is in transit, but it does not prevent the complete URL from being recorded by HTTP client diagnostics, reverse proxies, API gateways, monitoring platforms, server access logs, or error-reporting systems. Consequently, infrastructure operators or attackers who gain access to those records may recover the API credential.
Attack Path
- The skill reads a valid credential from the
JISU_API_KEYenvironment variable. - A user invokes the skill to query an almanac date.
- The script places the credential in the request URL as the
appkeyquery parameter. - A proxy, gateway, server, diagnostic facility, or monitoring system records the complete URL.
- An attacker or unauthorized operator obtains access to the retained logs.
- The attacker extracts the
appkeyvalue and submits requests directly to JisuAPI using the exposed credential.
Exploitation depends on access to infrastructure that records the URL; no evidence indicates that the script itself writes the URL to local logs.
Impact Assessment
A recovered key could allow an attacker to make requests with the privileges assigned to the associated JisuAPI account. The practical scope is limited to APIs and quotas e ...[truncated 251 chars]
- The skill reads a valid credential from the
- Remediation
View remediation
Remediation Suggestions
-
If JisuAPI supports it, transmit the credential in an authorization header rather than a query parameter:
python headers = {"Authorization": f"Bearer {appkey}"} params = {"year": year, "month": month, "day": day} resp = requests.get( HUANGLI_DATE_URL, headers=headers, params=params, timeout=10, ) -
If the provider requires
appkeyin the query string, configure clients, proxies, gateways, observability systems, and server logging to redact theappkeyparameter. -
Do not include complete request URLs in exceptions, debug output, telemetry, or audit records.
-
Use a credential restricted to only the required Huangli API and apply the lowest available request quota and source restrictions.
-
Rotate the credential periodically and immediately rotate it after suspected log exposure.
-
Restrict access to infrastructure logs, define short retention periods, and audit access to records that may contain request URLs.
-
