Skip to content

daemon: sanitize invalid UTF-8 in proto responses#418

Merged
proboscis merged 1 commit intomainfrom
issue/orch-438/run-20260211-025407
Feb 11, 2026
Merged

daemon: sanitize invalid UTF-8 in proto responses#418
proboscis merged 1 commit intomainfrom
issue/orch-438/run-20260211-025407

Conversation

@proboscis
Copy link
Owner

Summary

  • Added sanitizeUTF8/sanitizeUTF8Slice helpers using strings.ToValidUTF8.
  • Sanitized proto string fields in daemon responses where invalid UTF-8 can propagate (issue/run conversion + run issue metadata + capture/diff/daemon-log response payloads).
  • Added socket-level regression tests that exercise real proto request/response framing to prevent EOF regressions when invalid UTF-8 is present.
  • Added unit tests for UTF-8 sanitization helper behavior.

Acceptance Criteria Evidence

1) orch ps works even when issues contain invalid UTF-8

Repro run against a live daemon with an issue file containing invalid bytes (0xFF) in title/body:

$ orch --issues-root <tmp-vault> ps --issue utf8-bad --json
{
  "ok": true,
  "items": [ ... ]
}

2) orch monitor displays runs correctly

Monitor consumes daemon ListRuns/ListIssues proto APIs. Verified those APIs over real socket framing with invalid UTF-8 payloads:

$ go test ./internal/daemon -run 'TestListRunsAPI_InvalidUTF8IssueMetadataDoesNotBreakProto|TestListIssuesAPI_InvalidUTF8TextFieldsAreSanitized' -count=1 -v
--- PASS: TestListRunsAPI_InvalidUTF8IssueMetadataDoesNotBreakProto
--- PASS: TestListIssuesAPI_InvalidUTF8TextFieldsAreSanitized

This is the exact daemon boundary that previously failed marshal and caused client EOF.

3) Unit test for sanitizeUTF8

$ go test ./internal/daemon -run 'TestSanitizeUTF8' -count=1 -v
--- PASS: TestSanitizeUTF8_ValidStringUnchanged
--- PASS: TestSanitizeUTF8_InvalidStringBecomesValid
--- PASS: TestSanitizeUTF8Slice

Validation

  • go build ./...
  • go test ./internal/daemon -count=1
  • go test ./test/integration -run TestPs -count=1
  • make lint
  • Note: go test ./... currently reports a pre-existing failure in internal/cli (TestApplyConfigDefaultsFallbacks, config schema EOF), unrelated to this daemon change.

Refs: orch-438

@proboscis proboscis merged commit a0dbf16 into main Feb 11, 2026
1 of 2 checks passed
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