Skip to content

Commit cfd0a3e

Browse files
authored
Merge branch 'main' into dependabot/github_actions/github-actions-50048bcef6
2 parents 47af9f0 + 476d949 commit cfd0a3e

5 files changed

Lines changed: 51 additions & 2 deletions

File tree

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ GEM
4949
date
5050
stringio
5151
racc (1.8.1)
52-
rack (3.1.12)
52+
rack (3.1.14)
5353
rainbow (3.1.1)
5454
rdoc (6.13.1)
5555
psych (>= 4.0.0)

lib/patterns/default.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ module Patterns
4747
# Vault Tokens
4848
# https://github.com/hashicorp/vault/issues/27151
4949
/[sbr]\.[a-zA-Z0-9]{24,}/, # <= 1.9.x
50-
/hv[sbr]\.[a-zA-Z0-9]{24,}/ # >= 1.10
50+
/hv[sbr]\.[a-zA-Z0-9]{24,}/, # >= 1.10
51+
52+
# Authorization bearer tokens
53+
# https://datatracker.ietf.org/doc/html/rfc6750#section-2.1
54+
/(?i)authorization:\s+bearer\s+[A-Za-z0-9\-_\.=~+\/]+/,
5155
].freeze
5256
end

spec/lib/redacting_logger_spec.rb

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,51 @@
160160
case: "redacts a RubyGems token",
161161
message: "using rubygems token: rubygems_0123456789abcdef0123456789abcdef0123456789abcdef",
162162
expected_message: "using rubygems token: [REDACTED]"
163+
},
164+
{
165+
case: "redacts authorization bearer token",
166+
message: '-H "Authorization: Bearer ab123456789a1abcd1~_.-+456ABCDE=" -H "Content-Type: application/json"',
167+
expected_message: '-H "[REDACTED]" -H "Content-Type: application/json"'
168+
},
169+
{
170+
case: "redacts authorization bearer token with case insensitivity",
171+
message: '-H "authorizAtion: beaRer ab123456789a1abcd1~_.-+456ABCDE=" -H "Content-Type: application/json"',
172+
expected_message: '-H "[REDACTED]" -H "Content-Type: application/json"'
173+
},
174+
{
175+
case: "redacts authorization bearer token with extra spaces and tabs",
176+
message: "authorization: bearer abcd1234",
177+
expected_message: "[REDACTED]"
178+
},
179+
{
180+
case: "redacts authorization bearer token with special characters",
181+
message: "authorization: bearer aBcD-_=~+/1234",
182+
expected_message: "[REDACTED]"
183+
},
184+
{
185+
case: "redacts authorization bearer token at start of string",
186+
message: "authorization: bearer tokenatstart",
187+
expected_message: "[REDACTED]"
188+
},
189+
{
190+
case: "redacts authorization bearer token at end of string",
191+
message: "some text authorization: bearer tokenatend",
192+
expected_message: "some text [REDACTED]"
193+
},
194+
{
195+
case: "redacts multiple authorization bearer tokens in one string",
196+
message: "authorization: bearer token1 and authorization: bearer token2",
197+
expected_message: "[REDACTED] and [REDACTED]"
198+
},
199+
{
200+
case: "redacts authorization bearer token with minimum plausible length",
201+
message: "authorization: bearer a",
202+
expected_message: "[REDACTED]"
203+
},
204+
{
205+
case: "redacts authorization bearer token with maximum plausible length",
206+
message: "authorization: bearer #{'a' * 256}",
207+
expected_message: "[REDACTED]"
163208
}
164209
].each do |test|
165210
it "redacts #{test[:case]}" do

vendor/cache/rack-3.1.12.gem

-110 KB
Binary file not shown.

vendor/cache/rack-3.1.14.gem

111 KB
Binary file not shown.

0 commit comments

Comments
 (0)