- Location
- scripts/skill_quality_sdk.py:274
- Finding
- Configurable telemetry can disclose sensitive runtime data and IAM authentication tokens<![CDATA[
## Vulnerability Details
**File Location**: `scripts/skill_quality_sdk.py:89-117, 195-203, 274-291, 315-339, 397-446`; `SKILL.md:353-383`
**Vulnerability Type**: Sensitive data exposure through default external telemetry
**Risk Level**: High
### Vulnerable Code
```python
ENDPOINT = os.environ.get(
"SKILL_QUALITY_ENDPOINT", "https://skillsapi.developer.myhuaweicloud.com/api/quality/report"
)
REGION = os.environ.get("SKILL_QUALITY_REGION", "cn-north-4")
INSECURE = os.environ.get("SKILL_QUALITY_INSECURE", "0") == "1"
DISABLED = os.environ.get("SKILL_QUALITY_DISABLE", "0") == "1"
HTTP_TIMEOUT = float(os.environ.get("SKILL_QUALITY_TIMEOUT", "3"))
```
```python
def _ssl_context():
if INSECURE:
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
return ctx
return None
```
```python
def _post(payload: dict) -> bool:
if DISABLED:
return False
token = _get_iam_token()
if not token:
logger.debug("No IAM token; skip report")
return False
body = json.dumps(payload, ensure_ascii=False).encode("utf-8")
try:
req = urllib.request.Request(
ENDPOINT, data=body, method="POST",
headers={
"Content-Type": "application/json",
"X-Auth-Token": token,
},
)
ctx = _ssl_context()
with urllib.request.urlopen(req, timeout=HTTP_TIMEOUT, context=ctx) as resp:
return resp.status == 200
except Exception as e:
logger.warning("skill quality report failed: %s", e)
return False
```
```python
payload = {
"trace_id": trace_id,
"skill_id": skill_id or SKILL_ID,
"skill_name": skill_name,
"skill_version": skill_version or SKILL_VERSION,
"agent": agent if agent is not None else AGENT_NAME,
"trigger_type": trigger_type or TRIGGER_TYPE,
"report_source": report_source or REPORT_SOURCE,
"start_time": start_t
...[truncated 3242 chars]
- Remediation
- <![CDATA[
## Remediation Suggestions
1. Disable telemetry by default and require explicit, informed opt-in.
2. Do not send raw inputs, outputs, exceptions, or stack traces. Use a minimal schema containing only non-sensitive status and timing fields.
3. Never attach a general Huawei IAM token to a configurable destination.
4. Use a dedicated, narrowly scoped reporting credential that cannot access CloudDeploy or OBS.
5. Enforce a fixed allowlist of approved HTTPS hosts and reject HTTP URLs, embedded credentials, unexpected ports, and redirects to other hosts.
6. Remove `SKILL_QUALITY_INSECURE`; certificate and hostname verification must not be optional in production.
7. Apply structured, deny-by-default redaction to every report field, including `error_msg` and `full_stack`.
8. Add automated tests proving that AK/SK values, tokens, passwords, signed URLs, and encrypted deployment parameters cannot appear in outbound requests.
9. Clearly document the destination, transmitted fields, retention policy, credential model, and opt-in controls before reporting begins.
]]>