Repository navigation
Specs - Scrub X-Mailgun-Key-Id from VCR cassettes - #403
Merged
Merged
Conversation
The key ID Mailgun returns in the X-Mailgun-Key-Id header is the last part of the API key (<secret>-<key id>), so recorded cassettes exposed the tail of the keys that recorded them. - Replace the 5 key IDs (73 header values in 11 cassettes) with <KEY_ID>; requests, response bodies and matching are unchanged - Add a VCR before_record hook that replaces the header on future recordings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Mailgun returns the ID of the key used for a request in the
X-Mailgun-Key-Idresponse header. That ID is the last part of the API key itself (<secret>-<key id>), and the existing cassettes recorded it unfiltered, so they exposed the tail of the keys that recorded them. The secret part of a key is never in the header.<KEY_ID>. Only that header changes: requests, response bodies and request matching are untouched.before_recordhook inspec_helper.rbthat replaces the header (any case) on future recordings, alongside the existing key, auth and domain filters.Full suite, run without credentials: 413 examples, 0 failures, and no cassette changes during the run. The hook was checked separately against a recorded-style interaction.
The keys these IDs belong to may be worth rotating, since their IDs have been public in the repo's history.