- Location
- scripts/structured-log.js:12
- Finding
- Raw user input is emitted to structured logs without redaction<![CDATA[
## Vulnerability Details
**File Location**: `scripts/structured-log.js:12-24`
**Vulnerability Type**: Sensitive information exposure through logging
**Risk Level**: Medium
### Vulnerable Code
```js
const payload = {
ts: new Date().toISOString(),
intent: parsed.intent || null,
recall_trigger: parsed.recall_trigger || null,
recall_mode: parsed.recall_mode || null,
recall_status: parsed.recall_status || null,
recall_item_count: parsed.recall_item_count ?? null,
injected_item_count: parsed.injected_item_count ?? null,
pre_execution_gate: parsed.pre_execution_gate ?? false,
message: parsed.message || null
};
process.stdout.write("[memory-harness] " + JSON.stringify(payload) + "\n");
```
The raw value originates from `scripts/harness.js:46-59`:
```js
const logLine = execFileSync(
"node",
[
path.join(DIR, "structured-log.js"),
JSON.stringify({
intent,
recall_trigger: recallDecision.reason,
recall_mode: recallDecision.mode,
recall_status: recallResult.status,
recall_item_count: (recallResult.items || []).length,
injected_item_count: (compressed.items || []).length,
pre_execution_gate: preExecution,
message: text
})
],
{ encoding: "utf-8" }
).trim();
```
### Technical Analysis
The complete user message is inserted into a structured log record without redaction, minimization, length restriction, or explicit opt-in. Prompts frequently contain source code, access tokens, credentials, personal data, internal project names, and confidential operational details.
Writing the record to stdout does not directly transmit it over the network. However, production runtimes commonly capture stdout in centralized logging systems, container logs, CI artifacts, or monitoring services. This can expand the audience, retention period, and storage locations of sensitive prompt content. The documented list of observability fields also does not disclose that full message content is logged.
...[truncated 834 chars]
- Remediation
- <![CDATA[
## Remediation Suggestions
- Remove full prompt bodies from logs by default.
- Log a generated request identifier, intent, item counts, timing information, and other non-sensitive metadata instead.
- If message logging is explicitly required, make it opt-in and apply allowlist-based field selection.
- Redact common secret formats, including API keys, bearer tokens, passwords, private keys, cookies, and connection strings.
- Enforce strict length limits and avoid retaining source code or arbitrary user-provided content.
- Document all logged fields, retention periods, access controls, and external log destinations.
- Configure production logging systems with encryption, least-privilege access, deletion policies, and auditing.
- Add tests confirming that representative credentials and personal data never appear in emitted log records.
]]>