Skip to content

on processor/cookie generate_masked_cookies called with a String #998

@nonnenmacher

Description

@nonnenmacher

the method generate_masked_cookie is coded as

def generate_masked_cookies(cookies)
      cookies.merge(cookies) { STRING_MASK }
    end

but on my API server (Grape + Rack & Puma)
the variable cookies is String like "(....)" result is a double exception in Sentry
where on top of the captured expression I get

NoMethodError
undefined method `merge' for "(...)":String
raven/processor/cookies.rb in generate_masked_cookies at line 33

would it be reasonable to check a little bit more if cookie quack as Hash ?
with something along the line bellow

def generate_masked_cookies(cookies)
      return if cookies.nil?
      cookies.merge(cookies) { STRING_MASK }   if cookies.respond_to?(:merge)
end

It work well for me and I retrieved the proper capture inside Sentry along with proper execution of my
code, instead of the 'exception during captured exception' as with thus issue.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions