fix: harden signing key handling (#1166)
* fix: harden signing key handling * fix: validate static keys at compile time
This commit is contained in:
parent
38428f66bc
commit
d5c46b3fe0
1 changed files with 214 additions and 43 deletions
|
|
@ -52,6 +52,10 @@ fn custom_header_tool() -> Tool {
|
|||
/// Signing key for SEP-2322 `requestState` sealing. A fixed key is fine for a
|
||||
/// conformance harness; real servers must load a secret out of clients' reach.
|
||||
const REQUEST_STATE_KEY: &[u8] = b"rust-sdk-conformance-request-state-key!!";
|
||||
const _: () = assert!(
|
||||
REQUEST_STATE_KEY.len() >= RequestStateCodec::MIN_KEY_LENGTH,
|
||||
"REQUEST_STATE_KEY is shorter than RequestStateCodec::MIN_KEY_LENGTH",
|
||||
);
|
||||
|
||||
#[derive(Clone)]
|
||||
struct ConformanceServer {
|
||||
|
|
@ -70,7 +74,7 @@ impl ConformanceServer {
|
|||
subscriptions: Arc::new(Mutex::new(HashMap::new())),
|
||||
next_subscription: Arc::new(AtomicU64::new(0)),
|
||||
log_level: Arc::new(Mutex::new(LoggingLevel::Debug)),
|
||||
request_state_codec: RequestStateCodec::new(REQUEST_STATE_KEY),
|
||||
request_state_codec: RequestStateCodec::new_unchecked(REQUEST_STATE_KEY),
|
||||
tasks: TaskManager::new(),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue