fix: harden signing key handling - #1166
Merged
Merged
Conversation
DaleSeo
force-pushed
the
fix/1161-signing-key-hardening
branch
from
August 11, 2026 23:42
619a0e8 to
1dfe003
Compare
DaleSeo
marked this pull request as ready for review
August 11, 2026 23:55
alexhancock
previously approved these changes
Aug 18, 2026
| log_level: Arc::new(Mutex::new(LoggingLevel::Debug)), | ||
| request_state_codec: RequestStateCodec::new(REQUEST_STATE_KEY), | ||
| request_state_codec: RequestStateCodec::try_new(REQUEST_STATE_KEY) | ||
| .expect("conformance request-state key meets the minimum length"), |
Contributor
There was a problem hiding this comment.
We don't need the runtime check here for .expect when it's a constant defined in the file, right. Can't we just check it at compile time or leave the check out given we know where it comes from?
Member
Author
There was a problem hiding this comment.
Makes sense, @alexhancock! I changed the fixed-key call sites to use a const assertion and new_unchecked.
DaleSeo
force-pushed
the
fix/1161-signing-key-hardening
branch
from
August 18, 2026 04:57
a382e14 to
3b65a09
Compare
DaleSeo
force-pushed
the
fix/1161-signing-key-hardening
branch
2 times, most recently
from
August 18, 2026 05:49
4ff6578 to
fad6734
Compare
DaleSeo
force-pushed
the
fix/1161-signing-key-hardening
branch
from
August 18, 2026 06:00
fad6734 to
0813d97
Compare
alexhancock
approved these changes
Aug 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1161.
Motivation and Context
RequestStateCodecprotects opaque MRTR requestState values with an HMAC signing key. However, its existing constructor accepted keys of any length, even though its documentation recommended at least 32 bytes of high-entropy key material. This made it easy for integrations to accidentally configure weak key material.The codec also kept the key bytes in memory without zeroizing them when dropped. In addition, the derived Debug implementation for
ClientCredentialsConfigcould expose OAuth client secrets and private signing keys.This change makes the secure path explicit. The
try_newconstructor now requires a key of at least 32 bytes. The legacy new constructor is deprecated as of version 3.1.4, whilenew_uncheckedremains available for keys that are validated separately. Stored request-state keys are now zeroized, and credential Debug output redacts secret fields.How Has This Been Tested?
Added tests
Breaking Changes
None.
Types of changes
Checklist