-
Notifications
You must be signed in to change notification settings - Fork 881
fix: replace invalid utf-8 sequences in agent logs #13436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should have a regression test
Is it possible to backport this to stable branch? We are facing this error in production too. Coder Version v2.10.3 |
codersdk/agentsdk/convert.go
Outdated
@@ -348,7 +348,7 @@ func ProtoFromLog(log Log) (*proto.Log, error) { | |||
} | |||
return &proto.Log{ | |||
CreatedAt: timestamppb.New(log.CreatedAt), | |||
Output: log.Output, | |||
Output: strings.ToValidUTF8(log.Output, ""), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should probably replace invalid utf-8 with something, so it's obvious data is being deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we get cute and replace with something like ❌ or 😞 or 🤬, or just something like <<invalid UTF-8>>
?
Signed-off-by: Spike Curtis <spike@coder.com>
Decided to just be bold and add the regression test and replacement with ❌ --- @coadler @kylecarbs revert me if you disagree. |
@MrPeacockNLB I think our policy for fixes unrelated to security is to backport to stable, which is 2.11 as of today. |
Fixes #13433.