T09 · Insecure Skill Coding Practices
- Location
SKILL.md:24- Finding
Unredacted Tool Parameters and Session Identifiers Written to Logs
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 24–33
Vulnerability Type: Sensitive information exposure through logging
Risk Level: MediumVulnerable Code
javascript api.registerHook("before_tool_call", async ({ event, ctx }) => { const log = { time: new Date().toISOString(), tool: event.tool.name, params: event.tool.params, session: ctx.sessionKey }; // Write to log file console.log("[TOOL_AUDIT]", JSON.stringify(log)); return {}; // Don't block, continue execution });Technical Analysis
The documented hook serializes the complete
event.tool.paramsobject andctx.sessionKeywithout redaction, minimization, or access controls. Tool parameters may contain API keys, authentication tokens, private prompts, personal information, file contents, command arguments, or other confidential values.If this example is incorporated into an operational plugin, all such data will be sent to the runtime's standard logging channel. Depending on deployment configuration, those logs may be retained on disk or forwarded to centralized monitoring systems, increasing both the number of parties with access and the duration of exposure.
The project contains documentation rather than an executable implementation, so the weakness becomes directly exploitable only if the example is adopted or deployed. No external transmission endpoint or intentional exfiltration mechanism was found in the reviewed project.
Attack Path
- An operator implements or copies the documented
before_tool_callhook. - A user or agent invokes a tool with a secret or private value in
event.tool.params. - The hook captures the entire parameter object and the associated session identifier.
JSON.stringify(log)serializes these values without redaction.console.logwrites them to the configured runtime logging pipeline.- A user, administrator, support operator, compro ...[truncated 805 chars]
- An operator implements or copies the documented
- Remediation
View remediation
Remediation Suggestions
- Do not log complete tool parameter objects by default.
- Use an explicit allowlist containing only non-sensitive fields required for auditing, such as the tool name, timestamp, and a generated correlation identifier.
- Recursively redact keys commonly associated with secrets, including
password,token,secret,authorization,cookie,apiKey, and private-key fields. - Omit
ctx.sessionKeyor replace it with a keyed, non-reversible pseudonymous identifier. - Truncate values and reject binary data or large payloads before serialization.
- Configure restrictive access controls, encryption, retention limits, and deletion policies for audit logs.
- Ensure centralized log collectors and monitoring integrations receive only sanitized records.
- Add automated tests that submit representative credentials and verify that neither exact values nor reversible encodings appear in logs.
- Clearly label the example as illustrative and unsafe for production until redaction and log-access controls are implemented.
