Skip to content

Commit

Permalink
Merge pull request contentful#249 from ghepting/gary/redact-cma-token…
Browse files Browse the repository at this point in the history
…s-from-vcr-cassettes

configure VCR to redact CMA tokens
  • Loading branch information
rubydog authored Oct 13, 2022
2 parents ee7cd93 + 028b66b commit 6cc9061
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Change Log

## Master
* Configured VCR to redact sensitive data

## 3.6.0
* Updated readme for Entry References
Expand Down
9 changes: 9 additions & 0 deletions spec/support/vcr.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
c.ignore_localhost = true
c.hook_into :webmock
c.default_cassette_options = {record: :once}

# Redact Contentful Management API tokens from VCR recordings
c.filter_sensitive_data('<ACCESS_TOKEN>') do |interaction|
if (auths = interaction.request.headers['Authorization']&.first)
if (match = auths.match(/^Bearer\s+([^,\s]+)/))
match.captures.first
end
end
end
end

def vcr(name, &block)
Expand Down

0 comments on commit 6cc9061

Please sign in to comment.