fix: verify token length (#627)
Some checks failed
CI / All (macos-latest) (push) Has been cancelled
CI / All (ubuntu-latest) (push) Has been cancelled
CI / All (windows-latest) (push) Has been cancelled

This commit is contained in:
sigoden 2025-09-02 18:48:17 +08:00 committed by GitHub
parent 4016715187
commit db75ba4357
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -173,6 +173,10 @@ impl AccessControl {
fn verify_token<'a>(&'a self, token: &str, path: &str) -> Result<(String, &'a AccessPaths)> {
let raw = hex::decode(token)?;
if raw.len() < 72 {
bail!("Invalid token");
}
let sig_bytes = &raw[..64];
let exp_bytes = &raw[64..72];
let user_bytes = &raw[72..];