T09 · Insecure Skill Coding Practices
- Location
scripts/dataworks_client.py:17- Finding
Hardcoded DataWorks Access Token in Source Code
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill has a coherent analytics purpose, but it embeds and auto-discovers credentials, can send them to an unrestricted endpoint, and persistently logs raw business query data.
Review before installing. This skill should only be used in a controlled internal environment after the embedded token is revoked/removed, endpoint destinations are allowlisted, ambient credential discovery is disabled or explicitly approved, and raw debug logging is off by default or redacted.
scripts/dataworks_client.py:17Hardcoded DataWorks Access Token in Source Code
scripts/dataworks_client.py:200Automatically Discovered Credentials Can Be Transmitted to an Arbitrary Endpoint
scripts/dataworks_client.py:221Raw Business Query Data Is Persistently Logged by Default
The request target is taken from an environment-controlled endpoint and used directly in an authenticated httpx.post call, while the same request includes a bearer-equivalent authentication cookie. If an attacker can influence the environment or runtime configuration, they can redirect requests and exfiltrate both the query payload and the access token to an attacker-controlled server.
json.dumps(payload, ensure_ascii=False, indent=2),
)
response = httpx.post(
endpoint or DEFAULT_ENDPOINT,
headers={
"Cookie": f"bigdata_access_token={access_token or DEFAULT_ACCESS_TOKEN}",
The declared purpose is a narrowly scoped acceptance-rate root cause analysis skill, but the detected behavior includes generic remote metric querying, use of cookie-based access tokens to reach external services, and logging of requests/raw responses. That mismatch is dangerous because it hides sensitive external data access and potential credential handling behind a benign analytics description, reducing operator scrutiny and increasing the chance of data leakage.
Referenced artifact was not completely inspected
- 本 `SKILL.md` 是该技能的唯一主契约,决定阶段执行顺序、判定口径、展示字段和下钻规则。
Debug logging to a local file occurs without a clear warning and is likely to capture sensitive query details. Because this is automatic and persistent, it materially increases confidentiality risk in shared or managed execution environments.
Reading ~/.openclaw/.env is a form of ambient credential access from a user-controlled secrets store. In an agent skill, this behavior is especially sensitive because it reaches beyond provided inputs to harvest credentials that can then be used for network access, which is a classic credential-access pattern even if the apparent goal is operational convenience.
if value:
return value
env_path = Path.home() / ".openclaw" / ".env"
if env_path.exists():
for line in env_path.read_text(encoding="utf-8").splitlines():
if "=" not in line:
The code embeds a default access token directly in source and uses it automatically for authenticated requests. Hardcoded secrets are easily leaked through source control, logs, builds, or reuse in other environments, and they create unauthorized access risk if the code is shared beyond its intended boundary.
A built-in default token causes authenticated access to occur without explicit operator awareness or consent. In an analytics skill, that is especially risky because routine use can mask secret misuse, expand blast radius across environments, and enable unintended data access whenever the module is imported and called.
The skill documentation defines execution behavior and shell commands that can invoke scripts with capabilities implying environment access, file reads, and remote data access, yet it declares no explicit tool scope or permission boundaries. Without an allowlist, an agent may execute the skill with broader-than-necessary privileges, increasing the risk of unauthorized data access or unintended external calls.
The activation phrases are broad enough to match common business-analysis requests, which can cause the skill to trigger in contexts not intended by the user. In this skill's context, overbroad triggering is more dangerous because the skill appears capable of remote data retrieval and multi-stage analysis, so accidental activation could expose sensitive operational data or launch unnecessary external queries.
The manifest content is entirely written in Chinese and the default prompt prescribes response behavior in Chinese business phrasing, but it does not offer the user any language choice or indicate that Chinese is optional. This can violate language/locale policy when users have not opted into Chinese output.
The script enables persistent debug logging to a local file on every run and records detailed execution traces. In this skill, those traces can include query metadata and business data, creating a durable local artifact that may expose sensitive operational information to other users, processes, or later collection.
User-facing strings throughout the script, including errors, summaries, CLI descriptions, and business-view outputs, are consistently hard-coded in Chinese with no language selection mechanism. This imposes a specific language/locale on all users without offering a choice or documenting a justified region-specific constraint.
The skill silently searches multiple environment variables and a user home directory .env file for access tokens, even when no explicit token was provided. In an agent-skill context, that broad credential discovery exceeds the apparent analytics task and can cause unintended credential use or exposure, especially if combined with logging, errors, or downstream transmission.
The skill obtains credentials from environment variables and a local .env file without clear disclosure to the user. In an agent setting, undisclosed secret sourcing reduces transparency and may cause users to unknowingly authorize remote access with ambient credentials.
The script sends analysis filters and business context to a remote metric-query service without any user-facing warning. Although remote querying is part of the tool's function, the lack of disclosure is risky because users may not realize their time windows, slice conditions, and related business metadata are leaving the local environment.
The code builds debug snapshots containing raw payloads, SQL, filters, column metadata, and row data, despite comments suggesting raw query details are not returned upstream. This creates a direct data-exposure path because sensitive query context and result sets can be persisted or surfaced during failures, undermining data-minimization expectations.
This file contains hard-coded Chinese output text such as the unit suffix "万" and many later user-facing strings, indicating the skill is designed to respond in a specific language. Under the policy, language constraints should not be forced unless the user is given a choice or the locale restriction is clearly documented and justified.
The inline comment states that the request-body JSON does not contain Cookie/token, implying a safer or less sensitive operation, but the actual request includes a Cookie header carrying the access token. While the token is not in the JSON body specifically, the documentation is misleading about the sensitivity of the outbound request and can cause incorrect assumptions during auditing or operation.
Comments and visible log/error strings such as '请求体 JSON 不含 Cookie/token', 'DataWorks 查询失败', and '响应原始数据' indicate a fixed Chinese-language user/operator experience. The file does not offer language selection or explain that the skill is intentionally limited to a Chinese locale.
Verbose logging is enabled by default and records full query payloads plus raw response rows. Because this module queries business metrics data, those logs can expose sensitive user-provided filters, internal SQL, and returned records to log sinks, support staff, or other systems not authorized to access the underlying data.
The function sends data to a remote endpoint with an authentication cookie, which can expose user or system data to an external service. Although debug logging exists, it is not a user-facing warning or confirmation about the network transmission itself.
The comment states that from the first stage onward, logic is unified around extracted helpers so stage logic depends only on an external module. In reality, this file still contains local definitions of the same helpers above and continues to use helper names that are rebound via import, so the documentation overstates the architectural separation actually present in the file.