Skip to content

Commit 594484b

Browse files
pbolingautobolt
andcommitted
🔒️ Redact sensitive values from debug logging output
- Add `OAuth2.config[:filtered_label]` to configure the placeholder used for filtered sensitive values in inspected objects and debug logging output. - Add `OAuth2.config[:filtered_debug_keys]` to configure which key names have their values redacted from debug logging output. - Add `OAuth2::ThingFilter` as the shared filtering primitive used by inspect-time and debug-log filtering. - Make inspect-time and debug-log filters snapshot their configuration at initialization time rather than tracking later config changes. - Automatically redacted values include: - Authorization headers - common token/secret fields in headers - query strings - form bodies - JSON payloads - NOTE: debug logging has always been, and remains, opt-in. It is turned off by default. Co-authored-by: autobolt <autobots@9thbit.net>
1 parent 31bc13c commit 594484b

61 files changed

Lines changed: 685 additions & 18569 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.rubocop.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ inherit_mode:
1919
AllCops:
2020
DisplayCopNames: true # Display the name of the failing cops
2121
Exclude:
22+
- 'bin/*'
2223
- 'gemfiles/vendor/**/*'
2324
- 'vendor/**/*'
2425
- '**/.irbrc'

.rubocop_gradual.lock

Lines changed: 0 additions & 27 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,14 @@ Please file a bug if you notice a violation of semantic versioning.
2020

2121
### Added
2222

23+
- [gh!707][gh!707] Add `OAuth2.config[:filtered_label]` to configure the placeholder used for filtered sensitive values in inspected objects and debug logging output by @pboling
24+
- [gh!707][gh!707] Add `OAuth2.config[:filtered_debug_keys]` to configure which key names have their values redacted from debug logging output by @pboling
25+
- [gh!707][gh!707] Add `OAuth2::ThingFilter` as the shared filtering primitive used by inspect-time and debug-log filtering by @pboling
26+
2327
### Changed
2428

29+
- [gh!707][gh!707] Make inspect-time and debug-log filters snapshot their configuration at initialization time rather than tracking later config changes by @pboling
30+
2531
### Deprecated
2632

2733
### Removed
@@ -30,6 +36,11 @@ Please file a bug if you notice a violation of semantic versioning.
3036

3137
### Security
3238

39+
- [gh!707][gh!707] Redact sensitive values from debug logging output, including Authorization headers and common token/secret fields in headers, query strings, form bodies, and JSON payloads by @pboling
40+
- NOTE: debug logging has always been, and remains, opt-in. It is turned off by defualt.
41+
42+
[gh!707]: https://github.com/ruby-oauth/oauth2/pull/707
43+
3344
## [2.0.18] - 2025-11-08
3445

3546
- TAG: [v2.0.18][2.0.18t]
@@ -54,8 +65,6 @@ Please file a bug if you notice a violation of semantic versioning.
5465
- [gh!690][gh!690], [gh!691][gh!691], [gh!692][gh!692] - Add yard-fence
5566
- handle braces within code fences in markdown properly by @pboling
5667

57-
### Security
58-
5968
[gh!683]: https://github.com/ruby-oauth/oauth2/pull/683
6069
[gh!684]: https://github.com/ruby-oauth/oauth2/pull/684
6170
[gh!685]: https://github.com/ruby-oauth/oauth2/pull/685
@@ -196,8 +205,6 @@ Please file a bug if you notice a violation of semantic versioning.
196205

197206
- [gh!660][gh!660] - Links in README (including link to HEAD documentation) by @pboling
198207

199-
### Security
200-
201208
[gh!660]: https://github.com/ruby-oauth/oauth2/pull/660
202209
[gh!657]: https://github.com/ruby-oauth/oauth2/pull/657
203210
[gh!656]: https://github.com/ruby-oauth/oauth2/pull/656

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,19 @@ OAuth2.configure do |config|
330330
end
331331
```
332332

333+
Filtering-related settings:
334+
335+
```ruby
336+
OAuth2.configure do |config|
337+
config.filtered_label = "[REDACTED]" # default: "[FILTERED]"
338+
config.filtered_debug_keys += ["client_assertion"]
339+
end
340+
```
341+
342+
- `filtered_label` controls the placeholder used when sensitive values are filtered from inspected objects and debug logging output.
343+
- `filtered_debug_keys` controls which key names have their values redacted from debug logging output when `OAUTH_DEBUG=true`.
344+
- Debug logging remains opt-in and should still be used cautiously in production environments.
345+
333346
## 🔧 Basic Usage
334347

335348
### Client Initialization Options

0 commit comments

Comments
 (0)