| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
| 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"), |
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?
Sorry, something went wrong.
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.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fixes #1161.
Motivation and Context
RequestStateCodec protects 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 ClientCredentialsConfig could expose OAuth client secrets and private signing keys.
This change makes the secure path explicit. The try_new constructor now requires a key of at least 32 bytes. The legacy new constructor is deprecated as of version 3.1.4, while new_unchecked remains 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