fix: verify token length (#627)

pull/626/head
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
1 changed files with 4 additions and 0 deletions

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..];