-
Notifications
You must be signed in to change notification settings - Fork 140
[3.2.7 backport] CBG-4971 create a one time session id for blipsync #7858
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Redocly previews |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements one-time session functionality for BLIP sync authentication in Sync Gateway. It adds support for creating sessions that are automatically deleted after a single use, specifically designed for WebSocket-based BLIP sync connections.
- Adds a
one_timequery parameter to the/_sessionendpoint to create single-use sessions - Implements WebSocket token authentication for BLIP sync using one-time session IDs
- Updates session management to handle automatic deletion of one-time sessions upon authentication
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| rest/session_api.go | Adds one-time session creation logic and TTL constants |
| rest/handler.go | Implements WebSocket token extraction and one-time session authentication |
| rest/blip_sync.go | Defines constants for WebSocket protocol headers and session ID prefixes |
| auth/session.go | Adds one-time session field and deletion logic to session management |
| rest/session_test.go | Adds test for one-time session cookie authentication |
| rest/blip_sync_test.go | Adds comprehensive tests for one-time session BLIP sync authentication |
| auth/session_test.go | Updates existing tests and adds one-time session specific tests |
| rest/oidc_api.go | Updates OIDC session creation to support new one-time parameter |
| docs/api/paths/public/db-_session.yaml | Updates API documentation for the new one_time parameter |
| func (h *handler) respondWithSessionInfo() error { | ||
|
|
||
| response := h.formatSessionResponse(h.user) | ||
| response := h.formatSessionResponse(h.user, "") |
Copilot
AI
Oct 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The empty string parameter is unclear. Consider using a constant or named parameter to make the intent explicit that this is for non-one-time sessions.
|
|
||
| func (auth *Authenticator) CreateSession(ctx context.Context, user User, ttl time.Duration) (*LoginSession, error) { | ||
| // AuthenticateOneTimeSession authenticates a session and deletes it upon successful authentication if it was marked as | ||
| // a one time sesssion. If it is a one time session, delete the session. |
Copilot
AI
Oct 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'sesssion' to 'session'.
| // a one time sesssion. If it is a one time session, delete the session. | |
| // a one time session. If it is a one time session, delete the session. |
[3.2.7 backport] CBG-4971 create a one time session id for blipsync
clean backport of f4f2e44