Skip to content

Commit

Permalink
Skip capturing cookie header when it's set separately
Browse files Browse the repository at this point in the history
  • Loading branch information
estolfo authored and picandocodigo committed Nov 28, 2023
1 parent bbca7e5 commit 6bd0311
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/elastic_apm/context_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ def apply_to_request(context, rack_env:, for_type:)
request.env = env if config.capture_env?

request.cookies = req.cookies.dup
unless request.cookies.empty?
request.headers['Cookie'] = SKIPPED if request.headers.has_key?('Cookie')
end

context
end
Expand Down
2 changes: 1 addition & 1 deletion spec/elastic_apm/context_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ module ElasticAPM

expect(request.headers).to eq(
'Content-Type' => 'application/json',
'Cookie' => 'things=1'
'Cookie' => '[SKIPPED]'
)
end

Expand Down

0 comments on commit 6bd0311

Please sign in to comment.