Skip to content

Raven shouldn't raise an exception on improperly encoded data #389

@jason-o-matic

Description

@jason-o-matic

I can see an argument for "fail fast" as well, but just in case you want to add some extra error handling I ran into this issue:

[13] pry(main)> Raven.capture_exception(Exception.new("GIF89a\u0001\u0000\u0001\u0000\x80\xFF\u0000\xFF\xFF\xFF\u0000\u0000\u0000,\u0000\u0000\u0000\u0000\u0001\u0000\u0001\u0000\u0000\u0002\u0002D\u0001\u0000;"))
ArgumentError: invalid byte sequence in UTF-8
from /data/docraptor/shared/bundle/ruby/2.2.0/gems/sentry-raven-0.13.3/lib/raven/processor/sanitizedata.rb:31:in `match'

The string is gif data, but as written the string ends up having a UTF8 encoding. This means gif =~ /asdf/ raises an exception. It might be worth updating the sanitizer to handle this. Perhaps the sanitizer could replace this value with a dummy string saying the original string had a bad encoding, or could force a binary encoding.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions