T09 · Insecure Skill Coding Practices
- Location
src/config.js:19- Finding
Bearer Token Transmitted over Plaintext HTTP by Default
- Content
View full analysis
Vulnerability Details
File Location:
src/config.js:19; authenticated request flow insrc/client.js:52-72
Vulnerability Type: Plaintext transmission of authentication credentials
Risk Level: HighComplete Code Snippet
javascript // src/config.js:19 const DEFAULT_BASE_URL = 'http://st.aidata366.com';javascript // src/client.js:52-72 if (!_httpWarned && this.token && this.baseUrl.startsWith('http://')) { _httpWarned = true; process.stderr.write('[warn] 当前服务地址为明文 http,token 会明文传输,建议确认网络安全或切换 https\n'); } const ctrl = new AbortController(); const timer = setTimeout(() => ctrl.abort(), timeoutMs); let res; let payload = null; try { res = await fetch(this.baseUrl + '/api/v1' + apiPath, { method, headers: { ...(body ? { 'Content-Type': 'application/json' } : {}), ...(this.token ? { Authorization: `Bearer ${this.token}` } : {}), ...headers, },Technical Analysis
The built-in service URL uses unencrypted HTTP. For authenticated API calls,
ApiClient.request()inserts the account bearer token into theAuthorizationheader and sends the request to this default endpoint.The stderr warning only informs the caller after the insecure configuration is selected; it does not block the request, remove the credential, or require explicit approval. Consequently, the default authenticated workflow exposes both the bearer token and API traffic to passive interception and active modification.
The affected flow includes authenticated operations such as
quota,start,step,status,comments,sessions,finish, andexport. The export implementation incli.js:335-337also sends the same bearer token to the configured base URL.Attack Path
- A user registers or logs in, causing an account token to be saved locally.
- The user or agent invokes an authenticated command without overriding the default base URL.
- The client sends
Authorization: Bearer <token>to `http://st.aidata3 ...[truncated 1380 chars]
- Remediation
View remediation
Remediation Suggestions
- Replace the default endpoint with an HTTPS URL backed by a valid, correctly configured certificate.
- Reject authenticated requests to non-HTTPS origins before adding the
Authorizationheader. - If plaintext HTTP is required for local development, limit it to loopback addresses such as
127.0.0.1and require explicit opt-in. - Do not treat a warning as sufficient protection for credential transmission.
- Add URL validation that permits credentials only when the effective protocol is HTTPS.
- Ensure the export path applies the same transport policy as
ApiClient.request(). - Remove or invalidate tokens that may previously have traversed untrusted plaintext networks after secure transport is deployed.
