security: stop logging user prompt content on container errors

Container error logs wrote the full ContainerInput (including user
prompt) to disk on every non-zero exit. The structured log stream
also included the first 200 chars of agent output.

- container-runner: only include full input at verbose level; error
  path now logs prompt length and session ID instead
- index: log output length instead of content snippet

Fixes #1150
This commit is contained in:
moktamd
2026-03-17 15:07:09 +00:00
committed by gavrielc
parent fc2cc5368f
commit cf899049f7
2 changed files with 18 additions and 4 deletions

View File

@@ -503,10 +503,24 @@ export async function runContainerAgent(
const isError = code !== 0;
if (isVerbose || isError) {
// On error, log input metadata only — not the full prompt.
// Full input is only included at verbose level to avoid
// persisting user conversation content on every non-zero exit.
if (isVerbose) {
logLines.push(
`=== Input ===`,
JSON.stringify(input, null, 2),
``,
);
} else {
logLines.push(
`=== Input Summary ===`,
`Prompt length: ${input.prompt.length} chars`,
`Session ID: ${input.sessionId || 'new'}`,
``,
);
}
logLines.push(
`=== Input ===`,
JSON.stringify(input, null, 2),
``,
`=== Container Args ===`,
containerArgs.join(' '),
``,