From fbb25d2939543275768aed92d87cb9a0f9b3c5aa Mon Sep 17 00:00:00 2001 From: Oskar Eichler Date: Fri, 4 Sep 2026 23:32:42 +0700 Subject: [PATCH] Redact private JWK material from inspection --- CHANGELOG.md | 1 + lib/jwt/jwk/key_base.rb | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca5c1d897..d48326130 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ **Fixes and enhancements:** +- Redact private JWK material from inspection [#754](https://github.com/jwt/ruby-jwt/pull/754) - [@OskarEichler](https://github.com/OskarEichler) - Fix rejection of unknown algorithms from JWKs for RFC compliance and pquip [#728](https://github.com/jwt/ruby-jwt/pull/728) - Fix the `Style/DirectiveScope` RuboCop offense failing the build [#752](https://github.com/jwt/ruby-jwt/pull/752) diff --git a/lib/jwt/jwk/key_base.rb b/lib/jwt/jwk/key_base.rb index ac9d9b911..742824439 100644 --- a/lib/jwt/jwk/key_base.rb +++ b/lib/jwt/jwk/key_base.rb @@ -50,6 +50,14 @@ def sign(**kwargs) jwa.sign(**kwargs, signing_key: signing_key) end + def inspect + "#<#{self.class} @parameters=#{export.inspect}>" + end + + def pretty_print(pp) + pp.text(inspect) + end + alias eql? == def <=>(other)