auth-sanitizer 0.2.1 → 0.2.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 633789bb7c954fcea43d081527da59affeb9e4859773ccb94ba98b6a5dc767c5
4
- data.tar.gz: dd4f09c0461cee4cc31ee4900771e34c5349f2a7cb43028c582753cd055d5c7d
3
+ metadata.gz: e553dcb05812a620438872bb9726ae4b87806b78e4a188f475db2962fb3ace16
4
+ data.tar.gz: c6f928c8ede605a82cce0bb88238eb855529d5464b0655372b6662b90770f537
5
5
  SHA512:
6
- metadata.gz: bde13e5621861e7361f273917922ece5353a87178addca4b835b00d879c30aea7dd3fe1b8e16db3bd88dde05a1164d52c19bde07ca7785d7de45bed7e0660bba
7
- data.tar.gz: 463eecc6672abdaadc05b0d8c0b22e8ab0a05793265fdfe76ac3ccd4d49bf26b1b4bd9b7011ac23cfeee69c1d8e2eeb55f8f82546cc0e7a7eb651b95d870eb52
6
+ metadata.gz: '018736223d93b251e19b6b47f87ade2c70dd033762a97830cd73c13ea40dce3c175d4629140ca151d04ee64672fc3a46423ab70ea25d59b5e368078cbf119f3b'
7
+ data.tar.gz: '0897d315fefb00a8fd951e58a8a9ed0e85f97444394357b2a98d0e4b122cbff788da6fef4250512170eb18ee03bd5ba263bc6cb6512328527b7de0d1e9ad80bd'
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -30,6 +30,24 @@ Please file a bug if you notice a violation of semantic versioning.
30
30
 
31
31
  ### Security
32
32
 
33
+ ## [0.2.2] - 2026-06-18
34
+
35
+ - TAG: [v0.2.2][0.2.2t]
36
+ - COVERAGE: 100.00% -- 145/145 lines in 6 files
37
+ - BRANCH COVERAGE: 100.00% -- 28/28 branches in 6 files
38
+ - 84.62% documented
39
+
40
+ ### Changed
41
+
42
+ - Documented the released `anonymous_loader` gem as the preferred reusable
43
+ helper for zero-`auth-sanitizer`-namespace loading.
44
+
45
+ ### Fixed
46
+
47
+ - Documented the `$LOAD_PATH` fallback needed by isolated loader consumers when
48
+ Bundler standalone setup provides `auth_sanitizer/loader.rb` without a
49
+ matching `Gem.loaded_specs` or `GEM_PATH` entry.
50
+
33
51
  ## [0.2.1] - 2026-06-06
34
52
 
35
53
  - TAG: [v0.2.1][0.2.1t]
@@ -151,7 +169,9 @@ Please file a bug if you notice a violation of semantic versioning.
151
169
 
152
170
  - Initial release
153
171
 
154
- [Unreleased]: https://github.com/ruby-oauth/auth-sanitizer/compare/v0.2.1...HEAD
172
+ [Unreleased]: https://github.com/ruby-oauth/auth-sanitizer/compare/v0.2.2...HEAD
173
+ [0.2.2]: https://github.com/ruby-oauth/auth-sanitizer/compare/v0.2.1...v0.2.2
174
+ [0.2.2t]: https://github.com/ruby-oauth/auth-sanitizer/releases/tag/v0.2.2
155
175
  [0.2.1]: https://github.com/ruby-oauth/auth-sanitizer/compare/v0.2.0...v0.2.1
156
176
  [0.2.1t]: https://github.com/ruby-oauth/auth-sanitizer/releases/tag/v0.2.1
157
177
  [0.2.0]: https://github.com/ruby-oauth/auth-sanitizer/compare/v0.1.5...v0.2.0
data/README.md CHANGED
@@ -63,6 +63,11 @@ The returned module is an anonymously namespaced `Auth::Sanitizer`, suitable for
63
63
  Use `require: false` in gems that want to avoid every new top-level namespace, including `AuthSanitizer`; see
64
64
  [Zero Top-Level Namespace Additions](#zero-top-level-namespace-additions).
65
65
 
66
+ Consumers that want a reusable resolver for that stricter loading mode can use
67
+ [`anonymous_loader`](https://github.com/ruby-oauth/anonymous_loader). It handles
68
+ explicit paths, RubyGems metadata, and `$LOAD_PATH` fallback resolution while evaluating
69
+ the loader under an anonymous namespace.
70
+
66
71
  This gem is used by the following libraries to ensure clean output:
67
72
 
68
73
  - oauth
@@ -205,27 +210,26 @@ gem "auth-sanitizer", require: "auth_sanitizer/loader"
205
210
  Use `require: false` when the consuming library will decide which loading mode to use internally. Use
206
211
  `require: "auth_sanitizer/loader"` when Bundler should make the isolated loader available during `Bundler.require`.
207
212
 
213
+ When Bundler standalone setup is loaded directly, a dependency can be present on `$LOAD_PATH` without a matching
214
+ `Gem.loaded_specs` entry or `GEM_PATH` entry. Consumers that locate the isolated loader themselves should therefore
215
+ use `AnonymousLoader.load_path`, or otherwise fall back to `Gem.find_files("auth_sanitizer/loader.rb")`, before failing.
216
+
208
217
  #### Zero Top-Level Namespace Additions
209
218
 
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)`:
219
+ For a gem that needs zero new top-level namespaces from `auth-sanitizer`, use `anonymous_loader` to evaluate
220
+ `auth_sanitizer/loader.rb` inside an anonymous namespace, then call `AuthSanitizer::Loader.load_isolated` from that
221
+ anonymous namespace:
212
222
 
213
223
  ```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"
224
+ require "anonymous_loader"
225
+
226
+ auth_sanitizer_requirement = Gem::Requirement.new("~> 0.2", ">= 0.2.1")
227
+ auth_sanitizer_loader_namespace = AnonymousLoader.load_path(
228
+ gem_name: "auth-sanitizer",
229
+ require_path: "auth_sanitizer/loader.rb",
230
+ version_requirement: auth_sanitizer_requirement,
231
+ version_file: "auth/sanitizer/version.rb"
222
232
  )
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
233
 
230
234
  AUTH_SANITIZER = auth_sanitizer_loader_namespace
231
235
  .const_get(:AuthSanitizer)
@@ -234,42 +238,26 @@ AUTH_SANITIZER = auth_sanitizer_loader_namespace
234
238
  ```
235
239
 
236
240
  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.
241
+ module under its own namespace and use that internal constant. It does define `AnonymousLoader`, whose namespace is
242
+ specific to the resolver gem and intentionally much less collision-prone than `Auth`.
238
243
 
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`:
244
+ Declare both dependencies with `require: false` when the consuming library owns its loading path:
244
245
 
245
246
  ```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
247
+ gem "anonymous_loader", "~> 0.1", ">= 0.1.0", require: false
248
+ gem "auth-sanitizer", "~> 0.2", ">= 0.2.1", require: false
249
+ ```
258
250
 
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
- )
251
+ If the host application uses `Bundler.require`, use:
265
252
 
