mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-26 01:33:22 +00:00
Fix filtering of sensible data
* Hide Stripe Client User Agent header, it contains the hostname of the machine generating the cassettes * Hide client_secret
This commit is contained in:
@@ -14,6 +14,3 @@ SITE_URL="test.host"
|
||||
|
||||
OPENID_APP_ID="test-provider"
|
||||
OPENID_APP_SECRET="12345"
|
||||
|
||||
CLIENT_SECRET =~ /secret.+/
|
||||
HOSTNAME =~ /"hostname":".+"/
|
||||
|
||||
@@ -16,9 +16,13 @@ VCR.configure do |config|
|
||||
STRIPE_ACCOUNT
|
||||
STRIPE_CLIENT_ID
|
||||
STRIPE_ENDPOINT_SECRET
|
||||
CLIENT_SECRET
|
||||
HOSTNAME
|
||||
].each do |env_var|
|
||||
config.filter_sensitive_data("<HIDDEN-#{env_var}>") { ENV.fetch(env_var, nil) }
|
||||
end
|
||||
config.filter_sensitive_data('<HIDDEN-STRIPE-USER-AGENT>') { |interaction|
|
||||
interaction.request.headers['X-Stripe-Client-User-Agent']&.public_send(:[], 0)
|
||||
}
|
||||
config.filter_sensitive_data('<HIDDEN-CLIENT-SECRET>') { |interaction|
|
||||
interaction.response.body.match(/"client_secret": "(pi_.+)"/)&.public_send(:[], 1)
|
||||
}
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user