test(security): harden token format regression coverage
This commit is contained in:
parent
58958d9991
commit
918be53a30
1 changed files with 10 additions and 3 deletions
|
|
@ -416,10 +416,17 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn generate_token_has_prefix() {
|
fn generate_token_has_prefix_and_hex_payload() {
|
||||||
let token = generate_token();
|
let token = generate_token();
|
||||||
assert!(token.starts_with("zc_"));
|
let payload = token
|
||||||
assert!(token.len() > 10);
|
.strip_prefix("zc_")
|
||||||
|
.expect("Generated token should include zc_ prefix");
|
||||||
|
|
||||||
|
assert_eq!(payload.len(), 64, "Token payload should be 32 bytes in hex");
|
||||||
|
assert!(
|
||||||
|
payload.chars().all(|c| c.is_ascii_hexdigit()),
|
||||||
|
"Token payload should be lowercase hex"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Brute force protection ───────────────────────────────
|
// ── Brute force protection ───────────────────────────────
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue