fix(web): auth gate Ask APIs for Public SaaS

Merged
MS
2mo ago
+11-2

Fixes SOU-2308

Require authenticated users for the streaming and blocking Ask APIs when EXPERIMENT_ASK_GH_ENABLED is enabled, while preserving anonymous Ask behavior for self-hosted deployments. The auth override is checked inline at the Ask and MCP HTTP entry points.

Conflict resolution:

  • Resolved the simple CHANGELOG.md conflict by preserving the entries from both branches.
  • Accepted main's non-conflicting removal of the obsolete Ask tutorial/example-query assets and UI.
  • No conflicting intent or semantic conflict remained.

Validation:

  • Web tests: 147 files, 1,503 tests passed (.next/** excluded from Vitest discovery)
  • Public SaaS deployment verification: unauthenticated /api/chat/blocking and /api/ee/chat requests returned 401 NOT_AUTHENTICATED

Linear Issue: SOU-2308

Open in Web Open in Cursor 

Summary by cubic

Requires authenticated users for the streaming and blocking Ask APIs and the MCP ask_codebase tool when EXPERIMENT_ASK_GH_ENABLED is enabled, fixing SOU-2308. Anonymous Ask access is unchanged for self-hosted deployments.

  • Unauthenticated requests are rejected with a 401 (NOT_AUTHENTICATED) service error via an inlined boolean gate at each entry point.
  • The CHANGELOG records the auth requirement for the Ask APIs in Public SaaS deployments.

Summary by CodeRabbit

  • Bug Fixes
    • Ask chat requests in Public SaaS now require authentication when the Ask experiment is enabled. Unauthenticated requests are rejected before entitlement checks or chat processing.
    • The blocking Ask API also rejects unauthenticated requests in this configuration.