Skip to content

Commit

Permalink
feat: Adding demo regex checker for IP redaction
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardLitt committed Oct 4, 2024
1 parent 9dd0537 commit 793c86c
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
46 changes: 46 additions & 0 deletions tests/fixtures/DEMO.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
http_interactions:
- request:
method: get
uri: http://ipinfo.io/
body:
encoding: ''
string: ''
headers:
Accept: application/json, text/xml, application/xml, */*
response:
status:
status_code: 200
category: Success
reason: OK
message: 'Success: (200) OK'
headers:
access-control-allow-origin: '*'
content-encoding: gzip
content-type: application/json; charset=utf-8
date: Fri, 04 Oct 2024 01:00:32 GMT
referrer-policy: strict-origin-when-cross-origin
vary: Accept-Encoding
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
content-length: '247'
via: 1.1 google
strict-transport-security: max-age=2592000; includeSubDomains
body:
encoding: ''
file: no
string: |-
{
"ip": "redacted",
"hostname": "redacted",
"city": "Wellington",
"region": "Wellington Region",
"country": "NZ",
"loc": "-41.2866,174.7756",
"org": "redacted",
"postal": "6021",
"timezone": "Pacific/Auckland",
"readme": "https://ipinfo.io/missingauth"
}
recorded_at: 2024-10-04 01:00:32 GMT
recorded_with: vcr/1.6.0, webmockr/0.9.0
6 changes: 6 additions & 0 deletions tests/testthat/helper-vcr.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
library("vcr") # *Required* as vcr is set up on loading
invisible(vcr::vcr_configure(
filter_sensitive_data = list("<<<redacted>>>" = Sys.getenv('EBIRD_KEY')),
# Remove sensitive information about tester from cassettes
filter_sensitive_data_regex = list(
'"ip": "redacted"' = '"ip": "[0-9.]+"',
'"hostname": "redacted"' = '"hostname": "[^"]*"',
'"org": "redacted"' = '"org": "[^"]*"'
),
dir = vcr::vcr_test_path("fixtures")
))
vcr::check_cassette_names()
Expand Down

0 comments on commit 793c86c

Please sign in to comment.