Skip to content

file: validate output path for OS-specific invalid characters - #4053

Merged
twmb merged 1 commit into
mainfrom
1005
Jun 23, 2026
Merged

file: validate output path for OS-specific invalid characters#4053
twmb merged 1 commit into
mainfrom
1005

Conversation

@twmb

@twmb twmb commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

Override the benthos file output with a connect-local implementation that rejects characters causing silent data loss: colons on macOS (HFS+/APFS maps ':' to '/'), and <, >, :, ", |, ?, * plus control characters on Windows. NUL bytes are rejected on all platforms.

Fixes #1005.

@claude

claude Bot commented Mar 2, 2026

Copy link
Copy Markdown

Claude finished @twmb's task in 4m 40s —— View job


  • Setup: fetch PR data and read agent guidelines
  • Step 1: Commit policy validation
  • Step 2: Code review
  • Step 3: Post summary

Commits

LGTM

Review

Clean implementation that overrides the benthos file output to add OS-specific path validation. Registration pattern, field name constants, config parsing, mutex usage, and test structure all follow project conventions. One minor pattern violation found.

  1. Error wrap prefix at output_file.go#L187 uses "path interpolation error: %w" instead of gerund form ("interpolating path: %w") per godev.md.

Comment thread internal/impl/io/output_file.go Outdated
@claude

This comment was marked as resolved.

@mmatczuk

mmatczuk commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

Comment thread internal/impl/io/output_file.go
@claude

This comment was marked as resolved.

Override the benthos file output with a connect-local implementation
that rejects characters causing silent data loss: colons on macOS
(HFS+/APFS maps ':' to '/'), and <, >, :, ", |, ?, * plus control
characters on Windows. NUL bytes are rejected on all platforms.

Fixes #1005.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@claude

claude Bot commented Apr 22, 2026

Copy link
Copy Markdown

Commits
LGTM

Review
Override of the benthos file output to reject characters that cause silent data loss on Windows/macOS/all platforms. The new validateFilePath logic is well-covered by a table-driven unit test across platforms.

LGTM

@twmb
twmb merged commit 43e883f into main Jun 23, 2026
7 of 8 checks passed
@twmb
twmb deleted the 1005 branch June 23, 2026 21:51
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.

Invalid output file name succeeds ambiguously

3 participants