Skip to content

Commit 8c1f927

Browse files
fix(knowledge): enforce trusted workspace scope (#6452)
* fix(knowledge): enforce trusted workspace scope * refactor(knowledge): declare v2 body lifecycle * finish knowledge application migration * refactor(knowledge): compose copilot batch commands * fix(knowledge): parse connector query flags * fix(knowledge): finalize partial batch effects * fix(knowledge): align merged application boundaries * fix(knowledge): close application boundary review gaps * style(knowledge): satisfy branch biome checks * fix(knowledge): page connector documents in editor
1 parent d692245 commit 8c1f927

228 files changed

Lines changed: 10922 additions & 9908 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/sim/app/api/auth/oauth/microsoft/file/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { authorizeCredentialUse } from '@/lib/auth/credential-access'
66
import { validateMicrosoftGraphId } from '@/lib/core/security/input-validation'
77
import { generateRequestId } from '@/lib/core/utils/request'
88
import { withRouteHandler } from '@/lib/core/utils/with-route-handler'
9-
import { getCredential, refreshAccessTokenIfNeeded } from '@/app/api/auth/oauth/utils'
9+
import { getCredential, refreshAccessTokenIfNeeded } from '@/lib/oauth/credential-service'
1010

1111
export const dynamic = 'force-dynamic'
1212

apps/sim/app/api/auth/oauth/microsoft/files/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { authorizeCredentialUse } from '@/lib/auth/credential-access'
66
import { validatePathSegment } from '@/lib/core/security/input-validation'
77
import { generateRequestId } from '@/lib/core/utils/request'
88
import { withRouteHandler } from '@/lib/core/utils/with-route-handler'
9-
import { getCredential, refreshAccessTokenIfNeeded } from '@/app/api/auth/oauth/utils'
9+
import { getCredential, refreshAccessTokenIfNeeded } from '@/lib/oauth/credential-service'
1010
import { GRAPH_ID_PATTERN } from '@/tools/microsoft_excel/utils'
1111
import { assertGraphNextPageUrl, getGraphNextPageUrl } from '@/tools/sharepoint/utils'
1212

apps/sim/app/api/auth/oauth/token/route.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const { mockAuthorizeCredentialUse, mockResolveServiceAccountToken } = vi.hoiste
1717
mockResolveServiceAccountToken: vi.fn(),
1818
}))
1919

