src/api.zig:576 (in isAuthorized):
return std.mem.eql(u8, required_token.?, request_token.?);
std.mem.eql short-circuits on the first mismatching byte, so the comparison time leaks how many leading bytes of the guess match the real token — the classic timing side channel for bearer-token auth.
Suggested fix: use a constant-time comparison, e.g. std.crypto.timing_safe.eql (or std.crypto.utils.timingSafeEql on older Zig), after an early length check that returns false without revealing position information.
src/api.zig:576(inisAuthorized):std.mem.eqlshort-circuits on the first mismatching byte, so the comparison time leaks how many leading bytes of the guess match the real token — the classic timing side channel for bearer-token auth.Suggested fix: use a constant-time comparison, e.g.
std.crypto.timing_safe.eql(orstd.crypto.utils.timingSafeEqlon older Zig), after an early length check that returnsfalsewithout revealing position information.