Skip to content

Harden read and bash output against binary data - #39

Merged
K-Mistele merged 1 commit into
mainfrom
harden-binary-tool-output
Sep 5, 2026
Merged

Harden read and bash output against binary data#39
K-Mistele merged 1 commit into
mainfrom
harden-binary-tool-output

Conversation

@K-Mistele

Copy link
Copy Markdown
Contributor

Summary

  • reject known binary files, NUL bytes anywhere in a file, and malformed UTF-8 from the read tool with model-visible errors
  • decode bash stdout and stderr as strict UTF-8 and replace unsafe stream output with a safe, model-visible omission notice
  • cover binary reads, late NUL bytes, malformed UTF-8, and safe streamed bash deltas

Context

OpenCode's newer read implementation rejects binary content and uses fatal UTF-8 decoding. Pi and OpenCode's bash implementations currently use replacement decoding and can preserve NUL bytes; Fold now hardens both ingress paths so tool output cannot carry PostgreSQL-invalid NUL content into event persistence.

Validation

  • bun run typecheck
  • bun run format:check
  • bun run lint (passes with existing warnings)
  • bun run test

@K-Mistele
K-Mistele merged commit 9037435 into main Sep 5, 2026
5 checks passed
@K-Mistele
K-Mistele deleted the harden-binary-tool-output branch September 5, 2026 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant