Skip to content

Conversation

@torcolvin
Copy link
Collaborator

[3.2.7 backport] CBG-4971 create a one time session id for blipsync

clean backport of f4f2e44

Copilot AI review requested due to automatic review settings October 31, 2025 22:05
@github-actions
Copy link

github-actions bot commented Oct 31, 2025

Redocly previews

Copy link
Contributor

Copilot AI left a 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_time query parameter to the /_session endpoint 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, "")
Copy link

Copilot AI Oct 31, 2025

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.

Copilot uses AI. Check for mistakes.

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.
Copy link

Copilot AI Oct 31, 2025

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'.

Suggested change
// 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.

Copilot uses AI. Check for mistakes.
adamcfraser
adamcfraser previously approved these changes Oct 31, 2025
@adamcfraser adamcfraser merged commit 0e5e0b3 into release/3.2.7 Oct 31, 2025
45 checks passed
@adamcfraser adamcfraser deleted the CBG-4971 branch October 31, 2025 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants