╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ web.zig ──────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
2938 2939 pub fn autoLogin(self: SessionStore, out: *[token_hex_len]u8) bool { 2940 out.* = self.auto_login orelse return false; 2941 return true; 2942 } 2943 2944 const auto_login_name = "auto-login"; 2945 2946 // a token is exactly token_hex_len hex chars. validating before using the 2947 // value as a path keeps attacker-supplied cookies from escaping the 2948 // sessions dir (e.g. via "/" or ".." bytes). 2949 fn isToken(token_hex: []const u8) bool { 2950 if (token_hex.len != token_hex_len) return false; 2951 for (token_hex) |c| if (!std.ascii.isHex(c)) return false; 2952 return true; 2953 } 2954 }; 2955