Skip to content

Fix null byte ArgumentError in results API#154

Merged
mateusdeap merged 1 commit intorailsbump:mainfrom
JuanVqz:feature/fix-null-byte
Mar 27, 2026
Merged

Fix null byte ArgumentError in results API#154
mateusdeap merged 1 commit intorailsbump:mainfrom
JuanVqz:feature/fix-null-byte

Conversation

@JuanVqz
Copy link
Copy Markdown
Member

@JuanVqz JuanVqz commented Mar 24, 2026

Summary

  • Strip null bytes (\x00) from result params in API::ResultsController#create before saving to PostgreSQL
  • Add test reproducing the exact ArgumentError: string contains null byte from Sentry

Context

The checker workflow sometimes returns output strings containing null bytes (e.g. from bundler error traces). PostgreSQL text columns reject null bytes, causing an unhandled ArgumentError when Compat#process_result tries to save.

Sentry issue: https://ombu-ai.sentry.io/issues/7361326341/

Test plan

  • Added test that sends result params with null bytes, verified it fails without the fix
  • Applied sanitize_result_params! before_action, verified all tests pass

Checker results sometimes contain null bytes (\x00) in string fields
like output. PostgreSQL rejects these when saving to text columns,
causing an ArgumentError: "string contains null byte".

Add a before_action filter that strips null bytes from result params
before processing.

Sentry: https://ombu-ai.sentry.io/issues/7361326341/
@JuanVqz JuanVqz self-assigned this Mar 24, 2026
@JuanVqz JuanVqz added the sentry label Mar 24, 2026
@JuanVqz JuanVqz requested review from a team and etagwerker March 24, 2026 22:50
@JuanVqz JuanVqz marked this pull request as ready for review March 24, 2026 22:52
@mateusdeap mateusdeap merged commit 316ef9d into railsbump:main Mar 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants