mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-01 01:24:30 +01:00
Fix provider compatibility and limit Bedrock to scoped API keys
Preserve older OpenRouter reconnects and Gemini CLI login. Reject raw AWS access keys and remove them from Claude provider allowlists. Clarify missing account recovery and correct Storybook query types. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
4c41e57eda
commit
e1f9f55e7a
21 files changed
+98
-123
No files matched your search
@@ -118,30 +118,26 @@ describe("provider routing", () => {
|
||||
"openrouter/anthropic/claude-sonnet-4.6",
|
||||
);
|
||||
});
|
||||
it("projects AWS credentials and disables ambient instance metadata", () => {
|
||||
it("projects only a Bedrock API key and rejects general AWS access keys", () => {
|
||||
const routing = aiProviderRoutingSchema.parse({
|
||||
kind: "bedrock",
|
||||
protocol: "bedrock",
|
||||
auth: "aws_credentials",
|
||||
auth: "bearer",
|
||||
region: "us-east-1",
|
||||
});
|
||||
const projected = managedProviderRouting(
|
||||
routing,
|
||||
"claude_local",
|
||||
JSON.stringify({
|
||||
accessKeyId: "fixture-id",
|
||||
secretAccessKey: "fixture-secret",
|
||||
sessionToken: "fixture-token",
|
||||
}),
|
||||
"fixture-bedrock-key",
|
||||
"bedrock-model",
|
||||
);
|
||||
expect(projected.env).toMatchObject({
|
||||
CLAUDE_CODE_USE_BEDROCK: "1",
|
||||
AWS_REGION: "us-east-1",
|
||||
AWS_ACCESS_KEY_ID: "fixture-id",
|
||||
AWS_SECRET_ACCESS_KEY: "fixture-secret",
|
||||
AWS_SESSION_TOKEN: "fixture-token",
|
||||
AWS_BEARER_TOKEN_BEDROCK: "fixture-bedrock-key",
|
||||
AWS_EC2_METADATA_DISABLED: "true",
|
||||
});
|
||||
expect(aiProviderRoutingSchema.safeParse({ ...routing, auth: "aws_credentials" }).success).toBe(false);
|
||||
for (const key of ["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY", "AWS_SESSION_TOKEN"]) expect(projected.env).not.toHaveProperty(key);
|
||||
});
|
||||
});
|
||||
@@ -303,7 +303,7 @@ export function aiConnectionRoutes(db: Db, options: Parameters<typeof supportsLo
|
||||
companyId,
|
||||
userId,
|
||||
input,
|
||||
input.awsCredentials ? JSON.stringify(input.awsCredentials) : input.apiKey ?? "",
|
||||
input.apiKey ?? "",
|
||||
undefined,
|
||||
attemptStartedAt,
|
||||
);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
aiAwsCredentialsSchema,
|
||||
aiRoutingBaseUrl,
|
||||
aiRoutingModel,
|
||||
type AiProviderRouting,
|
||||
@@ -22,12 +21,7 @@ export function managedProviderRouting(
|
||||
env.AWS_REGION = route.region!;
|
||||
env.AWS_DEFAULT_REGION = route.region!;
|
||||
env.AWS_EC2_METADATA_DISABLED = "true";
|
||||
if (route.auth === "aws_credentials") {
|
||||
const aws = aiAwsCredentialsSchema.parse(JSON.parse(credential));
|
||||
env.AWS_ACCESS_KEY_ID = aws.accessKeyId;
|
||||
env.AWS_SECRET_ACCESS_KEY = aws.secretAccessKey;
|
||||
env.AWS_SESSION_TOKEN = aws.sessionToken ?? "";
|
||||
} else env.AWS_BEARER_TOKEN_BEDROCK = credential;
|
||||
env.AWS_BEARER_TOKEN_BEDROCK = credential;
|
||||
} else if (harness === "codex_local") {
|
||||
env.PAPERCLIP_AI_PROVIDER_KEY = credential;
|
||||
codexConfig = `model_provider = "paperclip"\n[model_providers.paperclip]\nname = "Paperclip connection"\nbase_url = ${JSON.stringify(baseUrl)}\nwire_api = "responses"\nrequires_openai_auth = false\n${route.auth === "none" ? "" : 'env_key = "PAPERCLIP_AI_PROVIDER_KEY"\n'}`;
|
||||
|
||||
Reference in new issue
Block a user