╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ web.zig ──────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╯
3148 } 3149 3150 pub fn autoLogin(self: SessionStore, out: *[token_hex_len]u8) bool { 3151 out.* = self.auto_login orelse return false; 3152 return true; 3153 } 3154 3155 const auto_login_name = "auto-login"; 3156 3157 // a token is exactly token_hex_len hex chars. validating before using the 3158 // value as a path keeps attacker-supplied cookies from escaping the 3159 // sessions dir (e.g. via "/" or ".." bytes). 3160 fn isToken(token_hex: []const u8) bool { 3161 if (token_hex.len != token_hex_len) return false; 3162 for (token_hex) |c| if (!std.ascii.isHex(c)) return false; 3163 return true; 3164 } 3165 }; 3166