auth-sanitizer 0.2.1 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -1,18 +1,19 @@
1
- <a href="https://github.com/ruby-oauth"><img alt="ruby-oauth Logo by Aboling0, CC BY-SA 4.0" src="https://logos.galtzo.com/assets/images/ruby-oauth/avatar-128px.svg" width="14%" align="right"/></a>
1
+ <a href="https://github.com/ruby-oauth"><img alt="ruby-oauth Logo by GitHub" src="https://github.com/ruby-oauth.png?size=192" width="14%" align="right"/></a>
2
2
 
3
- # 💎 Auth::Sanitizer
3
+ # 🧼 Auth::Sanitizer
4
4
 
5
- [![Version][👽versioni]][👽version] [![GitHub tag (latest SemVer)][⛳️tag-img]][⛳️tag] [![License: MIT][📄license-img]][📄license] [![Downloads Rank][👽dl-ranki]][👽dl-rank] [![CodeCov Test Coverage][🏀codecovi]][🏀codecov] [![Coveralls Test Coverage][🏀coveralls-img]][🏀coveralls] [![QLTY Test Coverage][🏀qlty-covi]][🏀qlty-cov] [![QLTY Maintainability][🏀qlty-mnti]][🏀qlty-mnt] [![CI Heads][🚎3-hd-wfi]][🚎3-hd-wf] [![CI Runtime Dependencies @ HEAD][🚎12-crh-wfi]][🚎12-crh-wf] [![CI Current][🚎11-c-wfi]][🚎11-c-wf] [![CI Truffle Ruby][🚎9-t-wfi]][🚎9-t-wf] [![CI JRuby][🚎10-j-wfi]][🚎10-j-wf] [![Deps Locked][🚎13-🔒️-wfi]][🚎13-🔒️-wf] [![Deps Unlocked][🚎14-🔓️-wfi]][🚎14-🔓️-wf] [![CI Test Coverage][🚎2-cov-wfi]][🚎2-cov-wf] [![CI Style][🚎5-st-wfi]][🚎5-st-wf] [![Apache SkyWalking Eyes License Compatibility Check][🚎15-🪪-wfi]][🚎15-🪪-wf]
5
+ [![Version][👽versioni]][👽version] [![Ruby Users Forum][✉️ruby-forum-top-img]][✉️ruby-forum] [![GitHub tag (latest SemVer)][⛳️tag-img]][⛳️tag] [![License: MIT][📄license-img]][📄license] [![Total downloads][👽dl-ranki]][👽dl-rank] [![CodeCov Test Coverage][🏀codecovi]][🏀codecov] [![Coveralls Test Coverage][🏀coveralls-img]][🏀coveralls] [![QLTY Test Coverage][🏀qlty-covi]][🏀qlty-cov] [![QLTY Maintainability][🏀qlty-mnti]][🏀qlty-mnt] [![CI Heads][🚎3-hd-wfi]][🚎3-hd-wf] [![CI Runtime Dependencies @ HEAD][🚎12-crh-wfi]][🚎12-crh-wf] [![CI Current][🚎11-c-wfi]][🚎11-c-wf] [![CI Truffle Ruby][🚎9-t-wfi]][🚎9-t-wf] [![CI JRuby][🚎10-j-wfi]][🚎10-j-wf] [![Deps Locked][🚎13-🔒️-wfi]][🚎13-🔒️-wf] [![Deps Unlocked][🚎14-🔓️-wfi]][🚎14-🔓️-wf] [![CI Test Coverage][🚎2-cov-wfi]][🚎2-cov-wf] [![CI Style][🚎5-st-wfi]][🚎5-st-wf] [![Apache SkyWalking Eyes License Compatibility Check][🚎15-🪪-wfi]][🚎15-🪪-wf]
6
6
 
7
- `if ci_badges.map(&:color).detect { it != "green"}` ☝️ [let me know][✉️discord-invite], as I may have missed the [discord notification][✉️discord-invite].
7
+ `if ci_badges.map(&:color).detect { it != "green"}` ☝️ [let me know on Discord][✉️discord-invite] or [RubyForum][✉️ruby-forum], as I may have missed the notification.
8
8
 
9
9
  ---
10
10
 
11
11
  `if ci_badges.map(&:color).all? { it == "green"}` 👇️ send money so I can do more of this. FLOSS maintenance is now my full-time job.
12
12
 
13
- [![OpenCollective Backers][🖇osc-backers-i]][🖇osc-backers] [![OpenCollective Sponsors][🖇osc-sponsors-i]][🖇osc-sponsors] [![Sponsor Me on Github][🖇sponsor-img]][🖇sponsor] [![Liberapay Goal Progress][⛳liberapay-img]][⛳liberapay] [![Donate on PayPal][🖇paypal-img]][🖇paypal] [![Buy me a coffee][🖇buyme-small-img]][🖇buyme] [![Donate on Polar][🖇polar-img]][🖇polar] [![Donate at ko-fi.com][🖇kofi-img]][🖇kofi]
13
+ [![OpenCollective Backers][🖇osc-backers-i]][🖇osc-backers] [![OpenCollective Sponsors][🖇osc-sponsors-i]][🖇osc-sponsors] [![Sponsor Me on Github][🖇sponsor-img]][🖇sponsor] [![Liberapay Goal Progress][⛳liberapay-img]][⛳liberapay] [![Donate on PayPal][🖇paypal-img]][🖇paypal] [![Buy me a coffee][🖇buyme-small-img]][🖇buyme] [![Donate at ko-fi.com][🖇kofi-img]][🖇kofi]
14
+ <p><sub>Corporate sponsors: <a href="https://alpha-omega.dev"><img alt="Alpha-Omega" src="https://alpha-omega.dev/wp-content/uploads/sites/22/2023/05/logo.svg" height="24"/></a> <a href="https://serpapi.com"><img alt="SerpApi" src="https://serpapi.com/assets/media_kit/logo-with-wordmark.svg" height="24"/></a> <a href="#-floss-funding">Become a sponsor</a></sub></p>
14
15
 
15
- <details>
16
+ <details markdown="1">
16
17
  <summary>👣 How will this project approach the September 2025 hostile takeover of RubyGems? 🚑️</summary>
17
18
 
18
19
  I've summarized my thoughts in [this blog post](https://dev.to/galtzo/hostile-takeover-of-rubygems-my-thoughts-5hlo).
@@ -51,6 +52,15 @@ a provider, or per logger by passing `label:` to `Auth::Sanitizer::SanitizedLogg
51
52
  The library snapshots filter configuration when a redacting object is initialized. That keeps already-created objects
52
53
  and logger wrappers stable even if a host application changes its configuration later.
53
54
 
55
+ Use `Auth::Sanitizer.sanitize` when a value needs to be redacted before it is returned or included in an exception
56
+ message. It recursively copies hashes and arrays, redacts values under configured keys, and sanitizes strings using the
57
+ same formats as `SanitizedLogger`:
58
+
59
+ ```ruby
60
+ Auth::Sanitizer.sanitize(opts)
61
+ Auth::Sanitizer.sanitize(opts, filtered_keys: MyClient.config.filtered_keys, label: MyClient.config.filtered_label)
62
+ ```
63
+
54
64
  Consumers that need to avoid defining the generic top-level `Auth` namespace can use the isolated loader:
55
65
 
56
66
  ```ruby
@@ -63,6 +73,11 @@ The returned module is an anonymously namespaced `Auth::Sanitizer`, suitable for
63
73
  Use `require: false` in gems that want to avoid every new top-level namespace, including `AuthSanitizer`; see