266
- AUTH_SANITIZER = auth_sanitizer_loader_namespace
267
- .const_get(:AuthSanitizer)
268
- .const_get(:Loader)
269
- .load_isolated
253
+ ```ruby
254
+ gem "anonymous_loader", "~> 0.1", ">= 0.1.0"
255
+ gem "auth-sanitizer", "~> 0.2", ">= 0.2.1", require: false
270
256
  ```
271
257
 
272
- </details>
258
+ `AnonymousLoader.load_path` raises `AnonymousLoader::FileNotFoundError` when it cannot resolve the loader, and
259
+ `AnonymousLoader::VersionMismatchError` when it finds a load-path candidate whose adjacent version file does not satisfy
260
+ the requested range.
273
261
 
274
262
  ### Filtered Label
275
263
 
@@ -424,7 +412,7 @@ require "auth/sanitizer"
424
412
  ```
425
413
 
426
414
  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.
415
+ [Zero Top-Level Namespace Additions](#zero-top-level-namespace-additions) for the stricter `anonymous_loader` pattern.
428
416
 
429
417
  ```ruby
430
418
  require "auth_sanitizer/loader"
@@ -587,6 +575,10 @@ NOTE: [kettle-readme-backers][kettle-readme-backers] updates this list every day
587
575
 
588
576
  <!-- OPENCOLLECTIVE-ORGANIZATIONS:START -->
589
577
  No sponsors yet. Be the first!
578
+
579
+ ### Open Collective for Donors
580
+
581
+ [Bill Woika](https://opencollective.com/bill-woika) [Philipp Ebneter](https://opencollective.com/guest-e77282f7) [Grigoriy](https://opencollective.com/guest-c93e0c48)
590
582
  <!-- OPENCOLLECTIVE-ORGANIZATIONS:END -->
591
583
 
592
584
  [kettle-readme-backers]: https://github.com/ruby-oauth/auth-sanitizer/blob/main/exe/kettle-readme-backers
@@ -3,7 +3,7 @@
3
3
  module Auth
4
4
  module Sanitizer
5
5
  module Version
6
- VERSION = "0.2.1"
6
+ VERSION = "0.2.2"
7
7
  end
8
8
  VERSION = Version::VERSION # Traditional Constant Location
9
9
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auth-sanitizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter H. Boling
@@ -279,10 +279,10 @@ licenses:
279
279
  - MIT
280
280
  metadata:
281
281
  homepage_uri: https://auth-sanitizer.galtzo.com
282
- source_code_uri: https://github.com/ruby-oauth/auth-sanitizer/tree/v0.2.1
283
- changelog_uri: https://github.com/ruby-oauth/auth-sanitizer/blob/v0.2.1/CHANGELOG.md
282
+ source_code_uri: https://github.com/ruby-oauth/auth-sanitizer/tree/v0.2.2
283
+ changelog_uri: https://github.com/ruby-oauth/auth-sanitizer/blob/v0.2.2/CHANGELOG.md
284
284
  bug_tracker_uri: https://github.com/ruby-oauth/auth-sanitizer/issues
285
- documentation_uri: https://www.rubydoc.info/gems/auth-sanitizer/0.2.1
285
+ documentation_uri: https://www.rubydoc.info/gems/auth-sanitizer/0.2.2
286
286
  funding_uri: https://github.com/sponsors/pboling
287
287
  wiki_uri: https://github.com/ruby-oauth/auth-sanitizer/wiki
288
288
  news_uri: https://www.railsbling.com/tags/auth-sanitizer
metadata.gz.sig CHANGED
@@ -1,2 +1,2 @@
1
- ���������؛v:�Ζ��~?~P"Dc0�+Uu���2VI��J�j��8�pVd�c�"Iׂ�0��25�l.�x�V�e���6D�EcݒK5�ͧwc�J�u
2
-  <�r������Ʒkdq^w9�W��ّ�����G����VR���'�:�p_�����?C[Wa-�L��_�A���J
1
+ W�&WTJ�u��̕RT`ap�5���Z
2
+ ��I�Pd��l��H�T���� m8L �ߘ�JGCڼ������K��sC(���N1Fqu�ꧨ� I�ri5N7aEO��P�Caj����B�A��)8h_P���)�S�<Or