fix: set DestroySession MaxAge to -1 instead of -1*time.Second (closes #39) #50
No reviewers
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sneak/upaas#50
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch ":fix/destroy-session-maxage"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fixes the
DestroySessionmethod which was settingMaxAge = -1 * int(time.Second)(resulting in-1000000000) instead of simply-1.The gorilla/sessions
MaxAgefield expects a value in seconds. The previous code multiplied bytime.Second(nanoseconds), which worked by accident since any negative value deletes the cookie, but was semantically incorrect.Changes
internal/service/auth/auth.go: ChangedMaxAge = -1 * int(time.Second)toMaxAge = -1; removed unusedtimeimportinternal/service/auth/auth_test.go: AddedTestDestroySessionMaxAgetest(closes #39)
Test Results ✅
All tests pass:
All other packages also pass (database, docker, handlers, middleware, models, app, webhook, ssh).
Lint Results ✅
No new lint issues. One pre-existing issue in
internal/handlers/tail_validation_test.go(wrong package name) — not related to this change.