64
74
  [Zero Top-Level Namespace Additions](#zero-top-level-namespace-additions).
65
75
 
76
+ Consumers that want a reusable resolver for that stricter loading mode can use
77
+ [`anonymous_loader`](https://github.com/ruby-oauth/anonymous_loader). It handles
78
+ explicit paths, RubyGems metadata, and `$LOAD_PATH` fallback resolution while evaluating
79
+ the loader under an anonymous namespace.
80
+
66
81
  This gem is used by the following libraries to ensure clean output:
67
82
 
68
83
  - oauth
@@ -75,13 +90,13 @@ This gem is used by the following libraries to ensure clean output:
75
90
 
76
91
  | Tokens to Remember | [![Gem name][⛳️name-img]][⛳️gem-name] [![Gem namespace][⛳️namespace-img]][⛳️gem-namespace] |
77
92
  |-------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
78
- | Works with JRuby | [![JRuby 9.2 Compat][💎jruby-9.2i]][🚎jruby-9.2-wf] [![JRuby 9.3 Compat][💎jruby-9.3i]][🚎jruby-9.3-wf] <br/> [![JRuby 9.4 Compat][💎jruby-9.4i]][🚎jruby-9.4-wf] [![JRuby current Compat][💎jruby-c-i]][🚎10-j-wf] [![JRuby HEAD Compat][💎jruby-headi]][🚎3-hd-wf]|
79
- | Works with Truffle Ruby | [![Truffle Ruby 22.3 Compat][💎truby-22.3i]][🚎truby-22.3-wf] [![Truffle Ruby 23.0 Compat][💎truby-23.0i]][🚎truby-23.0-wf] [![Truffle Ruby 23.1 Compat][💎truby-23.1i]][🚎truby-23.1-wf] <br/> [![Truffle Ruby 24.2 Compat][💎truby-24.2i]][🚎truby-24.2-wf] [![Truffle Ruby 25.0 Compat][💎truby-25.0i]][🚎truby-25.0-wf] [![Truffle Ruby current Compat][💎truby-c-i]][🚎9-t-wf]|
80
- | Works with MRI Ruby 4 | [![Ruby 4.0 Compat][💎ruby-4.0i]][🚎11-c-wf] [![Ruby current Compat][💎ruby-c-i]][🚎11-c-wf] [![Ruby HEAD Compat][💎ruby-headi]][🚎3-hd-wf]|
93
+ | Works with JRuby | [![JRuby 9.2 Compat][💎jruby-9.2i]][🚎jruby-9.2-wf] [![JRuby 9.3 Compat][💎jruby-9.3i]][🚎jruby-9.3-wf] <br/> [![JRuby 9.4 Compat][💎jruby-9.4i]][🚎jruby-9.4-wf] [![JRuby 10.0 Compat][💎jruby-10.0i]][🚎jruby-10.0-wf] [![JRuby current Compat][💎jruby-c-i]][🚎10-j-wf] [![JRuby HEAD Compat][💎jruby-headi]][🚎3-hd-wf]|
94
+ | Works with Truffle Ruby | [![Truffle Ruby 22.3 Compat][💎truby-22.3i]][🚎truby-22.3-wf] [![Truffle Ruby 23.1 Compat][💎truby-23.1i]][🚎truby-23.1-wf] <br/> [![Truffle Ruby 24.2 Compat][💎truby-24.2i]][🚎truby-24.2-wf] [![Truffle Ruby 25.0 Compat][💎truby-25.0i]][🚎truby-25.0-wf] [![Truffle Ruby 33.0 Compat][💎truby-33.0i]][🚎truby-33.0-wf] [![Truffle Ruby current Compat][💎truby-c-i]][🚎9-t-wf]|
95
+ | Works with MRI Ruby 4 | [![Ruby current Compat][💎ruby-c-i]][🚎11-c-wf] [![Ruby HEAD Compat][💎ruby-headi]][🚎3-hd-wf]|
81
96
  | Works with MRI Ruby 3 | [![Ruby 3.0 Compat][💎ruby-3.0i]][🚎ruby-3.0-wf] [![Ruby 3.1 Compat][💎ruby-3.1i]][🚎ruby-3.1-wf] [![Ruby 3.2 Compat][💎ruby-3.2i]][🚎ruby-3.2-wf] [![Ruby 3.3 Compat][💎ruby-3.3i]][🚎ruby-3.3-wf] [![Ruby 3.4 Compat][💎ruby-3.4i]][🚎ruby-3.4-wf]|
82
97
  | Works with MRI Ruby 2 | ![Ruby 2.2 Compat][💎ruby-2.2i] ![Ruby 2.3 Compat][💎ruby-2.3i] <br/> [![Ruby 2.4 Compat][💎ruby-2.4i]][🚎ruby-2.4-wf] [![Ruby 2.5 Compat][💎ruby-2.5i]][🚎ruby-2.5-wf] [![Ruby 2.6 Compat][💎ruby-2.6i]][🚎ruby-2.6-wf] [![Ruby 2.7 Compat][💎ruby-2.7i]][🚎ruby-2.7-wf]|
83
- | Support & Community | [![Join Me on Daily.dev's RubyFriends][✉️ruby-friends-img]][✉️ruby-friends] [![Live Chat on Discord][✉️discord-invite-img-ftb]][✉️discord-invite] [![Get help from me on Upwork][👨🏼‍🏫expsup-upwork-img]][👨🏼‍🏫expsup-upwork] [![Get help from me on Codementor][👨🏼‍🏫expsup-codementor-img]][👨🏼‍🏫expsup-codementor] |
84
- | Source | [![Source on GitLab.com][📜src-gl-img]][📜src-gl] [![Source on CodeBerg.org][📜src-cb-img]][📜src-cb] [![Source on Github.com][📜src-gh-img]][📜src-gh] [![The best SHA: dQw4w9WgXcQ!][🧮kloc-img]][🧮kloc] |
98
+ | Support & Community | [![Join Me on Daily.dev's RubyFriends][✉️ruby-friends-img]][✉️ruby-friends] [![Get help from RubyForum][✉️ruby-forum-img]][✉️ruby-forum] [![Live Chat on Discord][✉️discord-invite-img-ftb]][✉️discord-invite] [![Get help from me on Upwork][👨🏼‍🏫expsup-upwork-img]][👨🏼‍🏫expsup-upwork] [![Get help from me on Codementor][👨🏼‍🏫expsup-codementor-img]][👨🏼‍🏫expsup-codementor] |
99
+ | Source | [![Source on GitLab.com][📜src-gl-img]][📜src-gl] [![Source on CodeBerg.org][📜src-cb-img]][📜src-cb] [![Source on GitHub.com][📜src-gh-img]][📜src-gh] [![The best SHA: dQw4w9WgXcQ!][🧮kloc-img]][🧮kloc] |
85
100
  | Documentation | [![Current release on RubyDoc.info][📜docs-cr-rd-img]][🚎yard-current] [![YARD on Galtzo.com][📜docs-head-rd-img]][🚎yard-head] [![Maintainer Blog][🚂maint-blog-img]][🚂maint-blog] [![GitLab Wiki][📜gl-wiki-img]][📜gl-wiki] [![GitHub Wiki][📜gh-wiki-img]][📜gh-wiki] |
86
101
  | Compliance | [![License: MIT][📄license-img]][📄license] [![Apache license compatibility: Category A][📄license-compat-img]][📄license-compat] [![📄ilo-declaration-img]][📄ilo-declaration] [![Security Policy][🔐security-img]][🔐security] [![Contributor Covenant 2.1][🪇conduct-img]][🪇conduct] [![SemVer 2.0.0][📌semver-img]][📌semver] |
87
102
  | Style | [![Enforced Code Style Linter][💎rlts-img]][💎rlts] [![Keep-A-Changelog 1.0.0][📗keep-changelog-img]][📗keep-changelog] [![Gitmoji Commits][📌gitmoji-img]][📌gitmoji] [![Compatibility appraised by: appraisal2][💎appraisal2-img]][💎appraisal2] |
@@ -90,54 +105,54 @@ This gem is used by the following libraries to ensure clean output:
90
105
 
91
106
  ### Compatibility
92
107
 
93
- Compatible with MRI Ruby 2.2.0+, and concordant releases of JRuby, and TruffleRuby.
108
+ Compatible with MRI Ruby 2.2.0+, JRuby, and TruffleRuby.
94
109
  CI workflows and Appraisals are generated for MRI Ruby 2.4+.
110
+ The current MRI CI lane runs on Linux and macOS.
95
111
  This test floor is configured by `ruby.test_minimum` in `.kettle-jem.yml` and
96
112
  may be higher than the gem's runtime compatibility floor when legacy Rubies are
97
113
  not practical for the current toolchain.
98
114
 
99
- | 🚚 _Amazing_ test matrix was brought to you by | 🔎 appraisal2 🔎 and the color 💚 green 💚 |
100
- |------------------------------------------------|--------------------------------------------------------|
101
- | 👟 Check it out! | ✨ [github.com/appraisal-rb/appraisal2][💎appraisal2] ✨ |
115
+ <a href="https://github.com/kettle-dev"><img alt="kettle-dev Logo by Aboling0, CC BY-SA 4.0" src="https://logos.galtzo.com/assets/images/kettle-dev/avatar-128px.svg" width="14%" align="right"/></a>
102
116
 
103
- ### Federated DVCS
117
+ The _amazing_ test matrix is powered by the kettle-dev stack.
104
118
 
105
119
  <details markdown="1">
106
- <summary>Find this repo on federated forges (Coming soon!)</summary>
107
-
108
- | Federated [DVCS][💎d-in-dvcs] Repository | Status | Issues | PRs | Wiki | CI | Discussions |
109
- |-------------------------------------------------|-----------------------------------------------------------------------|---------------------------|--------------------------|---------------------------|--------------------------|------------------------------|
110
- | 🧪 [ruby-oauth/auth-sanitizer on GitLab][📜src-gl] | The Truth | [💚][🤝gl-issues] | [💚][🤝gl-pulls] | [💚][📜gl-wiki] | 🐭 Tiny Matrix | ➖ |
111
- | 🧊 [ruby-oauth/auth-sanitizer on CodeBerg][📜src-cb] | An Ethical Mirror ([Donate][🤝cb-donate]) | [💚][🤝cb-issues] | [💚][🤝cb-pulls] | ➖ | ⭕️ No Matrix | ➖ |
112
- | 🐙 [ruby-oauth/auth-sanitizer on GitHub][📜src-gh] | Another Mirror | [💚][🤝gh-issues] | [💚][🤝gh-pulls] | [💚][📜gh-wiki] | 💯 Full Matrix | [💚][gh-discussions] |
113
- | 🎮️ [Discord Server][✉️discord-invite] | [![Live Chat on Discord][✉️discord-invite-img-ftb]][✉️discord-invite] | [Let's][✉️discord-invite] | [talk][✉️discord-invite] | [about][✉️discord-invite] | [this][✉️discord-invite] | [library!][✉️discord-invite] |
120
+ <summary>How kettle-dev manages complexity in tests</summary>
121
+
122
+ | Gem | Source | Role | Total downloads |
123
+ |-----|--------|------|---------------------|
124
+ | [appraisal2](https://clickgems.clickhouse.com/dashboard/appraisal2) | [GitHub](https://github.com/appraisal-rb/appraisal2) | multi-dependency Appraisal matrix generation | [![Total downloads for appraisal2](https://img.shields.io/gem/dt/appraisal2.svg?style=flat-square)](https://clickgems.clickhouse.com/dashboard/appraisal2) |
125
+ | [appraisal2-rubocop](https://clickgems.clickhouse.com/dashboard/appraisal2-rubocop) | [GitHub](https://github.com/appraisal-rb/appraisal2-rubocop) | RuboCop Appraisal generator integration | [![Total downloads for appraisal2-rubocop](https://img.shields.io/gem/dt/appraisal2-rubocop.svg?style=flat-square)](https://clickgems.clickhouse.com/dashboard/appraisal2-rubocop) |
126
+ | [kettle-dev](https://clickgems.clickhouse.com/dashboard/kettle-dev) | [GitHub](https://github.com/kettle-dev/kettle-dev) | development, release, and CI workflow tooling | [![Total downloads for kettle-dev](https://img.shields.io/gem/dt/kettle-dev.svg?style=flat-square)](https://clickgems.clickhouse.com/dashboard/kettle-dev) |
127
+ | [kettle-jem](https://clickgems.clickhouse.com/dashboard/kettle-jem) | [GitHub](https://github.com/kettle-dev/kettle-jem) | Appraisals & CI workflow templates | [![Total downloads for kettle-jem](https://img.shields.io/gem/dt/kettle-jem.svg?style=flat-square)](https://clickgems.clickhouse.com/dashboard/kettle-jem) |
128
+ | [kettle-soup-cover](https://clickgems.clickhouse.com/dashboard/kettle-soup-cover) | [GitHub](https://github.com/kettle-dev/kettle-soup-cover) | SimpleCov coverage policy and reporting | [![Total downloads for kettle-soup-cover](https://img.shields.io/gem/dt/kettle-soup-cover.svg?style=flat-square)](https://clickgems.clickhouse.com/dashboard/kettle-soup-cover) |
129
+ | [kettle-test](https://clickgems.clickhouse.com/dashboard/kettle-test) | [GitHub](https://github.com/kettle-dev/kettle-test) | standard test runner and coverage harness | [![Total downloads for kettle-test](https://img.shields.io/gem/dt/kettle-test.svg?style=flat-square)](https://clickgems.clickhouse.com/dashboard/kettle-test) |
130
+ | [rubocop-lts](https://clickgems.clickhouse.com/dashboard/rubocop-lts) | [GitHub](https://github.com/rubocop-lts/rubocop-lts) | Ruby-version-aware linting | [![Total downloads for rubocop-lts](https://img.shields.io/gem/dt/rubocop-lts.svg?style=flat-square)](https://clickgems.clickhouse.com/dashboard/rubocop-lts) |
131
+ | [turbo_tests2](https://clickgems.clickhouse.com/dashboard/turbo_tests2) | [GitHub](https://github.com/galtzo-floss/turbo_tests2) | parallel test execution | [![Total downloads for turbo_tests2](https://img.shields.io/gem/dt/turbo_tests2.svg?style=flat-square)](https://clickgems.clickhouse.com/dashboard/turbo_tests2) |
114
132
 
115
133
  </details>
116
134
 
117
- [gh-discussions]: https://github.com/ruby-oauth/auth-sanitizer/discussions
118
-
119
- ### Enterprise Support [![Tidelift](https://tidelift.com/badges/package/rubygems/auth-sanitizer)](https://tidelift.com/subscription/pkg/rubygems-auth-sanitizer?utm_source=rubygems-auth-sanitizer&utm_medium=referral&utm_campaign=readme)
120
-
121
- Available as part of the Tidelift Subscription.
135
+ ### Federated DVCS
122
136
 
123
137
  <details markdown="1">
124
- <summary>Need enterprise-level guarantees?</summary>
138
+ <summary>Find this repo on federated forges (Coming soon!)</summary>
125
139
 
126
- The maintainers of this and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use.
140
+ | Federated [DVCS][💎d-in-dvcs] Repository | Status | Issues | PRs | Wiki | CI |
141
+ |-------------------------------------------------|-------------------------------------------|-------------------|------------------|-----------------|----------------|
142
+ | 🧪 [ruby-oauth/auth-sanitizer on GitLab][📜src-gl] | The Truth | [💚][🤝gl-issues] | [💚][🤝gl-pulls] | [💚][📜gl-wiki] | 🐭 Tiny Matrix |
143
+ | 🧊 [ruby-oauth/auth-sanitizer on CodeBerg][📜src-cb] | An Ethical Mirror ([Donate][🤝cb-donate]) | [💚][🤝cb-issues] | [💚][🤝cb-pulls] | ➖ | ⭕️ No Matrix |
144
+ | 🐙 [ruby-oauth/auth-sanitizer on GitHub][📜src-gh] | Another Mirror | [💚][🤝gh-issues] | [💚][🤝gh-pulls] | [💚][📜gh-wiki] | 💯 Full Matrix |
127
145
 
128
- [![Get help from me on Tidelift][🏙️entsup-tidelift-img]][🏙️entsup-tidelift]
146
+ </details>
129
147
 
130
- - 💡Subscribe for support guarantees covering _all_ your FLOSS dependencies
131
- - 💡Tidelift is part of [Sonar][🏙️entsup-tidelift-sonar]
132
- - 💡Tidelift pays maintainers to maintain the software you depend on!<br/>📊`@`Pointy Haired Boss: An [enterprise support][🏙️entsup-tidelift] subscription is "[never gonna let you down][🧮kloc]", and *supports* open source maintainers
148
+ ### Enterprise Support
133
149
 
134
- Alternatively:
150
+ For enterprise support from the maintainer, use [Upwork][👨🏼‍🏫expsup-upwork] or [CodeMentor][👨🏼‍🏫expsup-codementor].
135
151
 
136
- - [![Live Chat on Discord][✉️discord-invite-img-ftb]][✉️discord-invite]
137
- - [![Get help from me on Upwork][👨🏼‍🏫expsup-upwork-img]][👨🏼‍🏫expsup-upwork]
138
- - [![Get help from me on Codementor][👨🏼‍🏫expsup-codementor-img]][👨🏼‍🏫expsup-codementor]
152
+ Other support channels:
139
153
 
140
- </details>
154
+ - [![Ruby Users Forum][✉️ruby-forum-img]][✉️ruby-forum]
155
+ - [![Live Chat on Discord][✉️discord-invite-img-ftb]][✉️discord-invite]
141
156
 
142
157
  ## ✨ Installation
143
158
 
@@ -179,10 +194,10 @@ Libraries and applications that need to avoid the generic top-level `Auth` names
179
194
  ```ruby
180
195
  require "auth_sanitizer/loader"
181
196
 
182
- AUTH_SANITIZER = AuthSanitizer::Loader.load_isolated
197
+ auth_sanitizer = AuthSanitizer::Loader.load_isolated
183
198
 
184
- class TokenResponse
185
- include AUTH_SANITIZER::FilteredAttributes
199
+ token_response = Class.new do
200
+ include auth_sanitizer.const_get(:FilteredAttributes)
186
201
  end
187
202
  ```
188
203
 
@@ -205,71 +220,54 @@ gem "auth-sanitizer", require: "auth_sanitizer/loader"
205
220
  Use `require: false` when the consuming library will decide which loading mode to use internally. Use
206
221
  `require: "auth_sanitizer/loader"` when Bundler should make the isolated loader available during `Bundler.require`.
207
222
 
223
+ When Bundler standalone setup is loaded directly, a dependency can be present on `$LOAD_PATH` without a matching
224
+ `Gem.loaded_specs` entry or `GEM_PATH` entry. Consumers that locate the isolated loader themselves should therefore
225
+ use `AnonymousLoader.load_path`, or otherwise fall back to `Gem.find_files("auth_sanitizer/loader.rb")`, before failing.
226
+
208
227
  #### Zero Top-Level Namespace Additions
209
228
 
210
- A gem that needs zero new top-level namespaces from this dependency can load the loader itself inside an anonymous
211
- namespace. On Ruby 3.1+, use `Kernel.load(path, module)`:
229
+ For a gem that needs zero new top-level namespaces from `auth-sanitizer`, use `anonymous_loader` to evaluate
230
+ `auth_sanitizer/loader.rb` inside an anonymous namespace, then call `AuthSanitizer::Loader.load_isolated` from that
231
+ anonymous namespace:
212
232
 
213
233
  ```ruby
214
- auth_sanitizer_requirement = Gem::Requirement.new("~> 0.1", ">= 0.1.3")
215
- auth_sanitizer_spec = Gem.loaded_specs["auth-sanitizer"]
216
- unless auth_sanitizer_spec && auth_sanitizer_requirement.satisfied_by?(auth_sanitizer_spec.version)
217
- auth_sanitizer_spec = Gem::Specification.find_by_name("auth-sanitizer", auth_sanitizer_requirement)
218
- end
219
- auth_sanitizer_loader_path = File.join(
220
- auth_sanitizer_spec.full_gem_path,
221
- "lib/auth_sanitizer/loader.rb"
234
+ require "anonymous_loader"
235
+
236
+ auth_sanitizer_requirement = Gem::Requirement.new("~> 0.2", ">= 0.2.1")
237
+ auth_sanitizer_loader_namespace = AnonymousLoader.load_path(
238
+ gem_name: "auth-sanitizer",
239
+ require_path: "auth_sanitizer/loader.rb",
240
+ version_requirement: auth_sanitizer_requirement,
241
+ version_file: "auth/sanitizer/version.rb"
222
242
  )
223
- unless File.file?(auth_sanitizer_loader_path)
224
- raise LoadError, "auth-sanitizer #{auth_sanitizer_requirement} loader not found at #{auth_sanitizer_loader_path}"
225
- end
226
-
227
- auth_sanitizer_loader_namespace = Module.new
228
- Kernel.load(auth_sanitizer_loader_path, auth_sanitizer_loader_namespace)
229
243
 
230
- AUTH_SANITIZER = auth_sanitizer_loader_namespace
244
+ auth_sanitizer = auth_sanitizer_loader_namespace
231
245
  .const_get(:AuthSanitizer)
232
246
  .const_get(:Loader)
233
247
  .load_isolated
234
248
  ```
235
249
 
236
250
  That pattern leaves both `Auth` and `AuthSanitizer` undefined at top level. The consuming gem should assign the returned
237
- module under its own namespace and use that internal constant.
251
+ module under its own namespace and use that internal constant. It does define `AnonymousLoader`, whose namespace is
252
+ specific to the resolver gem and intentionally much less collision-prone than `Auth`.
238
253
 
239
- <details markdown="1">
240
- <summary>Ruby 2.2-compatible zero-top-level loading</summary>
241
-
242
- Ruby 2.2 through Ruby 3.0 do not support `Kernel.load(path, module)`. For those versions, evaluate the loader source
243
- inside an anonymous namespace with `Module#module_eval`:
254
+ Declare both dependencies with `require: false` when the consuming library owns its loading path:
244
255
 
245
256
  ```ruby
246
- auth_sanitizer_requirement = Gem::Requirement.new("~> 0.1", ">= 0.1.3")
247
- auth_sanitizer_spec = Gem.loaded_specs["auth-sanitizer"]
248
- unless auth_sanitizer_spec && auth_sanitizer_requirement.satisfied_by?(auth_sanitizer_spec.version)
249
- auth_sanitizer_spec = Gem::Specification.find_by_name("auth-sanitizer", auth_sanitizer_requirement)
250
- end
251
- auth_sanitizer_loader_path = File.join(
252
- auth_sanitizer_spec.full_gem_path,
253
- "lib/auth_sanitizer/loader.rb"
254
- )
255
- unless File.file?(auth_sanitizer_loader_path)
256
- raise LoadError, "auth-sanitizer #{auth_sanitizer_requirement} loader not found at #{auth_sanitizer_loader_path}"
257
- end
257
+ gem "anonymous_loader", "~> 0.1", ">= 0.1.0", require: false
258
+ gem "auth-sanitizer", "~> 0.2", ">= 0.2.1", require: false
259
+ ```
258
260
 
259
- auth_sanitizer_loader_namespace = Module.new
260
- auth_sanitizer_loader_namespace.module_eval(
261
- File.read(auth_sanitizer_loader_path),
262
- auth_sanitizer_loader_path,
263
- 1
264
- )
261
+ If the host application uses `Bundler.require`, use:
265
262
 
266
- AUTH_SANITIZER = auth_sanitizer_loader_namespace
267
- .const_get(:AuthSanitizer)
268
- .const_get(:Loader)
269
- .load_isolated
263
+ ```ruby
264
+ gem "anonymous_loader", "~> 0.1", ">= 0.1.0"
265
+ gem "auth-sanitizer", "~> 0.2", ">= 0.2.1", require: false
270
266
  ```
271
267
 
272
- </details>
268
+ `AnonymousLoader.load_path` raises `AnonymousLoader::FileNotFoundError` when it cannot resolve the loader, and
269
+ `AnonymousLoader::VersionMismatchError` when it finds a load-path candidate whose adjacent version file does not satisfy
270
+ the requested range.
273
271
 
274
272
  ### Filtered Label
275
273
 
@@ -424,15 +422,15 @@ require "auth/sanitizer"
424
422
  ```
425
423
 
426
424
  Or load it without defining top-level `Auth`. This still defines top-level `AuthSanitizer`; see
427
- [Zero Top-Level Namespace Additions](#zero-top-level-namespace-additions) for the stricter loading pattern.
425
+ [Zero Top-Level Namespace Additions](#zero-top-level-namespace-additions) for the stricter `anonymous_loader` pattern.
428
426
 
429
427
  ```ruby
430
428
  require "auth_sanitizer/loader"
431
429
 
432
- AUTH_SANITIZER = AuthSanitizer::Loader.load_isolated
430
+ auth_sanitizer = AuthSanitizer::Loader.load_isolated
433
431
 
434
- class TokenResponse
435
- include AUTH_SANITIZER::FilteredAttributes
432
+ token_response = Class.new do
433
+ include auth_sanitizer.const_get(:FilteredAttributes)
436
434
  end
437
435
  ```
438
436
 
@@ -555,19 +553,21 @@ We welcome both individual and corporate sponsors! We also offer a
555
553
  wide array of funding channels to account for your preferences.
556
554
  Currently, [Open Collective][🖇osc] is our preferred funding platform.
557
555
 
556
+ ### Corporate Sponsorship
557
+
558
+ - <a href="https://alpha-omega.dev"><img alt="Alpha-Omega" src="https://alpha-omega.dev/wp-content/uploads/sites/22/2023/05/logo.svg" height="32"/></a> [Alpha-Omega](https://alpha-omega.dev) — backed by [Amazon Web Services](https://aws.amazon.com), [Google](https://www.google.com), [Microsoft](https://www.microsoft.com), [Anthropic](https://www.anthropic.com), [OpenAI](https://openai.com), [Citi](https://www.citigroup.com), [GitHub](https://github.com)
559
+ - <a href="https://serpapi.com"><img alt="SerpApi" src="https://serpapi.com/assets/media_kit/logo-with-wordmark.svg" height="32"/></a> [SerpApi](https://serpapi.com)
560
+
558
561
  **If you're working in a company that's making significant use of ruby-oauth tools we'd
559
562
  appreciate it if you suggest to your company to become a ruby-oauth sponsor.**
560
563
 
564
+ ### Individual Support
565
+
561
566
  You can support the development of ruby-oauth tools via
562
567
  [GitHub Sponsors][🖇sponsor],
563
568
  [Liberapay][⛳liberapay],
564
- [PayPal][🖇paypal],
565
- [Open Collective][🖇osc]
566
- and [Tidelift][🏙️entsup-tidelift].
567
-
568
- | 📍 NOTE |
569
- |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
570
- | If doing a sponsorship in the form of donation is problematic for your company <br/> from an accounting standpoint, we'd recommend the use of Tidelift, <br/> where you can get a support-like subscription instead. |
569
+ [Open Collective][🖇osc],
570
+ and [PayPal][🖇paypal].
571
571
 
572
572
  ### Open Collective for Individuals
573
573
 
@@ -589,7 +589,7 @@ NOTE: [kettle-readme-backers][kettle-readme-backers] updates this list every day
589
589
  No sponsors yet. Be the first!
590
590
  <!-- OPENCOLLECTIVE-ORGANIZATIONS:END -->
591
591
 
592
- [kettle-readme-backers]: https://github.com/ruby-oauth/auth-sanitizer/blob/main/exe/kettle-readme-backers
592
+ [kettle-readme-backers]: https://github.com/ruby-oauth/auth-sanitizer/blob/main/bin/kettle-readme-backers
593
593
 
594
594
  ### Another way to support open-source
595
595
 
@@ -601,7 +601,7 @@ I’m developing a new library, [floss_funding][🖇floss-funding-gem], designed
601
601
 
602
602
  **[Floss-Funding.dev][🖇floss-funding.dev]: 👉️ No network calls. 👉️ No tracking. 👉️ No oversight. 👉️ Minimal crypto hashing. 💡 Easily disabled nags**
603
603
 
604
- [![OpenCollective Backers][🖇osc-backers-i]][🖇osc-backers] [![OpenCollective Sponsors][🖇osc-sponsors-i]][🖇osc-sponsors] [![Sponsor Me on Github][🖇sponsor-img]][🖇sponsor] [![Liberapay Goal Progress][⛳liberapay-img]][⛳liberapay] [![Donate on PayPal][🖇paypal-img]][🖇paypal] [![Buy me a coffee][🖇buyme-small-img]][🖇buyme] [![Donate on Polar][🖇polar-img]][🖇polar] [![Donate to my FLOSS efforts at ko-fi.com][🖇kofi-img]][🖇kofi] [![Donate to my FLOSS efforts using Patreon][🖇patreon-img]][🖇patreon]
604
+ [![OpenCollective Backers][🖇osc-backers-i]][🖇osc-backers] [![OpenCollective Sponsors][🖇osc-sponsors-i]][🖇osc-sponsors] [![Sponsor Me on Github][🖇sponsor-img]][🖇sponsor] [![Liberapay Goal Progress][⛳liberapay-img]][⛳liberapay] [![Donate on PayPal][🖇paypal-img]][🖇paypal] [![Buy me a coffee][🖇buyme-small-img]][🖇buyme] [![Donate to my FLOSS efforts at ko-fi.com][🖇kofi-img]][🖇kofi]
605
605
 
606
606
  ## 🔐 Security
607
607
 
@@ -610,8 +610,7 @@ See [SECURITY.md][🔐security].
610
610
  ## 🤝 Contributing
611
611
 
612
612
  If you need some ideas of where to help, you could work on adding more code coverage,
613
- or if it is already 💯 (see [below](#code-coverage)) check [issues][🤝gh-issues] or [PRs][🤝gh-pulls],
614
- or use the gem and think about how it could be better.
613
+ check [issues][🤝gh-issues] or [PRs][🤝gh-pulls], or use the gem and think about how it could be better.
615
614
 
616
615
  We [![Keep A Changelog][📗keep-changelog-img]][📗keep-changelog] so if you make changes, remember to update it.
617
616
 
@@ -647,19 +646,6 @@ Made with [contributors-img][🖐contrib-rocks].
647
646
 
648
647
  Also see GitLab Contributors: [https://gitlab.com/ruby-oauth/auth-sanitizer/-/graphs/main][🚎contributors-gl]
649
648
 
650
- <details>
651
- <summary>⭐️ Star History</summary>
652
-
653
- <a href="https://star-history.com/ruby-oauth/auth-sanitizer&Date">
654
- <picture>
655
- <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=ruby-oauth/auth-sanitizer&type=Date&theme=dark" />
656
- <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=ruby-oauth/auth-sanitizer&type=Date" />
657
- <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=ruby-oauth/auth-sanitizer&type=Date" />
658
- </picture>
659
- </a>
660
-
661
- </details>
662
-
663
649
  ## 📌 Versioning
664
650
 
665
651
  This library follows [![Semantic Versioning 2.0.0][📌semver-img]][📌semver] for its public API where practical.
@@ -689,7 +675,7 @@ See [CHANGELOG.md][📌changelog] for a list of releases.
689
675
  ## 📄 License
690
676
 
691
677
  The gem is available as open source under the terms of
692
- the [MIT](MIT.md) [![License: MIT][📄license-img]][📄license-ref].
678
+ the [MIT](https://github.com/ruby-oauth/auth-sanitizer/blob/main/MIT.md) [![License: MIT][📄license-img]][📄license-ref].
693
679
 
694
680
  ### © Copyright
695
681
 
@@ -711,11 +697,12 @@ I'm hoping to be able to pay for my kids' health insurance this month,
711
697
  so if you value the work I am doing, I need your support.
712
698
  Please consider sponsoring me or the project.
713
699
 
714
- To join the community or get help 👇️ Join the Discord.
700
+ To join the community or get help, use the RubyForum or Discord.
715
701
 
702
+ [![Ruby Users Forum][✉️ruby-forum-img]][✉️ruby-forum]
716
703
  [![Live Chat on Discord][✉️discord-invite-img-ftb]][✉️discord-invite]
717
704
 
718
- To say "thanks!" ☝️ Join the Discord or 👇️ send money.
705
+ To say "thanks!" ☝️ Join the community or 👇️ send money.
719
706
 
720
707
  [![Sponsor ruby-oauth/auth-sanitizer on Open Source Collective][🖇osc-all-bottom-img]][🖇osc] 💌 [![Sponsor me on GitHub Sponsors][🖇sponsor-bottom-img]][🖇sponsor] 💌 [![Sponsor me on Liberapay][⛳liberapay-bottom-img]][⛳liberapay] 💌 [![Donate on PayPal][🖇paypal-bottom-img]][🖇paypal]
721
708
 
@@ -742,12 +729,8 @@ Thanks for RTFM. ☺️
742
729
  [🖇sponsor-img]: https://img.shields.io/badge/Sponsor_Me!-pboling.svg?style=social&logo=github
743
730
  [🖇sponsor-bottom-img]: https://img.shields.io/badge/Sponsor_Me!-pboling-blue?style=for-the-badge&logo=github
744
731
  [🖇sponsor]: https://github.com/sponsors/pboling
745
- [🖇polar-img]: https://img.shields.io/badge/polar-donate-a51611.svg?style=flat
746
- [🖇polar]: https://polar.sh/pboling
747
732
  [🖇kofi-img]: https://img.shields.io/badge/ko--fi-%E2%9C%93-a51611.svg?style=flat
748
733
  [🖇kofi]: https://ko-fi.com/pboling
749
- [🖇patreon-img]: https://img.shields.io/badge/patreon-donate-a51611.svg?style=flat
750
- [🖇patreon]: https://patreon.com/galtzo
751
734
  [🖇buyme-small-img]: https://img.shields.io/badge/buy_me_a_coffee-%E2%9C%93-a51611.svg?style=flat
752
735
  [🖇buyme-img]: https://img.buymeacoffee.com/button-api/?text=Buy%20me%20a%20latte&emoji=&slug=pboling&button_colour=FFDD00&font_colour=000000&font_family=Cookie&outline_colour=000000&coffee_colour=ffffff
753
736
  [🖇buyme]: https://www.buymeacoffee.com/pboling
@@ -760,11 +743,14 @@ Thanks for RTFM. ☺️
760
743
  [✉️discord-invite-img-ftb]: https://img.shields.io/discord/1373797679469170758?style=for-the-badge&logo=discord
761
744
  [✉️ruby-friends-img]: https://img.shields.io/badge/daily.dev-%F0%9F%92%8E_Ruby_Friends-0A0A0A?style=for-the-badge&logo=dailydotdev&logoColor=white
762
745
  [✉️ruby-friends]: https://app.daily.dev/squads/rubyfriends
746
+ [✉️ruby-forum-top-img]: https://img.shields.io/discourse/topics?server=https%3A%2F%2Fwww.rubyforum.org&style=flat&logo=discourse&label=Ruby%20Users%20Forum
747
+ [✉️ruby-forum-img]: https://img.shields.io/discourse/topics?server=https%3A%2F%2Fwww.rubyforum.org&style=for-the-badge&logo=discourse&label=Ruby%20Users%20Forum
748
+ [✉️ruby-forum]: https://www.rubyforum.org/tag/ruby-oauth
763
749
 
764
750
  [✇bundle-group-pattern]: https://gist.github.com/pboling/4564780
765
751
  [⛳️gem-namespace]: https://github.com/ruby-oauth/auth-sanitizer
766
752
  [⛳️namespace-img]: https://img.shields.io/badge/namespace-Auth::Sanitizer-3C2D2D.svg?style=square&logo=ruby&logoColor=white
767
- [⛳️gem-name]: https://bestgems.org/gems/auth-sanitizer
753
+ [⛳️gem-name]: https://clickgems.clickhouse.com/dashboard/auth-sanitizer
768
754
  [⛳️name-img]: https://img.shields.io/badge/name-auth--sanitizer-3C2D2D.svg?style=square&logo=rubygems&logoColor=red
769
755
  [⛳️tag-img]: https://img.shields.io/github/tag/ruby-oauth/auth-sanitizer.svg
770
756
  [⛳️tag]: https://github.com/ruby-oauth/auth-sanitizer/releases
@@ -796,16 +782,13 @@ Thanks for RTFM. ☺️
796
782
  [👨🏼‍🏫expsup-upwork-img]: https://img.shields.io/badge/UpWork-13544E?style=for-the-badge&logo=Upwork&logoColor=white
797
783
  [👨🏼‍🏫expsup-codementor]: https://www.codementor.io/peterboling?utm_source=github&utm_medium=button&utm_term=peterboling&utm_campaign=github
798
784
  [👨🏼‍🏫expsup-codementor-img]: https://img.shields.io/badge/CodeMentor-Get_Help-1abc9c?style=for-the-badge&logo=CodeMentor&logoColor=white
799
- [🏙️entsup-tidelift]: https://tidelift.com/subscription/pkg/rubygems-auth-sanitizer?utm_source=rubygems-auth-sanitizer&utm_medium=referral&utm_campaign=readme
800
- [🏙️entsup-tidelift-img]: https://img.shields.io/badge/Tidelift_and_Sonar-Enterprise_Support-FD3456?style=for-the-badge&logo=sonar&logoColor=white
801
- [🏙️entsup-tidelift-sonar]: https://blog.tidelift.com/tidelift-joins-sonar
802
785
  [💁🏼‍♂️peterboling]: http://www.peterboling.com
803
786
  [🚂railsbling]: http://www.railsbling.com
804
787
  [📜src-gl-img]: https://img.shields.io/badge/GitLab-FBA326?style=for-the-badge&logo=Gitlab&logoColor=orange
805
788
  [📜src-gl]: https://gitlab.com/ruby-oauth/auth-sanitizer
806
789
  [📜src-cb-img]: https://img.shields.io/badge/CodeBerg-4893CC?style=for-the-badge&logo=CodeBerg&logoColor=blue
807
790
  [📜src-cb]: https://codeberg.org/ruby-oauth/auth-sanitizer
808
- [📜src-gh-img]: https://img.shields.io/badge/GitHub-238636?style=for-the-badge&logo=Github&logoColor=green
791
+ [📜src-gh-img]: https://img.shields.io/badge/GitHub-238636?style=for-the-badge&logo=GitHub&logoColor=green
809
792
  [📜src-gh]: https://github.com/ruby-oauth/auth-sanitizer
810
793
  [📜docs-cr-rd-img]: https://img.shields.io/badge/RubyDoc-Current_Release-943CD2?style=for-the-badge&logo=readthedocs&logoColor=white
811
794
  [📜docs-head-rd-img]: https://img.shields.io/badge/YARD_on_Galtzo.com-HEAD-943CD2?style=for-the-badge&logo=readthedocs&logoColor=white
@@ -813,9 +796,9 @@ Thanks for RTFM. ☺️
813
796
  [📜gh-wiki]: https://github.com/ruby-oauth/auth-sanitizer/wiki
814
797
  [📜gl-wiki-img]: https://img.shields.io/badge/wiki-gitlab-943CD2.svg?style=for-the-badge&logo=gitlab&logoColor=white
815
798
  [📜gh-wiki-img]: https://img.shields.io/badge/wiki-github-943CD2.svg?style=for-the-badge&logo=github&logoColor=white
816
- [👽dl-rank]: https://bestgems.org/gems/auth-sanitizer
817
- [👽dl-ranki]: https://img.shields.io/gem/rd/auth-sanitizer.svg
818
- [👽version]: https://bestgems.org/gems/auth-sanitizer
799
+ [👽dl-rank]: https://clickgems.clickhouse.com/dashboard/auth-sanitizer
800
+ [👽dl-ranki]: https://img.shields.io/gem/dt/auth-sanitizer.svg
801
+ [👽version]: https://clickgems.clickhouse.com/dashboard/auth-sanitizer
819
802
  [👽versioni]: https://img.shields.io/gem/v/auth-sanitizer.svg
820
803
  [🏀qlty-mnt]: https://qlty.sh/gh/ruby-oauth/projects/auth-sanitizer
821
804
  [🏀qlty-mnti]: https://qlty.sh/gh/ruby-oauth/projects/auth-sanitizer/maintainability.svg
@@ -837,11 +820,12 @@ Thanks for RTFM. ☺️
837
820
  [🚎jruby-9.2-wf]: https://github.com/ruby-oauth/auth-sanitizer/actions/workflows/jruby-9.2.yml
838
821
  [🚎jruby-9.3-wf]: https://github.com/ruby-oauth/auth-sanitizer/actions/workflows/jruby-9.3.yml
839
822
  [🚎jruby-9.4-wf]: https://github.com/ruby-oauth/auth-sanitizer/actions/workflows/jruby-9.4.yml
823
+ [🚎jruby-10.0-wf]: https://github.com/ruby-oauth/auth-sanitizer/actions/workflows/jruby-10.0.yml
840
824
  [🚎truby-22.3-wf]: https://github.com/ruby-oauth/auth-sanitizer/actions/workflows/truffleruby-22.3.yml
841
- [🚎truby-23.0-wf]: https://github.com/ruby-oauth/auth-sanitizer/actions/workflows/truffleruby-23.0.yml
842
825
  [🚎truby-23.1-wf]: https://github.com/ruby-oauth/auth-sanitizer/actions/workflows/truffleruby-23.1.yml
843
826
  [🚎truby-24.2-wf]: https://github.com/ruby-oauth/auth-sanitizer/actions/workflows/truffleruby-24.2.yml
844
827
  [🚎truby-25.0-wf]: https://github.com/ruby-oauth/auth-sanitizer/actions/workflows/truffleruby-25.0.yml
828
+ [🚎truby-33.0-wf]: https://github.com/ruby-oauth/auth-sanitizer/actions/workflows/truffleruby-33.0.yml
845
829
  [🚎2-cov-wf]: https://github.com/ruby-oauth/auth-sanitizer/actions/workflows/coverage.yml
846
830
  [🚎2-cov-wfi]: https://github.com/ruby-oauth/auth-sanitizer/actions/workflows/coverage.yml/badge.svg
847
831
  [🚎3-hd-wf]: https://github.com/ruby-oauth/auth-sanitizer/actions/workflows/heads.yml
@@ -873,18 +857,18 @@ Thanks for RTFM. ☺️
873
857
  [💎ruby-3.2i]: https://img.shields.io/badge/Ruby-3.2-CC342D?style=for-the-badge&logo=ruby&logoColor=white
874
858
  [💎ruby-3.3i]: https://img.shields.io/badge/Ruby-3.3-CC342D?style=for-the-badge&logo=ruby&logoColor=white
875
859
  [💎ruby-3.4i]: https://img.shields.io/badge/Ruby-3.4-CC342D?style=for-the-badge&logo=ruby&logoColor=white
876
- [💎ruby-4.0i]: https://img.shields.io/badge/Ruby-4.0-CC342D?style=for-the-badge&logo=ruby&logoColor=white
877
860
  [💎ruby-c-i]: https://img.shields.io/badge/Ruby-current-CC342D?style=for-the-badge&logo=ruby&logoColor=green
878
861
  [💎ruby-headi]: https://img.shields.io/badge/Ruby-HEAD-CC342D?style=for-the-badge&logo=ruby&logoColor=blue
879
862
  [💎truby-22.3i]: https://img.shields.io/badge/Truffle_Ruby-22.3-34BCB1?style=for-the-badge&logo=ruby&logoColor=pink
880
- [💎truby-23.0i]: https://img.shields.io/badge/Truffle_Ruby-23.0-34BCB1?style=for-the-badge&logo=ruby&logoColor=pink
881
863
  [💎truby-23.1i]: https://img.shields.io/badge/Truffle_Ruby-23.1-34BCB1?style=for-the-badge&logo=ruby&logoColor=pink
882
864
  [💎truby-24.2i]: https://img.shields.io/badge/Truffle_Ruby-24.2-34BCB1?style=for-the-badge&logo=ruby&logoColor=pink
883
865
  [💎truby-25.0i]: https://img.shields.io/badge/Truffle_Ruby-25.0-34BCB1?style=for-the-badge&logo=ruby&logoColor=pink
866
+ [💎truby-33.0i]: https://img.shields.io/badge/Truffle_Ruby-33.0-34BCB1?style=for-the-badge&logo=ruby&logoColor=pink
884
867
  [💎truby-c-i]: https://img.shields.io/badge/Truffle_Ruby-current-34BCB1?style=for-the-badge&logo=ruby&logoColor=green
885
868
  [💎jruby-9.2i]: https://img.shields.io/badge/JRuby-9.2-FBE742?style=for-the-badge&logo=ruby&logoColor=red
886
869
  [💎jruby-9.3i]: https://img.shields.io/badge/JRuby-9.3-FBE742?style=for-the-badge&logo=ruby&logoColor=red
887
870
  [💎jruby-9.4i]: https://img.shields.io/badge/JRuby-9.4-FBE742?style=for-the-badge&logo=ruby&logoColor=red
871
+ [💎jruby-10.0i]: https://img.shields.io/badge/JRuby-10.0-FBE742?style=for-the-badge&logo=ruby&logoColor=red
888
872
  [💎jruby-c-i]: https://img.shields.io/badge/JRuby-current-FBE742?style=for-the-badge&logo=ruby&logoColor=green
889
873
  [💎jruby-headi]: https://img.shields.io/badge/JRuby-HEAD-FBE742?style=for-the-badge&logo=ruby&logoColor=blue
890
874
  [🤝gh-issues]: https://github.com/ruby-oauth/auth-sanitizer/issues
@@ -913,15 +897,15 @@ Thanks for RTFM. ☺️
913
897
  [📌gitmoji]: https://gitmoji.dev
914
898
  [📌gitmoji-img]: https://img.shields.io/badge/gitmoji_commits-%20%F0%9F%98%9C%20%F0%9F%98%8D-34495e.svg?style=flat-square
915
899
  [🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
916
- [🧮kloc-img]: https://img.shields.io/badge/KLOC-0.145-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
900
+ [🧮kloc-img]: https://img.shields.io/badge/KLOC-0.184-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
917
901
  [🔐security]: https://github.com/ruby-oauth/auth-sanitizer/blob/main/SECURITY.md
918
902
  [🔐security-img]: https://img.shields.io/badge/security-policy-259D6C.svg?style=flat
919
903
  [📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
920
904
  [📄license]: LICENSE.md
921
- [📄license-ref]: MIT.md
905
+ [📄license-ref]: https://github.com/ruby-oauth/auth-sanitizer/blob/main/MIT.md
922
906
  [📄license-img]: https://img.shields.io/badge/License-MIT-259D6C.svg
923
907
  [📄license-compat]: https://www.apache.org/legal/resolved.html#category-a
924
- [📄license-compat-img]: https://img.shields.io/badge/Apache_Compatible:_Category_A-✓-259D6C.svg?style=flat&logo=Apache
908
+ [📄license-compat-img]: https://img.shields.io/badge/Apache_Compatible:_Category_A-%E2%9C%93-259D6C.svg?style=flat&logo=Apache
925
909
 
926
910
  [📄ilo-declaration]: https://www.ilo.org/declaration/lang--en/index.htm
927
911
  [📄ilo-declaration-img]: https://img.shields.io/badge/ILO_Fundamental_Principles-✓-259D6C.svg?style=flat
@@ -939,9 +923,9 @@ Thanks for RTFM. ☺️
939
923
  | Field | Value |
940
924
  |---|---|
941
925
  | Package | auth-sanitizer |
942
- | Description | 💎 Configurable KV output redaction. Sanitize/filter your secrets. |
926
+ | Description | 🧼 Configurable KV output redaction. Sanitize/filter your secrets. |
943
927
  | Homepage | https://github.com/ruby-oauth/auth-sanitizer |
944
- | Source | https://github.com/ruby-oauth/auth-sanitizer/tree/v0.2.0 |
928
+ | Source | https://github.com/ruby-oauth/auth-sanitizer |
945
929
  | License | `MIT` |
946
- | Funding | https://github.com/sponsors/pboling, https://issuehunt.io/u/pboling, https://ko-fi.com/pboling, https://liberapay.com/pboling/donate, https://opencollective.com/ruby-oauth, https://patreon.com/galtzo, https://polar.sh/pboling, https://thanks.dev/u/gh/pboling, https://tidelift.com/funding/github/rubygems/auth-sanitizer, https://www.buymeacoffee.com/pboling |
930
+ | Funding | https://github.com/sponsors/pboling, https://ko-fi.com/pboling, https://liberapay.com/pboling/donate, https://opencollective.com/ruby-oauth, https://thanks.dev/u/gh/pboling, https://www.buymeacoffee.com/pboling |
947
931
  <!-- kettle-jem:metadata:end -->
@@ -1,13 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "version_gem"
4
-
5
- Auth::Sanitizer::Version.class_eval do
6
- extend VersionGem::Basic
7
- end
8
-
3
+ # Top-level namespace for authentication-adjacent helpers.
9
4
  module Auth
5
+ # Credential redaction for inspect output and debug logging.
10
6
  module Sanitizer
7
+ # Error raised for auth-sanitizer failures.
11
8
  class Error < StandardError; end
12
9
 
13
10
  # Default keys filtered from debug log output.
@@ -42,16 +39,13 @@ module Auth
42
39
 
43
40
  # Install a custom provider for the filtered label.
44
41
  #
45
- # The provider is called each time a new {FilteredAttributes}- or
46
- # {SanitizedLogger}-bearing object is initialized, allowing the label to
47
- # track a host gem's live configuration while still being snapshotted per
48
- # object instance.
42
+ # The provider callable is invoked each time a new {FilteredAttributes}- or
43
+ # {SanitizedLogger}-bearing object is initialized, allowing the label to track a host gem's
44
+ # live configuration while still being snapshotted per object instance.
49
45
  #
46
+ # @return [void]
50
47
  # @example Delegate to a host gem's config
51
48
  # Auth::Sanitizer.filtered_label_provider = -> { MyGem.config[:filtered_label] }
52
- #
53
- # @param [#call] provider A callable that returns the label string
54
- # @return [void]
55
49
  define_singleton_method(:filtered_label_provider=) do |provider|
56
50
  filtered_label_provider_mutex.synchronize do
57
51
  filtered_label_provider = provider
@@ -68,6 +62,18 @@ module Auth
68
62
  def default_filtered_keys
69
63
  DEFAULT_FILTERED_KEYS
70
64
  end
65
+
66
+ # Sanitize a value using the configured key names and replacement label.
67
+ # Hashes and arrays are traversed recursively; strings are filtered using
68
+ # the same formats supported by {SanitizedLogger}.
69
+ #
70
+ # @param value [Object] Value to sanitize
71
+ # @param filtered_keys [Array<String>] Key names whose values should be redacted
72
+ # @param label [String] Replacement label for redacted values
73
+ # @return [Object] Sanitized copy of the value
74
+ def sanitize(value, filtered_keys: default_filtered_keys, label: filtered_label, **options)
75
+ ValueSanitizer.new(filtered_keys: filtered_keys, label: label, **options).sanitize(value)
76
+ end
71
77
  end
72
78
  end
73
79
  end