Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: make http session duration configurable#10564

Open
vvaswani wants to merge 2 commits intosyncthing:mainfrom
vvaswani:10522-http
Open

feat: make http session duration configurable#10564
vvaswani wants to merge 2 commits intosyncthing:mainfrom
vvaswani:10522-http

Conversation

@vvaswani
Copy link

@vvaswani vvaswani commented Feb 7, 2026

Purpose

Fixes #10522

Testing

Tested with:

go test ./lib/config -run 'TestGUISessionCookiePathPrepare|TestGUIConfigURL'
go test -tags noassets ./lib/api -run 'TestTokenManagerNoExpiry|TestSessionCookieMaxAgeNoExpiry|TestSessionCookiePathNormalization|TestTokenManager

Authorship

Your name and email will be added automatically to the AUTHORS file
based on the commit metadata.

@github-actions github-actions bot added the enhancement New features or improvements of some kind, as opposed to a problem (bug) label Feb 7, 2026
@steadytao
Copy link
Contributor

Aligning the session duration with a configurable value rather than the hard-coded 7 days addresses the issue raised. However, there are a couple of things worth reviewing:

  • For noExpiryNano, it may be safer to use math.MaxInt64 or explicitly type the const as an int64 to avoid any potential shift/overflow edge cases with 1<<63.
  • When allowing a cookie to effectively never expire (using a large Max-Age), it may be worth noting that there are potential security implications if a session cookie is stolen.
  • For SessionCookiePath, prefixing with "/" is good. It may also be worth trimming whitespace or guarding against unexpected values.

It would also help to include a short “Changes Made” or brief testing note instead of just “Not tested”, even if only manual verification steps.

@vvaswani
Copy link
Author

Aligning the session duration with a configurable value rather than the hard-coded 7 days addresses the issue raised. However, there are a couple of things worth reviewing:

* For noExpiryNano, it may be safer to use math.MaxInt64 or explicitly type the const as an int64 to avoid any potential shift/overflow edge cases with 1<<63.

* When allowing a cookie to effectively never expire (using a large Max-Age), it may be worth noting that there are potential security implications if a session cookie is stolen.

* For SessionCookiePath, prefixing with "/" is good. It may also be worth trimming whitespace or guarding against unexpected values.

It would also help to include a short “Changes Made” or brief testing note instead of just “Not tested”, even if only manual verification steps.

Updated

@steadytao
Copy link
Contributor

LGTM.

Thanks for addressing the typing change and path normalisation, and for adding tests around no-expiry and cookie path handling

@vvaswani
Copy link
Author

@steadytao are you able to merge this now?

@steadytao
Copy link
Contributor

@vvaswani I do not have maintainer access to SyncThing, I am only a contributor and Jakob is currently busy and has been for some time. Please give him some time to review your PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New features or improvements of some kind, as opposed to a problem (bug)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make duration of HTTP sessions configurable

2 participants