Merge pull request #4684 from continuedev/nate/org-secret-resolution
use org scope to resolve org secrets
This commit is contained in:
commit
b3c3b197de
7 changed files with 27 additions and 18 deletions
8
core/package-lock.json
generated
8
core/package-lock.json
generated
|
|
@ -13,7 +13,7 @@
|
|||
"@aws-sdk/client-sagemaker-runtime": "^3.758.0",
|
||||
"@aws-sdk/credential-providers": "^3.758.0",
|
||||
"@continuedev/config-types": "^1.0.13",
|
||||
"@continuedev/config-yaml": "^1.0.61",
|
||||
"@continuedev/config-yaml": "^1.0.63",
|
||||
"@continuedev/fetch": "^1.0.4",
|
||||
"@continuedev/llm-info": "^1.0.2",
|
||||
"@continuedev/openai-adapters": "^1.0.10",
|
||||
|
|
@ -2972,9 +2972,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@continuedev/config-yaml": {
|
||||
"version": "1.0.61",
|
||||
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.61.tgz",
|
||||
"integrity": "sha512-RJvZxPG9eicy1J0dXAKNH3UsGJdHVZgm8808QStQWW5p/eZEt3ZHeE8KHJ/IE6UylMyBlMYMNBYjC7VdLC4+qA==",
|
||||
"version": "1.0.63",
|
||||
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.63.tgz",
|
||||
"integrity": "sha512-KBfyOUU/mWOXeNf6v+4IfMkbvfEEe/YP6n/g/reJBhrpApchG2A/P11JviH87N2To1SrhZxnW//0g5FIGupDFw==",
|
||||
"dependencies": {
|
||||
"@continuedev/config-types": "^1.0.14",
|
||||
"yaml": "^2.6.1",
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
"@aws-sdk/client-sagemaker-runtime": "^3.758.0",
|
||||
"@aws-sdk/credential-providers": "^3.758.0",
|
||||
"@continuedev/config-types": "^1.0.13",
|
||||
"@continuedev/config-yaml": "^1.0.61",
|
||||
"@continuedev/config-yaml": "^1.0.63",
|
||||
"@continuedev/fetch": "^1.0.4",
|
||||
"@continuedev/llm-info": "^1.0.2",
|
||||
"@continuedev/openai-adapters": "^1.0.10",
|
||||
|
|
|
|||
10
gui/package-lock.json
generated
10
gui/package-lock.json
generated
|
|
@ -7,7 +7,7 @@
|
|||
"name": "gui",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@continuedev/config-yaml": "^1.0.61",
|
||||
"@continuedev/config-yaml": "^1.0.63",
|
||||
"@headlessui/react": "^1.7.17",
|
||||
"@heroicons/react": "^2.0.18",
|
||||
"@reduxjs/toolkit": "^2.3.0",
|
||||
|
|
@ -107,7 +107,7 @@
|
|||
"@aws-sdk/client-sagemaker-runtime": "^3.758.0",
|
||||
"@aws-sdk/credential-providers": "^3.758.0",
|
||||
"@continuedev/config-types": "^1.0.13",
|
||||
"@continuedev/config-yaml": "^1.0.61",
|
||||
"@continuedev/config-yaml": "^1.0.63",
|
||||
"@continuedev/fetch": "^1.0.4",
|
||||
"@continuedev/llm-info": "^1.0.2",
|
||||
"@continuedev/openai-adapters": "^1.0.10",
|
||||
|
|
@ -549,9 +549,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@continuedev/config-yaml": {
|
||||
"version": "1.0.61",
|
||||
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.61.tgz",
|
||||
"integrity": "sha512-RJvZxPG9eicy1J0dXAKNH3UsGJdHVZgm8808QStQWW5p/eZEt3ZHeE8KHJ/IE6UylMyBlMYMNBYjC7VdLC4+qA==",
|
||||
"version": "1.0.63",
|
||||
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.63.tgz",
|
||||
"integrity": "sha512-KBfyOUU/mWOXeNf6v+4IfMkbvfEEe/YP6n/g/reJBhrpApchG2A/P11JviH87N2To1SrhZxnW//0g5FIGupDFw==",
|
||||
"dependencies": {
|
||||
"@continuedev/config-types": "^1.0.14",
|
||||
"yaml": "^2.6.1",
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
"test:watch": "vitest"
|
||||
},
|
||||
"dependencies": {
|
||||
"@continuedev/config-yaml": "^1.0.61",
|
||||
"@continuedev/config-yaml": "^1.0.63",
|
||||
"@headlessui/react": "^1.7.17",
|
||||
"@heroicons/react": "^2.0.18",
|
||||
"@reduxjs/toolkit": "^2.3.0",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@continuedev/config-yaml",
|
||||
"version": "1.0.61",
|
||||
"version": "1.0.63",
|
||||
"description": "",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ export function getLocationsToLook(
|
|||
blockSlug: PackageSlug | undefined,
|
||||
currentUserSlug: string,
|
||||
secretName: string,
|
||||
orgScopeSlug: string | null,
|
||||
): SecretLocation[] {
|
||||
const locationsToLook: SecretLocation[] = [
|
||||
...(blockSlug
|
||||
|
|
@ -57,11 +58,15 @@ export function getLocationsToLook(
|
|||
secretName,
|
||||
},
|
||||
// Organization that owns assistant (org secrets can only be used in assistants owned by that org)
|
||||
{
|
||||
secretType: SecretType.Organization as const,
|
||||
orgSlug: assistantSlug.ownerSlug,
|
||||
secretName,
|
||||
},
|
||||
...(orgScopeSlug
|
||||
? [
|
||||
{
|
||||
secretType: SecretType.Organization as const,
|
||||
orgSlug: orgScopeSlug,
|
||||
secretName,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
// User
|
||||
{
|
||||
secretType: SecretType.User as const,
|
||||
|
|
@ -90,6 +95,7 @@ export function listAvailableSecrets(
|
|||
assistantSlug: PackageSlug,
|
||||
blockSlug: PackageSlug | undefined,
|
||||
currentUserSlug: string,
|
||||
orgScopeSlug: string | null,
|
||||
): SecretLocation[] {
|
||||
// Create a set of all secret names
|
||||
const allSecretNames = new Set([
|
||||
|
|
@ -108,6 +114,7 @@ export function listAvailableSecrets(
|
|||
blockSlug,
|
||||
currentUserSlug,
|
||||
secretName,
|
||||
orgScopeSlug,
|
||||
);
|
||||
|
||||
// Go through the locations one by one
|
||||
|
|
@ -155,6 +162,7 @@ export async function resolveFQSN(
|
|||
currentUserSlug: string,
|
||||
fqsn: FQSN,
|
||||
platformSecretStore: PlatformSecretStore,
|
||||
orgScopeSlug: string | null,
|
||||
): Promise<SecretResult> {
|
||||
// First create the list of secret locations to try in order
|
||||
const assistantSlug = fqsn.packageSlugs[0];
|
||||
|
|
@ -164,6 +172,7 @@ export async function resolveFQSN(
|
|||
blockSlug,
|
||||
currentUserSlug,
|
||||
fqsn.secretName,
|
||||
orgScopeSlug,
|
||||
);
|
||||
|
||||
// Then try to get the secret from each location
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ describe("E2E Scenarios", () => {
|
|||
): Promise<(SecretResult | undefined)[]> {
|
||||
return await Promise.all(
|
||||
fqsns.map((fqsn) =>
|
||||
resolveFQSN("test-user", fqsn, platformSecretStore),
|
||||
resolveFQSN("test-user", fqsn, platformSecretStore, "test-org"),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue