Skip to content

Commit 9038812

Browse files
authored
feat: improve session security with HttpOnly and MaxAge options (#46)
Add HttpOnly flag to prevent XSS attacks on session cookies and set MaxAge to 3600 seconds (1 hour) for better session management
1 parent b5736d4 commit 9038812

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

pkg/mcp-proxy/main.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,10 @@ func Run(
207207
router.Use(ginzap.Ginzap(logger, time.RFC3339, true))
208208
router.Use(ginzap.RecoveryWithZap(logger, true))
209209
store := cookie.NewStore(secret)
210+
store.Options(sessions.Options{
211+
MaxAge: 3600,
212+
HttpOnly: true,
213+
})
210214
router.Use(sessions.Sessions("session", store))
211215
authRouter.SetupRoutes(router)
212216
idpRouter.SetupRoutes(router)

0 commit comments

Comments
 (0)