Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed
- Removed suggested example queries from the Ask landing page. [#1674](https://github.com/sourcebot-dev/sourcebot/pull/1674)
- Require authentication for the streaming and blocking Ask APIs in Public SaaS deployments. [#1679](https://github.com/sourcebot-dev/sourcebot/pull/1679)

## [5.1.14] - 2026-09-17

Expand Down
6 changes: 5 additions & 1 deletion packages/web/src/app/api/(server)/ee/chat/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { getAskSkillAvailabilityAnalytics, getAskSkillTurnCompletedAnalytics } f
import { apiHandler } from "@/lib/apiHandler";
import { ErrorCode } from "@/lib/errorCodes";
import { captureEvent } from "@/lib/posthog";
import { notFound, requestBodySchemaValidationError, ServiceError, serviceErrorResponse } from "@/lib/serviceError";
import { notAuthenticated, notFound, requestBodySchemaValidationError, ServiceError, serviceErrorResponse } from "@/lib/serviceError";
import { isServiceError } from "@/lib/utils";
import { withOptionalAuth } from "@/middleware/withAuth";
import * as Sentry from "@sentry/nextjs";
Expand Down Expand Up @@ -50,6 +50,10 @@ export const POST = apiHandler(async (req: NextRequest) => {

const response = await sew(() =>
withOptionalAuth(async ({ org, user, prisma }) => {
if (env.EXPERIMENT_ASK_GH_ENABLED === 'true' && !user) {
Comment thread
msukkari marked this conversation as resolved.
Comment thread
msukkari marked this conversation as resolved.
return notAuthenticated();
}

// Gate the generative path behind the `ask` entitlement. The client
// also gates this, but server-side enforcement can't be bypassed.
const askError = await checkAskEntitlement();
Expand Down
6 changes: 5 additions & 1 deletion packages/web/src/ee/features/mcp/askCodebase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { LanguageModelInfo, SBChatMessage, SearchScope } from "@/features/chat/t
import { convertLLMOutputToPortableMarkdown, getAnswerPartFromAssistantMessage, getLanguageModelKey } from "@/features/chat/utils";
import { resolveModelCapabilities } from "@/features/chat/modelCapabilities.server";
import { ErrorCode } from "@/lib/errorCodes";
import { ServiceError, ServiceErrorException } from "@/lib/serviceError";
import { notAuthenticated, ServiceError, ServiceErrorException } from "@/lib/serviceError";
import { withOptionalAuth } from "@/middleware/withAuth";
import { ChatVisibility, Prisma } from "@sourcebot/db";
import { createLogger, env } from "@sourcebot/shared";
Expand Down Expand Up @@ -49,6 +49,10 @@ const blockStreamUntilFinish = async <T extends UIMessage<unknown, UIDataTypes,
export const askCodebase = (params: AskCodebaseParams): Promise<AskCodebaseResult | ServiceError> =>
sew(() =>
withOptionalAuth(async ({ org, user, prisma }) => {
if (env.EXPERIMENT_ASK_GH_ENABLED === 'true' && !user) {
return notAuthenticated();
}

// Ask Sourcebot is a paid feature. askCodebase() is the single choke point
// for the programmatic ask path (the MCP `ask_codebase` tool and the
// /api/chat/blocking route both wrap it), so gating here covers both without
Expand Down
Loading