Reject session lifetimes finer than stored millisecond precision
CI / ci (push) Successful in 1m26s
CI / ci (pull_request) Successful in 1m24s

MEALQUEST_SESSION_IDLE and MEALQUEST_SESSION_MAX must now be whole
milliseconds: session expiry is stored as a store.Timestamp, so a value
such as 1500us would be truncated and a session could expire early.

Fixes review finding MQ-19-1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-03 10:08:46 -04:00
co-authored by Claude Opus 5.5
parent 1dfba7b9db
commit 60c3538967
2 changed files with 28 additions and 2 deletions
+14
View File
@@ -269,6 +269,20 @@ func TestLoad(t *testing.T) {
env: with(map[string]string{EnvSessionMax: "-1h"}),
badVars: []string{EnvSessionMax},
},
{
name: "whole-millisecond session lifetimes",
env: with(map[string]string{EnvSessionIdle: "1ms", EnvSessionMax: "2ms"}),
},
{
name: "sub-millisecond session idle",
env: with(map[string]string{EnvSessionIdle: "1500us", EnvSessionMax: "2ms"}),
badVars: []string{EnvSessionIdle},
},
{
name: "sub-millisecond session max",
env: with(map[string]string{EnvSessionIdle: "1ms", EnvSessionMax: "1ms500us"}),
badVars: []string{EnvSessionMax},
},
{
name: "session max below idle",
env: with(map[string]string{EnvSessionIdle: "48h", EnvSessionMax: "24h"}),