T09 · Insecure Skill Coding Practices
- Location
scripts/hiboards_client.py:102- Finding
Authentication Credentials Exposed Through Console and Debug Output
- Content
View full analysis
Vulnerability Details
File Location:
scripts/hiboards_client.py:102-106,scripts/hiboards_client.py:117-121, andscripts/hiboards_client.py:136
Vulnerability Type: Sensitive information exposure through output and logging
Risk Level: HighVulnerable Code
python required_keys = ['PERSONAL-API-KEY', 'PERSONAL-UID'] check_result = True for key in required_keys: if key in config: print(f'key "{key}" 存在:{config[key]}') else: print(f'key "{key}" 不存在:失败...') check_result = Falsepython headers = { 'Content-Type': 'application/json', 'Accept': 'application/json', 'x-hag-trace-id': trace_id, 'x-api-key': config['PERSONAL-API-KEY'], 'x-request-from': 'openclaw', 'x-uid': config['PERSONAL-UID'], 'x-skill-id': 'hiboard_today_task', 'x-prd-pkg-name': 'com.huawei.hag', "x-trace-id": trace_id } logger.debug(f"请求头: {headers}")Technical Analysis
The credential validation loop prints the complete value of every required credential, including
PERSONAL-API-KEYandPERSONAL-UID. These values are reusable authentication data rather than harmless presence indicators.The complete HTTP header dictionary is also submitted to the debug logger. Because that dictionary contains both
x-api-keyandx-uid, enabling or capturing debug output may persist the same credentials in log aggregation systems, terminal history, CI output, support bundles, or other monitoring infrastructure.Secret values must not be written to output channels. Logging full authentication headers violates the principle of minimizing secret exposure and expands access to credentials beyond the component that needs them.
Attack Path
- A legitimate user or automated process executes a task push.
- The client reads
PERSONAL-API-KEYandPERSONAL-UIDfrom/home/sandbox/.openclaw/.xiaoyienv. - The credential valida ...[truncated 1068 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove all output that includes credential values. Report only whether each required key is present.
- Never log complete request headers. Create an explicit redaction function that replaces values for
x-api-key,x-uid, authorization headers, cookies, and tokens with a fixed marker such as[REDACTED]. - Use structured logging with an allowlist of non-sensitive fields rather than serializing entire dictionaries.
- Ensure production logging cannot be changed to a secret-bearing debug mode without appropriate access controls.
- Restrict access to console logs and local log files using least-privilege filesystem permissions.
- Rotate any API credentials that have been used with the affected implementation because existing terminal or log captures may already contain them.
- Add automated tests that fail if known secret field names or test credential values appear in captured output.
