T09 · Insecure Skill Coding Practices
- Location
hooks/token-logger/handler.js:156- Finding
Excessive Logging of Complete Session Context
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This is a plausible token-usage tracker, but its hook can run automatically and logs more session context than token tracking requires.
Review this skill before installing. It is not clearly malicious, but enabling it gives it persistent access to session-compaction events, local session status files, and usage records, and it may send usage summaries to Telegram through cron jobs. Do not enable the hook or scheduled reports unless you are comfortable with session IDs, model usage, cost summaries, and potentially logged event context being stored locally or announced externally. The hook should be fixed to stop logging full context and to validate session keys before production use.
hooks/token-logger/handler.js:156Excessive Logging of Complete Session Context
hooks/token-logger/handler.js:88Unvalidated Session Key Used to Construct a Local File Path
hooks/token-logger/handler.js:122Invalid Await Expression Prevents the Installed Hook from Loading
The documented purpose focuses on token monitoring and reporting, but the skill also introduces a hook triggered on session:compact:after and describes automated reporting/alerts that are not actually implemented in this file. That mismatch is dangerous because users may approve a seemingly simple billing utility without realizing it installs persistent event-driven behavior and can later send data externally via cron/channel integrations.
The skill instructs users to install a hook and copy files into managed hook directories, which implies file read/write and persistent modification capabilities, yet it declares no explicit tool scope or permissions. This weakens informed consent and reviewability because users and platforms cannot easily tell that the skill persists files and alters runtime behavior.
The skill description does not prominently warn that the optional hook automatically records per-session token usage and that scheduled reports or alerts may be pushed to external channels such as Telegram. Even if only usage metadata is collected, session identifiers, model usage patterns, and spending summaries can be sensitive operational data and should not be exported without explicit user awareness.
This duplicate finding points to the same persistence behavior: installation into the managed hooks directory followed by activation causes the skill to run automatically in later sessions. In the context of a monitoring skill, persistence is somewhat expected, but it still needs explicit disclosure because it changes the trust model from manual use to background interception of usage events.
# 方法一:复制 hook 到 managed hooks 目录
mkdir -p ~/.openclaw/hooks/token-logger
cp hooks/token-logger/HOOK.md ~/.openclaw/hooks/token-logger/
cp hooks/token-logger/handler.js ~/.openclaw/hooks/token-logger/
This duplicate finding points to the same persistence behavior: installation into the managed hooks directory followed by activation causes the skill to run automatically in later sessions. In the context of a monitoring skill, persistence is somewhat expected, but it still needs explicit disclosure because it changes the trust model from manual use to background interception of usage events.
# 方法一:复制 hook 到 managed hooks 目录
mkdir -p ~/.openclaw/hooks/token-logger
cp hooks/token-logger/HOOK.md ~/.openclaw/hooks/token-logger/
cp hooks/token-logger/handler.js ~/.openclaw/hooks/token-logger/
This manifest uses Chinese natural-language descriptions and agent instructions exclusively, including the top-level description and job payload messages. Per the language/locale policy rule, forcing a specific language without offering user choice or documenting a justified regional constraint is a policy concern.
The weekly and hourly job payloads instruct the agent entirely in Chinese and do not indicate any user opt-in, language selection, or region-specific limitation. Because these natural-language prompts govern agent behavior, they repeat the same locale-policy issue across multiple scheduled tasks.
The hook documentation states that every session's token usage is automatically recorded to a TokenTracker database after session compaction, but it does not mention user notice, consent, retention, or privacy implications. Even if the logged fields are primarily usage metadata, per-session model usage can still reveal behavioral patterns, costs, and potentially correlate to sensitive activity, making silent collection a legitimate privacy and governance concern.
The hook logs the full event context and session identifier, which may contain prompts, summaries, metadata, or other user/system data not needed for token accounting. Because hook logs are often retained in plaintext and accessible to operators or other local processes, this creates an avoidable confidentiality leak path.
The code emits verbose plaintext logs containing both per-session identifiers and the full event context, then also logs record objects when written. In a token-tracking skill, the operational need is billing/usage measurement, so retaining rich session-linked context is unnecessary and increases the chance of exposing sensitive conversation or system data through logs.
The sample configuration hard-codes Asia/Shanghai as the time zone, and the rest of the document is written as though that locale is the default behavior, without offering an opt-in choice. Under the policy, locale constraints should either be user-selectable or explicitly justified as region-specific.
The config hard-codes "Asia/Shanghai" as the time zone, which is a locale-specific behavior. Under the policy, fixed language or locale constraints should either be user-selectable or clearly justified as region-specific; this file provides neither.
SQP-3 applies to all file types and includes language policy violations. Multiple user-facing description lines are Chinese-only, and the file does not indicate that this is an intentional region-specific skill or provide an opt-in language choice, which can violate organizational language/locale expectations.
The file's descriptive comments are written in Chinese only, and the natural-language labeling throughout the file does not offer an alternative language or indicate that the skill is intended for a Chinese-only audience. Per the stated policy, forcing a specific language without opt-in can be a locale/language policy issue.
The inline comment at L15 is written in Chinese while the rest of the script's user-facing text is in English. This creates an implicit language inconsistency without offering user choice or documenting a locale-specific reason, which matches the language/locale policy concern.
No suspicious patterns detected.