Reject session lifetimes finer than stored millisecond precision
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:
@@ -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"}),
|
||||
|
||||
Reference in New Issue
Block a user