Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pkg/mcp-proxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,10 @@ func Run(
router.Use(ginzap.Ginzap(logger, time.RFC3339, true))
router.Use(ginzap.RecoveryWithZap(logger, true))
store := cookie.NewStore(secret)
store.Options(sessions.Options{
MaxAge: 3600,
Copy link

Copilot AI Aug 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The MaxAge value of 3600 seconds (1 hour) is hardcoded. Consider making this configurable through environment variables or configuration files to allow different timeout values across environments.

Suggested change
MaxAge: 3600,
// Make session MaxAge configurable via environment variable
maxAge := 3600
if v := os.Getenv("SESSION_MAX_AGE"); v != "" {
if parsed, err := strconv.Atoi(v); err == nil && parsed > 0 {
maxAge = parsed
}
}
store.Options(sessions.Options{
MaxAge: maxAge,

Copilot uses AI. Check for mistakes.
HttpOnly: true,
Copy link

Copilot AI Aug 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The session options are missing the Secure flag which should be set to true in production to ensure cookies are only transmitted over HTTPS connections.

Suggested change
HttpOnly: true,
store := cookie.NewStore(secret)
secureCookie := parsedExternalURL.Scheme == "https"
store.Options(sessions.Options{
MaxAge: 3600,
HttpOnly: true,
Secure: secureCookie,

Copilot uses AI. Check for mistakes.
})
router.Use(sessions.Sessions("session", store))
authRouter.SetupRoutes(router)
idpRouter.SetupRoutes(router)
Expand Down