20-
vi.mock('@/app/api/auth/oauth/utils', () => ({
20+
vi.mock('@/lib/oauth/credential-service', () => ({
2121
...authOAuthUtilsMock,
2222
resolveServiceAccountToken: mockResolveServiceAccountToken,
2323
}))

apps/sim/app/api/auth/oauth/token/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ import { AuthType, checkSessionOrInternalAuth } from '@/lib/auth/hybrid'
1212
import { generateRequestId } from '@/lib/core/utils/request'
1313
import { withRouteHandler } from '@/lib/core/utils/with-route-handler'
1414
import { TokenServiceAccountValidationError } from '@/lib/credentials/token-service-accounts/errors'
15-
import { captureServerEvent } from '@/lib/posthog/server'
1615
import {
1716
getCredential,
1817
getOAuthToken,
1918
refreshTokenIfNeeded,
2019
resolveOAuthAccountId,
2120
resolveServiceAccountToken,
22-
} from '@/app/api/auth/oauth/utils'
21+
} from '@/lib/oauth/credential-service'
22+
import { captureServerEvent } from '@/lib/posthog/server'
2323
import { extractZohoDeskBaseFromScope } from '@/tools/zoho_desk/host-allowlist'
2424

2525
export const dynamic = 'force-dynamic'

apps/sim/app/api/auth/oauth/utils.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@ import { db } from '@sim/db'
2828
import { __resetCoalesceLocallyForTests } from '@/lib/concurrency/singleflight'
2929
import { ZOOM_SERVICE_ACCOUNT_PROVIDER_ID } from '@/lib/credentials/client-credential-accounts/descriptors'
3030
import { refreshOAuthToken } from '@/lib/oauth'
31-
import {
32-
ATLASSIAN_SERVICE_ACCOUNT_PROVIDER_ID,
33-
GOOGLE_SERVICE_ACCOUNT_PROVIDER_ID,
34-
SLACK_CUSTOM_BOT_PROVIDER_ID,
35-
} from '@/lib/oauth/types'
3631
import {
3732
getCredential,
3833
refreshAccessTokenIfNeeded,
3934
refreshTokenIfNeeded,
4035
resolveServiceAccountToken,
41-
} from '@/app/api/auth/oauth/utils'
36+
} from '@/lib/oauth/credential-service'
37+
import {
38+
ATLASSIAN_SERVICE_ACCOUNT_PROVIDER_ID,
39+
GOOGLE_SERVICE_ACCOUNT_PROVIDER_ID,
40+
SLACK_CUSTOM_BOT_PROVIDER_ID,
41+
} from '@/lib/oauth/types'
4242

4343
const mockDb = db as any
4444
const mockRefreshOAuthToken = refreshOAuthToken as any

apps/sim/app/api/auth/oauth/wealthbox/item/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { authorizeCredentialUse } from '@/lib/auth/credential-access'
66
import { validateEnum, validatePathSegment } from '@/lib/core/security/input-validation'
77
import { generateRequestId } from '@/lib/core/utils/request'
88
import { withRouteHandler } from '@/lib/core/utils/with-route-handler'
9-
import { refreshAccessTokenIfNeeded } from '@/app/api/auth/oauth/utils'
9+
import { refreshAccessTokenIfNeeded } from '@/lib/oauth/credential-service'
1010

1111
export const dynamic = 'force-dynamic'
1212

apps/sim/app/api/auth/oauth/wealthbox/items/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { authorizeCredentialUse } from '@/lib/auth/credential-access'
66
import { validatePathSegment } from '@/lib/core/security/input-validation'
77
import { generateRequestId } from '@/lib/core/utils/request'
88
import { withRouteHandler } from '@/lib/core/utils/with-route-handler'
9-
import { refreshAccessTokenIfNeeded } from '@/app/api/auth/oauth/utils'
9+
import { refreshAccessTokenIfNeeded } from '@/lib/oauth/credential-service'
1010

1111
export const dynamic = 'force-dynamic'
1212

apps/sim/app/api/auth/oauth2/callback/instagram/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ import { getBaseUrl } from '@/lib/core/utils/urls'
1818
import { isSameOrigin } from '@/lib/core/utils/validation'
1919
import { withRouteHandler } from '@/lib/core/utils/with-route-handler'
2020
import { processCredentialDraft } from '@/lib/credentials/draft-processor'
21+
import { safeAccountInsert } from '@/lib/oauth/credential-service'
2122
import {
2223
parseInstagramLongLivedToken,
2324
parseInstagramProfile,
2425
parseInstagramShortLivedToken,
2526
} from '@/lib/oauth/instagram'
2627
import { getCanonicalScopesForProvider } from '@/lib/oauth/utils'
27-
import { safeAccountInsert } from '@/app/api/auth/oauth/utils'
2828
import { INSTAGRAM_GRAPH_BASE } from '@/tools/instagram/constants'
2929

3030
const logger = createLogger('InstagramCallback')

apps/sim/app/api/auth/oauth2/shopify/store/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { getBaseUrl } from '@/lib/core/utils/urls'
1212
import { isSameOrigin } from '@/lib/core/utils/validation'
1313
import { withRouteHandler } from '@/lib/core/utils/with-route-handler'
1414
import { processCredentialDraft } from '@/lib/credentials/draft-processor'
15-
import { safeAccountInsert } from '@/app/api/auth/oauth/utils'
15+
import { safeAccountInsert } from '@/lib/oauth/credential-service'
1616
import { SHOPIFY_API_VERSION } from '@/tools/shopify/constants'
1717

1818
const logger = createLogger('ShopifyStore')

apps/sim/app/api/auth/trello/store/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import { getSession } from '@/lib/auth'
99
import { env } from '@/lib/core/config/env'
1010
import { withRouteHandler } from '@/lib/core/utils/with-route-handler'
1111
import { processCredentialDraft } from '@/lib/credentials/draft-processor'
12+
import { safeAccountInsert } from '@/lib/oauth/credential-service'
1213
import { getCanonicalScopesForProvider } from '@/lib/oauth/utils'
13-
import { safeAccountInsert } from '@/app/api/auth/oauth/utils'
1414

1515
const logger = createLogger('TrelloStore')
1616

0 commit comments

Comments
 (0)