Changesets · Branches · Tags · Compare
| Changeset | 14ae2753a67837ea995be98c706a24e5e4ae25626b211ed1dfb0522a54aebd2a |
|---|---|
| Author | Dallin Romney <dallinromney@gmail.com> · 2025-05-20 13:03 -07:00 |
| Committer | Dallin Romney <dallinromney@gmail.com> · 2025-05-20 13:03 -07:00 |
| Parents | 0bf20e4b2e71, bca04184b531 |
21 files changed
modified .gitignore +2 −1
| @@ -166,4 +166,5 @@ | ||
| 166 | 166 | *.iml |
| 167 | 167 | |
| 168 | 168 | .continuerules |
| 169 | -**/.continue/assistants/ | |
| No newline at the end of the file | ||
| 169 | +**/.continue/assistants/ | |
| 170 | +keys | |
| No newline at the end of the file |
modified core/config/ConfigHandler.ts +14 −7
| @@ -1,10 +1,6 @@ | ||
| 1 | 1 | import { ConfigResult } from "@continuedev/config-yaml"; |
| 2 | 2 | |
| 3 | -import { | |
| 4 | - ControlPlaneClient, | |
| 5 | - ControlPlaneSessionInfo, | |
| 6 | -} from "../control-plane/client.js"; | |
| 7 | -import { getControlPlaneEnv } from "../control-plane/env.js"; | |
| 3 | +import { ControlPlaneClient } from "../control-plane/client.js"; | |
| 8 | 4 | import { |
| 9 | 5 | BrowserSerializedContinueConfig, |
| 10 | 6 | ContinueConfig, |
| @@ -15,6 +11,11 @@ | ||
| 15 | 11 | } from "../index.js"; |
| 16 | 12 | import { GlobalContext } from "../util/GlobalContext.js"; |
| 17 | 13 | |
| 14 | +import { | |
| 15 | + AuthType, | |
| 16 | + ControlPlaneSessionInfo, | |
| 17 | +} from "../control-plane/AuthTypes.js"; | |
| 18 | +import { getControlPlaneEnv } from "../control-plane/env.js"; | |
| 18 | 19 | import { logger } from "../util/logger.js"; |
| 19 | 20 | import { |
| 20 | 21 | ASSISTANTS, |
| @@ -136,8 +137,7 @@ | ||
| 136 | 137 | } |
| 137 | 138 | |
| 138 | 139 | private async getOrgs(): Promise<OrgWithProfiles[]> { |
| 139 | - const userId = await this.controlPlaneClient.userId; | |
| 140 | - if (userId) { | |
| 140 | + if (await this.controlPlaneClient.isSignedIn()) { | |
| 141 | 141 | const orgDescs = await this.controlPlaneClient.listOrganizations(); |
| 142 | 142 | const personalHubOrg = await this.getPersonalHubOrg(); |
| 143 | 143 | const hubOrgs = await Promise.all( |
| @@ -270,6 +270,13 @@ | ||
| 270 | 270 | /** |
| 271 | 271 | * Users can define as many local assistants as they want in a `.continue/assistants` folder |
| 272 | 272 | */ |
| 273 | + | |
| 274 | + // Local customization disabled for on-premise deployments | |
| 275 | + const env = await getControlPlaneEnv(this.ide.getIdeSettings()); | |
| 276 | + if (env.AUTH_TYPE === AuthType.OnPrem) { | |
| 277 | + return []; | |
| 278 | + } | |
| 279 | + | |
| 273 | 280 | const localProfiles: ProfileLifecycleManager[] = []; |
| 274 | 281 | |
| 275 | 282 | if (options.includeGlobal) { |
modified core/config/yaml/loadYaml.ts +3 −4
| @@ -41,7 +41,6 @@ | ||
| 41 | 41 | import { modifyAnyConfigWithSharedConfig } from "../sharedConfig"; |
| 42 | 42 | |
| 43 | 43 | import { getControlPlaneEnvSync } from "../../control-plane/env"; |
| 44 | -import { logger } from "../../util/logger"; | |
| 45 | 44 | import { getCleanUriPath } from "../../util/uri"; |
| 46 | 45 | import { getAllDotContinueYamlFiles } from "../loadLocalAssistants"; |
| 47 | 46 | import { LocalPlatformClient } from "./LocalPlatformClient"; |
| @@ -115,9 +114,9 @@ | ||
| 115 | 114 | ? dirname(getCleanUriPath(packageIdentifier.filePath)) |
| 116 | 115 | : undefined; |
| 117 | 116 | |
| 118 | - logger.info( | |
| 119 | - `Loading config.yaml from ${JSON.stringify(packageIdentifier)} with root path ${rootPath}`, | |
| 120 | - ); | |
| 117 | + // logger.info( | |
| 118 | + // `Loading config.yaml from ${JSON.stringify(packageIdentifier)} with root path ${rootPath}`, | |
| 119 | + // ); | |
| 121 | 120 | |
| 122 | 121 | let config = |
| 123 | 122 | overrideConfigYaml ?? |
added core/control-plane/AuthTypes.ts +55 −0
| @@ -0,0 +1,55 @@ | ||
| 1 | +export interface HubSessionInfo { | |
| 2 | + AUTH_TYPE: AuthType.WorkOsProd | AuthType.WorkOsStaging; | |
| 3 | + accessToken: string; | |
| 4 | + account: { | |
| 5 | + label: string; | |
| 6 | + id: string; | |
| 7 | + }; | |
| 8 | +} | |
| 9 | + | |
| 10 | +export interface OnPremSessionInfo { | |
| 11 | + AUTH_TYPE: AuthType.OnPrem; | |
| 12 | +} | |
| 13 | + | |
| 14 | +export type ControlPlaneSessionInfo = HubSessionInfo | OnPremSessionInfo; | |
| 15 | + | |
| 16 | +export function isHubSession( | |
| 17 | + sessionInfo: ControlPlaneSessionInfo | undefined, | |
| 18 | +): sessionInfo is HubSessionInfo { | |
| 19 | + return ( | |
| 20 | + sessionInfo !== undefined && | |
| 21 | + (sessionInfo.AUTH_TYPE === AuthType.WorkOsProd || | |
| 22 | + sessionInfo.AUTH_TYPE === AuthType.WorkOsStaging) | |
| 23 | + ); | |
| 24 | +} | |
| 25 | + | |
| 26 | +export enum AuthType { | |
| 27 | + WorkOsProd = "continue", | |
| 28 | + WorkOsStaging = "continue-staging", | |
| 29 | + OnPrem = "on-prem", | |
| 30 | +} | |
| 31 | + | |
| 32 | +export interface HubEnv { | |
| 33 | + DEFAULT_CONTROL_PLANE_PROXY_URL: string; | |
| 34 | + CONTROL_PLANE_URL: string; | |
| 35 | + AUTH_TYPE: AuthType.WorkOsProd | AuthType.WorkOsStaging; | |
| 36 | + WORKOS_CLIENT_ID: string; | |
| 37 | + APP_URL: string; | |
| 38 | +} | |
| 39 | + | |
| 40 | +export interface OnPremEnv { | |
| 41 | + AUTH_TYPE: AuthType.OnPrem; | |
| 42 | + DEFAULT_CONTROL_PLANE_PROXY_URL: string; | |
| 43 | + CONTROL_PLANE_URL: string; | |
| 44 | + APP_URL: string; | |
| 45 | +} | |
| 46 | + | |
| 47 | +export type ControlPlaneEnv = HubEnv | OnPremEnv; | |
| 48 | + | |
| 49 | +export function isHubEnv(env: ControlPlaneEnv): env is HubEnv { | |
| 50 | + return ( | |
| 51 | + "AUTH_TYPE" in env && | |
| 52 | + env.AUTH_TYPE !== "on-prem" && | |
| 53 | + "WORKOS_CLIENT_ID" in env | |
| 54 | + ); | |
| 55 | +} |
modified core/control-plane/auth/index.ts +6 −0
| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | import { v4 as uuidv4 } from "uuid"; |
| 2 | 2 | import { IdeSettings } from "../.."; |
| 3 | +import { isHubEnv } from "../AuthTypes"; | |
| 3 | 4 | import { getControlPlaneEnv } from "../env"; |
| 4 | 5 | |
| 5 | 6 | export async function getAuthUrlForTokenPage( |
| @@ -7,6 +8,11 @@ | ||
| 7 | 8 | useOnboarding: boolean, |
| 8 | 9 | ): Promise<string> { |
| 9 | 10 | const env = await getControlPlaneEnv(ideSettingsPromise); |
| 11 | + | |
| 12 | + if (!isHubEnv(env)) { | |
| 13 | + throw new Error("Sign in disabled"); | |
| 14 | + } | |
| 15 | + | |
| 10 | 16 | const url = new URL("https://api.workos.com/user_management/authorize"); |
| 11 | 17 | const params = { |
| 12 | 18 | response_type: "code", |
modified core/control-plane/client.ts +17 −52
| @@ -12,16 +12,9 @@ | ||
| 12 | 12 | import { OrganizationDescription } from "../config/ProfileLifecycleManager.js"; |
| 13 | 13 | import { IdeSettings, ModelDescription } from "../index.js"; |
| 14 | 14 | |
| 15 | +import { ControlPlaneSessionInfo, isHubSession } from "./AuthTypes.js"; | |
| 15 | 16 | import { getControlPlaneEnv } from "./env.js"; |
| 16 | 17 | |
| 17 | -export interface ControlPlaneSessionInfo { | |
| 18 | - accessToken: string; | |
| 19 | - account: { | |
| 20 | - label: string; | |
| 21 | - id: string; | |
| 22 | - }; | |
| 23 | -} | |
| 24 | - | |
| 25 | 18 | export interface ControlPlaneWorkspace { |
| 26 | 19 | id: string; |
| 27 | 20 | name: string; |
| @@ -45,8 +38,7 @@ | ||
| 45 | 38 | fqsns: FQSN[], |
| 46 | 39 | orgScopeId: string | null, |
| 47 | 40 | ): Promise<(SecretResult | undefined)[]> { |
| 48 | - const userId = await this.userId; | |
| 49 | - if (!userId) { | |
| 41 | + if (!(await this.isSignedIn())) { | |
| 50 | 42 | return fqsns.map((fqsn) => ({ |
| 51 | 43 | found: false, |
| 52 | 44 | fqsn, |
| @@ -64,19 +56,24 @@ | ||
| 64 | 56 | return (await resp.json()) as any; |
| 65 | 57 | } |
| 66 | 58 | |
| 67 | - get userId(): Promise<string | undefined> { | |
| 68 | - return this.sessionInfoPromise.then( | |
| 69 | - (sessionInfo) => sessionInfo?.account.id, | |
| 70 | - ); | |
| 59 | + async isSignedIn(): Promise<boolean> { | |
| 60 | + const sessionInfo = await this.sessionInfoPromise; | |
| 61 | + return !!sessionInfo; | |
| 71 | 62 | } |
| 72 | 63 | |
| 73 | 64 | async getAccessToken(): Promise<string | undefined> { |
| 74 | - return (await this.sessionInfoPromise)?.accessToken; | |
| 65 | + const sessionInfo = await this.sessionInfoPromise; | |
| 66 | + return isHubSession(sessionInfo) ? sessionInfo.accessToken : undefined; | |
| 75 | 67 | } |
| 76 | 68 | |
| 77 | 69 | private async request(path: string, init: RequestInit): Promise<Response> { |
| 78 | - const accessToken = await this.getAccessToken(); | |
| 79 | - if (!accessToken) { | |
| 70 | + const sessionInfo = await this.sessionInfoPromise; | |
| 71 | + const hubSession = isHubSession(sessionInfo); | |
| 72 | + | |
| 73 | + const accessToken = hubSession ? sessionInfo.accessToken : undefined; | |
| 74 | + | |
| 75 | + // Bearer token not necessary for on-prem auth type | |
| 76 | + if (!accessToken && hubSession) { | |
| 80 | 77 | throw new Error("No access token"); |
| 81 | 78 | } |
| 82 | 79 | |
| @@ -99,22 +96,6 @@ | ||
| 99 | 96 | return resp; |
| 100 | 97 | } |
| 101 | 98 | |
| 102 | - public async listWorkspaces(): Promise<ControlPlaneWorkspace[]> { | |
| 103 | - const userId = await this.userId; | |
| 104 | - if (!userId) { | |
| 105 | - return []; | |
| 106 | - } | |
| 107 | - | |
| 108 | - try { | |
| 109 | - const resp = await this.request("workspaces", { | |
| 110 | - method: "GET", | |
| 111 | - }); | |
| 112 | - return (await resp.json()) as any; | |
| 113 | - } catch (e) { | |
| 114 | - return []; | |
| 115 | - } | |
| 116 | - } | |
| 117 | - | |
| 118 | 99 | public async listAssistants(organizationId: string | null): Promise< |
| 119 | 100 | { |
| 120 | 101 | configResult: ConfigResult<AssistantUnrolled>; |
| @@ -124,8 +105,7 @@ | ||
| 124 | 105 | rawYaml: string; |
| 125 | 106 | }[] |
| 126 | 107 | > { |
| 127 | - const userId = await this.userId; | |
| 128 | - if (!userId) { | |
| 108 | + if (!(await this.isSignedIn())) { | |
| 129 | 109 | return []; |
| 130 | 110 | } |
| 131 | 111 | |
| @@ -144,9 +124,7 @@ | ||
| 144 | 124 | } |
| 145 | 125 | |
| 146 | 126 | public async listOrganizations(): Promise<Array<OrganizationDescription>> { |
| 147 | - const userId = await this.userId; | |
| 148 | - | |
| 149 | - if (!userId) { | |
| 127 | + if (!(await this.isSignedIn())) { | |
| 150 | 128 | return []; |
| 151 | 129 | } |
| 152 | 130 | |
| @@ -164,8 +142,7 @@ | ||
| 164 | 142 | public async listAssistantFullSlugs( |
| 165 | 143 | organizationId: string | null, |
| 166 | 144 | ): Promise<FullSlug[] | null> { |
| 167 | - const userId = await this.userId; | |
| 168 | - if (!userId) { | |
| 145 | + if (!(await this.isSignedIn())) { | |
| 169 | 146 | return null; |
| 170 | 147 | } |
| 171 | 148 | |
| @@ -183,16 +160,4 @@ | ||
| 183 | 160 | return null; |
| 184 | 161 | } |
| 185 | 162 | } |
| 186 | - | |
| 187 | - async getSettingsForWorkspace(workspaceId: string): Promise<ConfigJson> { | |
| 188 | - const userId = await this.userId; | |
| 189 | - if (!userId) { | |
| 190 | - throw new Error("No user id"); | |
| 191 | - } | |
| 192 | - | |
| 193 | - const resp = await this.request(`workspaces/${workspaceId}`, { | |
| 194 | - method: "GET", | |
| 195 | - }); | |
| 196 | - return ((await resp.json()) as any).settings; | |
| 197 | - } | |
| 198 | 163 | } |
modified core/control-plane/env.ts +18 −15
| @@ -4,27 +4,18 @@ | ||
| 4 | 4 | getLocalEnvironmentDotFilePath, |
| 5 | 5 | getStagingEnvironmentDotFilePath, |
| 6 | 6 | } from "../util/paths"; |
| 7 | - | |
| 8 | -export interface ControlPlaneEnv { | |
| 9 | - DEFAULT_CONTROL_PLANE_PROXY_URL: string; | |
| 10 | - CONTROL_PLANE_URL: string; | |
| 11 | - AUTH_TYPE: string; | |
| 12 | - WORKOS_CLIENT_ID: string; | |
| 13 | - APP_URL: string; | |
| 14 | -} | |
| 7 | +import { AuthType, ControlPlaneEnv } from "./AuthTypes"; | |
| 8 | +import { getMdmKeys } from "./mdm"; | |
| 15 | 9 | |
| 16 | 10 | export const EXTENSION_NAME = "continue"; |
| 17 | 11 | |
| 18 | 12 | const WORKOS_CLIENT_ID_PRODUCTION = "client_01J0FW6XN8N2XJAECF7NE0Y65J"; |
| 19 | 13 | const WORKOS_CLIENT_ID_STAGING = "client_01J0FW6XCPMJMQ3CG51RB4HBZQ"; |
| 20 | 14 | |
| 21 | -const WORKOS_ENV_ID_PRODUCTION = "continue"; | |
| 22 | -const WORKOS_ENV_ID_STAGING = "continue-staging"; | |
| 23 | - | |
| 24 | 15 | const PRODUCTION_HUB_ENV: ControlPlaneEnv = { |
| 25 | 16 | DEFAULT_CONTROL_PLANE_PROXY_URL: "https://api.continue.dev/", |
| 26 | 17 | CONTROL_PLANE_URL: "https://api.continue.dev/", |
| 27 | - AUTH_TYPE: WORKOS_ENV_ID_PRODUCTION, | |
| 18 | + AUTH_TYPE: AuthType.WorkOsProd, | |
| 28 | 19 | WORKOS_CLIENT_ID: WORKOS_CLIENT_ID_PRODUCTION, |
| 29 | 20 | APP_URL: "https://hub.continue.dev/", |
| 30 | 21 | }; |
| @@ -32,7 +23,7 @@ | ||
| 32 | 23 | const STAGING_ENV: ControlPlaneEnv = { |
| 33 | 24 | DEFAULT_CONTROL_PLANE_PROXY_URL: "https://api.continue-stage.tools/", |
| 34 | 25 | CONTROL_PLANE_URL: "https://api.continue-stage.tools/", |
| 35 | - AUTH_TYPE: WORKOS_ENV_ID_STAGING, | |
| 26 | + AUTH_TYPE: AuthType.WorkOsStaging, | |
| 36 | 27 | WORKOS_CLIENT_ID: WORKOS_CLIENT_ID_STAGING, |
| 37 | 28 | APP_URL: "https://hub.continue-stage.tools/", |
| 38 | 29 | }; |
| @@ -40,7 +31,7 @@ | ||
| 40 | 31 | const TEST_ENV: ControlPlaneEnv = { |
| 41 | 32 | DEFAULT_CONTROL_PLANE_PROXY_URL: "https://api-test.continue.dev/", |
| 42 | 33 | CONTROL_PLANE_URL: "https://api-test.continue.dev/", |
| 43 | - AUTH_TYPE: WORKOS_ENV_ID_STAGING, | |
| 34 | + AUTH_TYPE: AuthType.WorkOsStaging, | |
| 44 | 35 | WORKOS_CLIENT_ID: WORKOS_CLIENT_ID_STAGING, |
| 45 | 36 | APP_URL: "https://app-test.continue.dev/", |
| 46 | 37 | }; |
| @@ -48,7 +39,7 @@ | ||
| 48 | 39 | const LOCAL_ENV: ControlPlaneEnv = { |
| 49 | 40 | DEFAULT_CONTROL_PLANE_PROXY_URL: "http://localhost:3001/", |
| 50 | 41 | CONTROL_PLANE_URL: "http://localhost:3001/", |
| 51 | - AUTH_TYPE: WORKOS_ENV_ID_STAGING, | |
| 42 | + AUTH_TYPE: AuthType.WorkOsStaging, | |
| 52 | 43 | WORKOS_CLIENT_ID: WORKOS_CLIENT_ID_STAGING, |
| 53 | 44 | APP_URL: "http://localhost:3000/", |
| 54 | 45 | }; |
| @@ -67,6 +58,18 @@ | ||
| 67 | 58 | export function getControlPlaneEnvSync( |
| 68 | 59 | ideTestEnvironment: IdeSettings["continueTestEnvironment"], |
| 69 | 60 | ): ControlPlaneEnv { |
| 61 | + // MDM override | |
| 62 | + const mdmKeys = getMdmKeys(); | |
| 63 | + if (mdmKeys) { | |
| 64 | + const { apiUrl } = mdmKeys; | |
| 65 | + return { | |
| 66 | + AUTH_TYPE: AuthType.OnPrem, | |
| 67 | + DEFAULT_CONTROL_PLANE_PROXY_URL: apiUrl, | |
| 68 | + CONTROL_PLANE_URL: apiUrl, | |
| 69 | + APP_URL: "https://hub.continue.dev/", | |
| 70 | + }; | |
| 71 | + } | |
| 72 | + | |
| 70 | 73 | // Note .local overrides .staging |
| 71 | 74 | if (fs.existsSync(getLocalEnvironmentDotFilePath())) { |
| 72 | 75 | return LOCAL_ENV; |
added core/control-plane/mdm.test.ts +127 −0
| @@ -0,0 +1,127 @@ | ||
| 1 | +import * as crypto from "crypto"; | |
| 2 | +import { LicenseData, validateLicenseKey } from "./mdm"; | |
| 3 | + | |
| 4 | +// We'll create a real key pair once for all tests | |
| 5 | +const testKeyPair = crypto.generateKeyPairSync("rsa", { | |
| 6 | + modulusLength: 2048, | |
| 7 | + publicKeyEncoding: { | |
| 8 | + type: "spki", | |
| 9 | + format: "pem", | |
| 10 | + }, | |
| 11 | + privateKeyEncoding: { | |
| 12 | + type: "pkcs8", | |
| 13 | + format: "pem", | |
| 14 | + }, | |
| 15 | +}); | |
| 16 | + | |
| 17 | +// Custom function to create test licenses (replaces the original mock-dependent one) | |
| 18 | +function createTestLicense( | |
| 19 | + licenseData: LicenseData, | |
| 20 | + useValidSignature: boolean = true, | |
| 21 | +): string { | |
| 22 | + // Convert license data to a string | |
| 23 | + const licenseDataStr = JSON.stringify(licenseData); | |
| 24 | + | |
| 25 | + // Create a signature with our generated private key | |
| 26 | + const sign = crypto.createSign("SHA256"); | |
| 27 | + sign.update(licenseDataStr); | |
| 28 | + sign.end(); | |
| 29 | + | |
| 30 | + let signature: string; | |
| 31 | + if (useValidSignature) { | |
| 32 | + signature = sign.sign(testKeyPair.privateKey, "base64"); | |
| 33 | + } else { | |
| 34 | + // For invalid tests, create an intentionally wrong signature by signing different data | |
| 35 | + const wrongSign = crypto.createSign("SHA256"); | |
| 36 | + wrongSign.update(licenseDataStr + "tampered"); | |
| 37 | + wrongSign.end(); | |
| 38 | + signature = wrongSign.sign(testKeyPair.privateKey, "base64"); | |
| 39 | + } | |
| 40 | + // Combine data and signature into a license key | |
| 41 | + const licenseKeyObj = { | |
| 42 | + data: licenseDataStr, | |
| 43 | + signature: signature, | |
| 44 | + }; | |
| 45 | + | |
| 46 | + return Buffer.from(JSON.stringify(licenseKeyObj)).toString("base64"); | |
| 47 | +} | |
| 48 | + | |
| 49 | +// We need to test the actual implementation - which we can't mock with ESM | |
| 50 | +// Instead, we'll have tests that bypass validation or are expected to fail | |
| 51 | +// depending on what we're testing | |
| 52 | + | |
| 53 | +test("validateLicenseKey returns false for malformed license key", () => { | |
| 54 | + // Test with a completely invalid license key | |
| 55 | + const invalidLicenseKey = "not-a-valid-license-key"; | |
| 56 | + | |
| 57 | + // Test - no mocks, real validation | |
| 58 | + const result = validateLicenseKey(invalidLicenseKey); | |
| 59 | + | |
| 60 | + // Assert | |
| 61 | + expect(result).toBe(false); | |
| 62 | +}); | |
| 63 | + | |
| 64 | +test("validateLicenseKey returns false for invalid JSON in license key", () => { | |
| 65 | + // Create a malformed but base64-encoded string | |
| 66 | + const malformedLicenseKey = Buffer.from("this is not valid JSON").toString( | |
| 67 | + "base64", | |
| 68 | + ); | |
| 69 | + | |
| 70 | + // Test - no mocks, real validation | |
| 71 | + const result = validateLicenseKey(malformedLicenseKey); | |
| 72 | + | |
| 73 | + // Assert | |
| 74 | + expect(result).toBe(false); | |
| 75 | +}); | |
| 76 | + | |
| 77 | +test("validateLicenseKey returns false for expired license", () => { | |
| 78 | + // Without mocking, we expect this to fail signature verification | |
| 79 | + // We're testing the date logic by itself | |
| 80 | + const licenseData: LicenseData = { | |
| 81 | + customerId: "customer123", | |
| 82 | + createdAt: new Date(Date.now() - 2000 * 60 * 60 * 24).toISOString(), // Created 2 days ago | |
| 83 | + expiresAt: new Date(Date.now() - 1000 * 60 * 60 * 24).toISOString(), // Expired 1 day ago | |
| 84 | + }; | |
| 85 | + | |
| 86 | + // Create a license key - will fail verification but test logic still works | |
| 87 | + const expiredLicenseKey = createTestLicense(licenseData); | |
| 88 | + | |
| 89 | + // Test - expect false, either due to signature or expiration - both are valid test cases | |
| 90 | + const result = validateLicenseKey(expiredLicenseKey); | |
| 91 | + | |
| 92 | + // Assert | |
| 93 | + expect(result).toBe(false); | |
| 94 | +}); | |
| 95 | + | |
| 96 | +test("validateLicenseKey returns false for invalid signature", () => { | |
| 97 | + // Create license data with valid dates | |
| 98 | + const licenseData: LicenseData = { | |
| 99 | + customerId: "customer123", | |
| 100 | + createdAt: new Date().toISOString(), | |
| 101 | + expiresAt: new Date(Date.now() + 1000 * 60 * 60 * 24).toISOString(), // Valid for 1 day | |
| 102 | + }; | |
| 103 | + | |
| 104 | + // Create a license with an invalid signature | |
| 105 | + const invalidSignatureKey = createTestLicense(licenseData, false); | |
| 106 | + | |
| 107 | + // Test - no mocks, real validation | |
| 108 | + const result = validateLicenseKey(invalidSignatureKey); | |
| 109 | + | |
| 110 | + // Assert | |
| 111 | + expect(result).toBe(false); | |
| 112 | +}); | |
| 113 | + | |
| 114 | +test("validateLicenseKey handles JSON parsing errors gracefully", () => { | |
| 115 | + // Create a base64 string that decodes to valid JSON but lacks required fields | |
| 116 | + const invalidStructureKey = Buffer.from( | |
| 117 | + JSON.stringify({ | |
| 118 | + notTheRightField: "wrong structure", | |
| 119 | + }), | |
| 120 | + ).toString("base64"); | |
| 121 | + | |
| 122 | + // Test - no mocks, real validation | |
| 123 | + const result = validateLicenseKey(invalidStructureKey); | |
| 124 | + | |
| 125 | + // Assert | |
| 126 | + expect(result).toBe(false); | |
| 127 | +}); |
added core/control-plane/mdm.ts +262 −0
| @@ -0,0 +1,262 @@ | ||
| 1 | +import * as crypto from "crypto"; | |
| 2 | +import * as fs from "fs"; | |
| 3 | +import * as os from "os"; | |
| 4 | +import * as path from "path"; | |
| 5 | +import * as plist from "plist"; | |
| 6 | + | |
| 7 | +export interface MdmKeys { | |
| 8 | + licenseKey: string; | |
| 9 | + apiUrl: string; | |
| 10 | +} | |
| 11 | + | |
| 12 | +const CONTINUE_PUBLIC_KEY = `-----BEGIN PUBLIC KEY----- | |
| 13 | +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAz1pFVzsW2UScSnaPAwFp | |
| 14 | +93QU4+txtyJj8AOC3Kx7YkX1d48DGU2Fy1he7SXPHgcuhXYIqfWGn/Vy/4yJxXD7 | |
| 15 | +HlU8RM7LlWHRk7ecAvF4WtxZDjPE0OSG5T69w5f7tMCtQPQseInCKqleJuCjxrvA | |
| 16 | +zyTWTwKA1S6e+KxXS/kbqsumriljFujNr6Gmh8ygDnpF055Xo0vTenkMipVw/oYn | |
| 17 | +U0EHx5ic+Fmcob3EyOj25lu/CVYtU1Rn8jPbrBOMiIq5sePh2QXOwGRsuTiZk2mP | |
| 18 | +LXSsjLbeWHifRrQ18wj/PC990E33QaFGNFp0NcBXMPbq5eKYKEzKZ0GsxtLoGxar | |
| 19 | +FQIDAQAB | |
| 20 | +-----END PUBLIC KEY-----`; | |
| 21 | + | |
| 22 | +export interface LicenseData { | |
| 23 | + customerId: string; | |
| 24 | + createdAt: string; | |
| 25 | + expiresAt: string; | |
| 26 | +} | |
| 27 | + | |
| 28 | +export function validateLicenseKey(licenseKey: string): boolean { | |
| 29 | + try { | |
| 30 | + // Decode the base64 license key | |
| 31 | + const decodedString = Buffer.from(licenseKey, "base64").toString("utf8"); | |
| 32 | + const { data, signature } = JSON.parse(decodedString); | |
| 33 | + | |
| 34 | + // Verify the signature | |
| 35 | + const verify = crypto.createVerify("SHA256"); | |
| 36 | + verify.update(data); | |
| 37 | + verify.end(); | |
| 38 | + | |
| 39 | + const isValid = verify.verify(CONTINUE_PUBLIC_KEY, signature, "base64"); | |
| 40 | + | |
| 41 | + if (!isValid) return false; | |
| 42 | + | |
| 43 | + // Check license expiration | |
| 44 | + const licenseData: LicenseData = JSON.parse(data); | |
| 45 | + const expirationDate = new Date(licenseData.expiresAt); | |
| 46 | + const now = new Date(); | |
| 47 | + | |
| 48 | + return expirationDate > now; | |
| 49 | + } catch (error) { | |
| 50 | + console.error("License validation error:", error); | |
| 51 | + return false; | |
| 52 | + } | |
| 53 | +} | |
| 54 | + | |
| 55 | +function extractConfigFromArray(config: any[]): Record<string, string> { | |
| 56 | + const configObj: Record<string, string> = {}; | |
| 57 | + | |
| 58 | + for (let i = 0; i < config.length; i += 2) { | |
| 59 | + if (i + 1 < config.length) { | |
| 60 | + const key = config[i]; | |
| 61 | + const value = config[i + 1]; | |
| 62 | + if (typeof key === "string") { | |
| 63 | + configObj[key] = value as string; | |
| 64 | + } | |
| 65 | + } | |
| 66 | + } | |
| 67 | + | |
| 68 | + return configObj; | |
| 69 | +} | |
| 70 | + | |
| 71 | +const MACOS_MDM_PATHS = [ | |
| 72 | + // Organization-specific MDM plist | |
| 73 | + "/Library/Managed Preferences/dev.continue.app.plist", | |
| 74 | + // User-specific MDM plist | |
| 75 | + path.join(os.homedir(), "Library/Managed Preferences/dev.continue.app.plist"), | |
| 76 | +]; | |
| 77 | + | |
| 78 | +function readMdmKeysMacOS(): MdmKeys | undefined { | |
| 79 | + try { | |
| 80 | + // MDM configuration is typically stored in /Library/Managed Preferences/ on macOS | |
| 81 | + // The filename is often the bundle identifier of the application | |
| 82 | + | |
| 83 | + // Try to find a valid MDM configuration file | |
| 84 | + for (const mdmPath of MACOS_MDM_PATHS) { | |
| 85 | + if (fs.existsSync(mdmPath)) { | |
| 86 | + // Read the file content | |
| 87 | + const fileContent = fs.readFileSync(mdmPath, "utf8"); | |
| 88 | + | |
| 89 | + try { | |
| 90 | + // Parse the plist file using the plist package | |
| 91 | + const config = plist.parse(fileContent); | |
| 92 | + | |
| 93 | + // Extract the relevant fields from the config | |
| 94 | + // Config is an array of alternating keys and values | |
| 95 | + if (Array.isArray(config)) { | |
| 96 | + const configObj = extractConfigFromArray(config); | |
| 97 | + | |
| 98 | + // Check if required keys are present | |
| 99 | + if (configObj.licenseKey && configObj.apiUrl) { | |
| 100 | + return { | |
| 101 | + licenseKey: configObj.licenseKey, | |
| 102 | + apiUrl: configObj.apiUrl, | |
| 103 | + }; | |
| 104 | + } | |
| 105 | + } | |
| 106 | + } catch (parseError) { | |
| 107 | + console.error(`Error parsing MDM configuration: ${parseError}`); | |
| 108 | + } | |
| 109 | + } | |
| 110 | + } | |
| 111 | + | |
| 112 | + return undefined; | |
| 113 | + } catch (error) { | |
| 114 | + console.error("Error reading macOS MDM keys:", error); | |
| 115 | + return undefined; | |
| 116 | + } | |
| 117 | +} | |
| 118 | + | |
| 119 | +function readMdmKeysWindows(): MdmKeys | undefined { | |
| 120 | + try { | |
| 121 | + // For Windows, we need to read from the registry | |
| 122 | + // Using regedit or another synchronous registry access module | |
| 123 | + const { execSync } = require("child_process"); | |
| 124 | + | |
| 125 | + // Path to the registry where MDM configuration is stored | |
| 126 | + const regPath = "HKLM\\Software\\Continue\\MDM"; | |
| 127 | + const userRegPath = "HKCU\\Software\\Continue\\MDM"; | |
| 128 | + | |
| 129 | + // Try to read from HKEY_LOCAL_MACHINE first | |
| 130 | + try { | |
| 131 | + // Use REG QUERY command to read registry values | |
| 132 | + const licenseKeyCmd = `reg query "${regPath}" /v licenseKey`; | |
| 133 | + const apiUrlCmd = `reg query "${regPath}" /v apiUrl`; | |
| 134 | + | |
| 135 | + const licenseKeyOutput = execSync(licenseKeyCmd, { encoding: "utf8" }); | |
| 136 | + const apiUrlOutput = execSync(apiUrlCmd, { encoding: "utf8" }); | |
| 137 | + | |
| 138 | + // Extract values from command output | |
| 139 | + const licenseKey = extractRegValue(licenseKeyOutput); | |
| 140 | + const apiUrl = extractRegValue(apiUrlOutput); | |
| 141 | + | |
| 142 | + if (licenseKey && apiUrl) { | |
| 143 | + return { licenseKey, apiUrl }; | |
| 144 | + } | |
| 145 | + } catch (error) { | |
| 146 | + // Registry key might not exist, fallback to HKEY_CURRENT_USER | |
| 147 | + } | |
| 148 | + | |
| 149 | + // Try HKEY_CURRENT_USER if not found in HKEY_LOCAL_MACHINE | |
| 150 | + try { | |
| 151 | + const licenseKeyCmd = `reg query "${userRegPath}" /v licenseKey`; | |
| 152 | + const apiUrlCmd = `reg query "${userRegPath}" /v apiUrl`; | |
| 153 | + | |
| 154 | + const licenseKeyOutput = execSync(licenseKeyCmd, { encoding: "utf8" }); | |
| 155 | + const apiUrlOutput = execSync(apiUrlCmd, { encoding: "utf8" }); | |
| 156 | + | |
| 157 | + // Extract values from command output | |
| 158 | + const licenseKey = extractRegValue(licenseKeyOutput); | |
| 159 | + const apiUrl = extractRegValue(apiUrlOutput); | |
| 160 | + | |
| 161 | + if (licenseKey && apiUrl) { | |
| 162 | + return { licenseKey, apiUrl }; | |
| 163 | + } | |
| 164 | + } catch (error) { | |
| 165 | + // Registry key might not exist in HKCU either | |
| 166 | + } | |
| 167 | + | |
| 168 | + return undefined; | |
| 169 | + } catch (error) { | |
| 170 | + console.error("Error reading Windows MDM keys:", error); | |
| 171 | + return undefined; | |
| 172 | + } | |
| 173 | +} | |
| 174 | + | |
| 175 | +// Helper function to extract registry values from reg query output | |
| 176 | +function extractRegValue(output: string): string | undefined { | |
| 177 | + const match = output.match(/REG_SZ\s+(.+)$/m); | |
| 178 | + return match ? match[1].trim() : undefined; | |
| 179 | +} | |
| 180 | + | |
| 181 | +// Common locations for MDM configurations in Linux systems | |
| 182 | +const LINUX_MDM_PATHS = [ | |
| 183 | + // System-wide configuration | |
| 184 | + "/etc/continue/mdm.json", | |
| 185 | + "/var/lib/continue/mdm.json", | |
| 186 | + // User-specific configuration | |
| 187 | + path.join(os.homedir(), ".config/continue/mdm.json"), | |
| 188 | +]; | |
| 189 | + | |
| 190 | +function readMdmKeysLinux(): MdmKeys | undefined { | |
| 191 | + try { | |
| 192 | + // Try to find a valid MDM configuration file | |
| 193 | + for (const mdmPath of LINUX_MDM_PATHS) { | |
| 194 | + if (fs.existsSync(mdmPath)) { | |
| 195 | + // Read the file content | |
| 196 | + const fileContent = fs.readFileSync(mdmPath, "utf8"); | |
| 197 | + | |
| 198 | + try { | |
| 199 | + // Parse the JSON configuration file | |
| 200 | + const config = JSON.parse(fileContent); | |
| 201 | + | |
| 202 | + // Check if required keys are present | |
| 203 | + if (config.licenseKey && config.apiUrl) { | |
| 204 | + return { | |
| 205 | + licenseKey: config.licenseKey, | |
| 206 | + apiUrl: config.apiUrl, | |
| 207 | + }; | |
| 208 | + } | |
| 209 | + } catch (parseError) { | |
| 210 | + console.error(`Error parsing Linux MDM configuration: ${parseError}`); | |
| 211 | + } | |
| 212 | + } | |
| 213 | + } | |
| 214 | + | |
| 215 | + return undefined; | |
| 216 | + } catch (error) { | |
| 217 | + console.error("Error reading Linux MDM keys:", error); | |
| 218 | + return undefined; | |
| 219 | + } | |
| 220 | +} | |
| 221 | + | |
| 222 | +function readMdmKeys(): MdmKeys | undefined { | |
| 223 | + const platform = os.platform(); | |
| 224 | + | |
| 225 | + switch (platform) { | |
| 226 | + case "darwin": | |
| 227 | + return readMdmKeysMacOS(); | |
| 228 | + | |
| 229 | + case "win32": | |
| 230 | + return readMdmKeysWindows(); | |
| 231 | + | |
| 232 | + case "linux": | |
| 233 | + return readMdmKeysLinux(); | |
| 234 | + | |
| 235 | + default: | |
| 236 | + console.error(`MDM keys not supported on platform: ${platform}`); | |
| 237 | + return undefined; | |
| 238 | + } | |
| 239 | +} | |
| 240 | + | |
| 241 | +/** | |
| 242 | + * Read and validate MDM keys from the operating system's configuration files or registry. | |
| 243 | + */ | |
| 244 | +export function getMdmKeys(): MdmKeys | undefined { | |
| 245 | + try { | |
| 246 | + const mdmKeys = readMdmKeys(); | |
| 247 | + | |
| 248 | + if (mdmKeys) { | |
| 249 | + if (!validateLicenseKey(mdmKeys.licenseKey)) { | |
| 250 | + console.error("Invalid license key found: ", mdmKeys.licenseKey); | |
| 251 | + return undefined; | |
| 252 | + } | |
| 253 | + | |
| 254 | + return mdmKeys; | |
| 255 | + } | |
| 256 | + | |
| 257 | + return undefined; | |
| 258 | + } catch (e) { | |
| 259 | + console.warn("Error reading MDM keys: ", e); | |
| 260 | + return undefined; | |
| 261 | + } | |
| 262 | +} |
modified core/package-lock.json +0 −0
Not shown: the file is larger than the hub shows, or this page holds as much as it shows. View the file.
modified core/package.json +2 −0
| @@ -27,6 +27,7 @@ | ||
| 27 | 27 | "@types/mustache": "^4.2.5", |
| 28 | 28 | "@types/node-fetch": "^2.6.11", |
| 29 | 29 | "@types/pg": "^8.11.6", |
| 30 | + "@types/plist": "^3.0.5", | |
| 30 | 31 | "@types/request": "^2.48.12", |
| 31 | 32 | "@types/tar": "^6.1.13", |
| 32 | 33 | "@types/uuid": "^9.0.7", |
| @@ -89,6 +90,7 @@ | ||
| 89 | 90 | "p-limit": "^6.1.0", |
| 90 | 91 | "partial-json": "^0.1.7", |
| 91 | 92 | "pg": "^8.11.3", |
| 93 | + "plist": "^3.1.0", | |
| 92 | 94 | "posthog-node": "^3.6.3", |
| 93 | 95 | "puppeteer": "^22.4.0", |
| 94 | 96 | "puppeteer-chromium-resolver": "^23.0.0", |
modified core/protocol/core.ts +1 −1
| @@ -33,7 +33,7 @@ | ||
| 33 | 33 | ToolCall, |
| 34 | 34 | } from "../"; |
| 35 | 35 | import { SerializedOrgWithProfiles } from "../config/ProfileLifecycleManager"; |
| 36 | -import { ControlPlaneSessionInfo } from "../control-plane/client"; | |
| 36 | +import { ControlPlaneSessionInfo } from "../control-plane/AuthTypes"; | |
| 37 | 37 | |
| 38 | 38 | export type OnboardingModes = "Local" | "Best" | "Custom" | "Quickstart"; |
| 39 | 39 |
modified core/protocol/ide.ts +2 −3
| @@ -1,5 +1,3 @@ | ||
| 1 | -import { ControlPlaneSessionInfo } from "../control-plane/client"; | |
| 2 | - | |
| 3 | 1 | import type { |
| 4 | 2 | ContinueRcJson, |
| 5 | 3 | DiffLine, |
| @@ -16,6 +14,7 @@ | ||
| 16 | 14 | TerminalOptions, |
| 17 | 15 | Thread, |
| 18 | 16 | } from "../"; |
| 17 | +import { ControlPlaneSessionInfo } from "../control-plane/AuthTypes"; | |
| 19 | 18 | |
| 20 | 19 | export interface GetGhTokenArgs { |
| 21 | 20 | force?: boolean; |
| @@ -99,7 +98,7 @@ | ||
| 99 | 98 | ControlPlaneSessionInfo | undefined, |
| 100 | 99 | ]; |
| 101 | 100 | logoutOfControlPlane: [undefined, void]; |
| 102 | - reportError:[any, void]; | |
| 101 | + reportError: [any, void]; | |
| 103 | 102 | closeSidebar: [undefined, void]; |
| 104 | 103 | }; |
| 105 | 104 |
modified core/protocol/webview.ts +1 −1
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | import { ConfigResult } from "@continuedev/config-yaml"; |
| 2 | 2 | import { SerializedOrgWithProfiles } from "../config/ProfileLifecycleManager.js"; |
| 3 | -import { ControlPlaneSessionInfo } from "../control-plane/client.js"; | |
| 3 | +import { ControlPlaneSessionInfo } from "../control-plane/AuthTypes.js"; | |
| 4 | 4 | import type { |
| 5 | 5 | BrowserSerializedContinueConfig, |
| 6 | 6 | ContextItemWithId, |
modified extensions/vscode/package-lock.json +0 −0
Not shown: the file is larger than the hub shows, or this page holds as much as it shows. View the file.
modified extensions/vscode/package.json +1 −1
| @@ -2,7 +2,7 @@ | ||
| 2 | 2 | "name": "continue", |
| 3 | 3 | "icon": "media/icon.png", |
| 4 | 4 | "author": "Continue Dev, Inc", |
| 5 | - "version": "1.1.35", | |
| 5 | + "version": "1.1.37", | |
| 6 | 6 | "repository": { |
| 7 | 7 | "type": "git", |
| 8 | 8 | "url": "https://github.com/continuedev/continue" |
modified extensions/vscode/src/stubs/WorkOsAuthProvider.ts +36 −7
| @@ -1,6 +1,5 @@ | ||
| 1 | 1 | import crypto from "crypto"; |
| 2 | 2 | |
| 3 | -import { ControlPlaneSessionInfo } from "core/control-plane/client"; | |
| 4 | 3 | import { getControlPlaneEnvSync } from "core/control-plane/env"; |
| 5 | 4 | import fetch from "node-fetch"; |
| 6 | 5 | import { v4 as uuidv4 } from "uuid"; |
| @@ -18,6 +17,12 @@ | ||
| 18 | 17 | window, |
| 19 | 18 | } from "vscode"; |
| 20 | 19 | |
| 20 | +import { | |
| 21 | + AuthType, | |
| 22 | + ControlPlaneSessionInfo, | |
| 23 | + HubEnv, | |
| 24 | + isHubEnv, | |
| 25 | +} from "core/control-plane/AuthTypes"; | |
| 21 | 26 | import { PromiseAdapter, promiseFromEvent } from "./promiseUtils"; |
| 22 | 27 | import { SecretStorage } from "./SecretStorage"; |
| 23 | 28 | import { UriEventHandler } from "./uriHandler"; |
| @@ -280,12 +285,21 @@ | ||
| 280 | 285 | try { |
| 281 | 286 | const codeVerifier = generateRandomString(64); |
| 282 | 287 | const codeChallenge = await generateCodeChallenge(codeVerifier); |
| 283 | - const token = await this.login(codeChallenge, scopes); | |
| 288 | + | |
| 289 | + if (!isHubEnv(controlPlaneEnv)) { | |
| 290 | + throw new Error("Login is disabled"); | |
| 291 | + } | |
| 292 | + | |
| 293 | + const token = await this.login(codeChallenge, controlPlaneEnv, scopes); | |
| 284 | 294 | if (!token) { |
| 285 | 295 | throw new Error(`Continue login failure`); |
| 286 | 296 | } |
| 287 | 297 | |
| 288 | - const userInfo = (await this.getUserInfo(token, codeVerifier)) as any; | |
| 298 | + const userInfo = (await this.getUserInfo( | |
| 299 | + token, | |
| 300 | + codeVerifier, | |
| 301 | + controlPlaneEnv, | |
| 302 | + )) as any; | |
| 289 | 303 | const { user, access_token, refresh_token } = userInfo; |
| 290 | 304 | |
| 291 | 305 | const session: ContinueAuthenticationSession = { |
| @@ -352,7 +366,11 @@ | ||
| 352 | 366 | /** |
| 353 | 367 | * Log in to Continue |
| 354 | 368 | */ |
| 355 | - private async login(codeChallenge: string, scopes: string[] = []) { | |
| 369 | + private async login( | |
| 370 | + codeChallenge: string, | |
| 371 | + hubEnv: HubEnv, | |
| 372 | + scopes: string[] = [], | |
| 373 | + ) { | |
| 356 | 374 | return await window.withProgress<string>( |
| 357 | 375 | { |
| 358 | 376 | location: ProgressLocation.Notification, |
| @@ -369,7 +387,7 @@ | ||
| 369 | 387 | const url = new URL("https://api.workos.com/user_management/authorize"); |
| 370 | 388 | const params = { |
| 371 | 389 | response_type: "code", |
| 372 | - client_id: controlPlaneEnv.WORKOS_CLIENT_ID, | |
| 390 | + client_id: hubEnv.WORKOS_CLIENT_ID, | |
| 373 | 391 | redirect_uri: this.redirectUri, |
| 374 | 392 | state: stateId, |
| 375 | 393 | code_challenge: codeChallenge, |
| @@ -458,7 +476,11 @@ | ||
| 458 | 476 | * @param token |
| 459 | 477 | * @returns |
| 460 | 478 | */ |
| 461 | - private async getUserInfo(token: string, codeVerifier: string) { | |
| 479 | + private async getUserInfo( | |
| 480 | + token: string, | |
| 481 | + codeVerifier: string, | |
| 482 | + hubEnv: HubEnv, | |
| 483 | + ) { | |
| 462 | 484 | const resp = await fetch( |
| 463 | 485 | "https://api.workos.com/user_management/authenticate", |
| 464 | 486 | { |
| @@ -467,7 +489,7 @@ | ||
| 467 | 489 | "Content-Type": "application/json", |
| 468 | 490 | }, |
| 469 | 491 | body: JSON.stringify({ |
| 470 | - client_id: controlPlaneEnv.WORKOS_CLIENT_ID, | |
| 492 | + client_id: hubEnv.WORKOS_CLIENT_ID, | |
| 471 | 493 | code_verifier: codeVerifier, |
| 472 | 494 | grant_type: "authorization_code", |
| 473 | 495 | code: token, |
| @@ -484,6 +506,12 @@ | ||
| 484 | 506 | silent: boolean, |
| 485 | 507 | useOnboarding: boolean, |
| 486 | 508 | ): Promise<ControlPlaneSessionInfo | undefined> { |
| 509 | + if (!isHubEnv(controlPlaneEnv)) { | |
| 510 | + return { | |
| 511 | + AUTH_TYPE: AuthType.OnPrem, | |
| 512 | + }; | |
| 513 | + } | |
| 514 | + | |
| 487 | 515 | try { |
| 488 | 516 | if (useOnboarding) { |
| 489 | 517 | WorkOsAuthProvider.useOnboardingUri = true; |
| @@ -498,6 +526,7 @@ | ||
| 498 | 526 | return undefined; |
| 499 | 527 | } |
| 500 | 528 | return { |
| 529 | + AUTH_TYPE: controlPlaneEnv.AUTH_TYPE, | |
| 501 | 530 | accessToken: session.accessToken, |
| 502 | 531 | account: { |
| 503 | 532 | id: session.account.id, |
modified gui/package-lock.json +0 −0
Not shown: the file is larger than the hub shows, or this page holds as much as it shows. View the file.
modified gui/src/context/Auth.tsx +1 −1
| @@ -2,7 +2,7 @@ | ||
| 2 | 2 | OrganizationDescription, |
| 3 | 3 | ProfileDescription, |
| 4 | 4 | } from "core/config/ProfileLifecycleManager"; |
| 5 | -import { ControlPlaneSessionInfo } from "core/control-plane/client"; | |
| 5 | +import { ControlPlaneSessionInfo } from "core/control-plane/AuthTypes"; | |
| 6 | 6 | import React, { |
| 7 | 7 | createContext, |
| 8 | 8 | useCallback, |
modified gui/src/context/MockIdeMessenger.ts +2 −0
| @@ -1,4 +1,5 @@ | ||
| 1 | 1 | import { IDE, PromptLog } from "core"; |
| 2 | +import { AuthType } from "core/control-plane/AuthTypes"; | |
| 2 | 3 | import { |
| 3 | 4 | FromIdeProtocol, |
| 4 | 5 | FromWebviewProtocol, |
| @@ -38,6 +39,7 @@ | ||
| 38 | 39 | ]); |
| 39 | 40 | case "getControlPlaneSessionInfo": |
| 40 | 41 | return returnFor("getControlPlaneSessionInfo", { |
| 42 | + AUTH_TYPE: AuthType.WorkOsStaging, | |
| 41 | 43 | accessToken: "", |
| 42 | 44 | account: { |
| 43 | 45 | label: "", |
modified gui/src/pages/config/AccountButton.tsx +6 −0
| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | import { UserCircleIcon } from "@heroicons/react/24/solid"; |
| 2 | 2 | |
| 3 | +import { isHubSession } from "core/control-plane/AuthTypes"; | |
| 3 | 4 | import { SecondaryButton } from "../../components"; |
| 4 | 5 | import { |
| 5 | 6 | Popover, |
| @@ -27,6 +28,11 @@ | ||
| 27 | 28 | ); |
| 28 | 29 | } |
| 29 | 30 | |
| 31 | + // No login button for on-prem deployments | |
| 32 | + if (!isHubSession(session)) { | |
| 33 | + return null; | |
| 34 | + } | |
| 35 | + | |
| 30 | 36 | return ( |
| 31 | 37 | <Popover className="relative"> |
| 32 | 38 | {({ close }) => ( |