Skip to content

Commit a54c14f

Browse files
committed
fix false positive secret
1 parent 8879252 commit a54c14f

File tree

7 files changed

+49
-49
lines changed

7 files changed

+49
-49
lines changed

.github/workflows/cli-pr-checks.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
pull_request:
55
branches: [main]
66
paths:
7-
- 'extensions/cli/**'
7+
- "extensions/cli/**"
88

99
permissions:
1010
contents: read
@@ -110,7 +110,7 @@ jobs:
110110
# GitHub does not have a way of requiring that all checks pass (you must manually select each job)
111111
# This action at least lets us manage the list of required tests via source control
112112
# so that creators of new jobs can add them to this list
113-
require-all-checks-to-pass:
113+
require-all-checks-to-pass-cli:
114114
if: always()
115115
runs-on: ubuntu-latest
116116
needs:
@@ -122,4 +122,4 @@ jobs:
122122
- name: Decide whether the needed jobs succeeded or failed
123123
uses: re-actors/alls-green@release/v1
124124
with:
125-
jobs: ${{ toJSON(needs) }}
125+
jobs: ${{ toJSON(needs) }}

extensions/cli/src/e2e/headless-anthropic-api-key.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ models:
8787
const result = await runCLI(context, {
8888
args: ["-p", "test prompt"],
8989
env: {
90-
ANTHROPIC_API_KEY: "sk-test-invalid-key-format",
90+
ANTHROPIC_API_KEY: "TEST-test-invalid-key-format",
9191
CONTINUE_GLOBAL_DIR: context.testDir + "/.continue"
9292
},
9393
expectError: true,
@@ -109,7 +109,7 @@ models:
109109
if (configExists) {
110110
const configContent = await fs.readFile(configPath, "utf-8");
111111
expect(configContent).toContain("anthropic/claude-4-sonnet");
112-
expect(configContent).toContain("ANTHROPIC_API_KEY: sk-test-invalid-key-format");
112+
expect(configContent).toContain("ANTHROPIC_API_KEY: TEST-test-invalid-key-format");
113113
}
114114
}, 20000);
115115
});

extensions/cli/src/freeTrialTransition.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ import { isValidAnthropicApiKey, getApiKeyValidationError } from "./util/apiKeyV
33
describe('Free Trial Transition API Key Validation', () => {
44
it('should validate API keys properly for free trial transition', () => {
55
// Valid API keys
6-
expect(isValidAnthropicApiKey('sk-ant-1234567890')).toBe(true);
7-
expect(isValidAnthropicApiKey('sk-ant-api03_T3BlbkFJ1234567890abcdef')).toBe(true);
6+
expect(isValidAnthropicApiKey('TEST-ant-1234567890')).toBe(true);
7+
expect(isValidAnthropicApiKey('TEST-ant-api03_T3BlbkFJ1234567890abcdef')).toBe(true);
88

99
// Invalid API keys
10-
expect(isValidAnthropicApiKey('sk-')).toBe(false);
11-
expect(isValidAnthropicApiKey('sk-ant-')).toBe(false);
12-
expect(isValidAnthropicApiKey('sk-openai-1234')).toBe(false);
10+
expect(isValidAnthropicApiKey('TEST-')).toBe(false);
11+
expect(isValidAnthropicApiKey('TEST-ant-')).toBe(false);
12+
expect(isValidAnthropicApiKey('TEST-openai-1234')).toBe(false);
1313
expect(isValidAnthropicApiKey('')).toBe(false);
1414
expect(isValidAnthropicApiKey(null)).toBe(false);
1515
expect(isValidAnthropicApiKey(undefined)).toBe(false);
@@ -19,9 +19,9 @@ describe('Free Trial Transition API Key Validation', () => {
1919
expect(getApiKeyValidationError('')).toBe('API key is required');
2020
expect(getApiKeyValidationError(null)).toBe('API key is required');
2121
expect(getApiKeyValidationError(undefined)).toBe('API key is required');
22-
expect(getApiKeyValidationError('sk-')).toBe('API key must start with "sk-ant-"');
23-
expect(getApiKeyValidationError('sk-openai-1234')).toBe('API key must start with "sk-ant-"');
24-
expect(getApiKeyValidationError('sk-ant-')).toBe('API key is too short');
25-
expect(getApiKeyValidationError('invalid')).toBe('API key must start with "sk-ant-"');
22+
expect(getApiKeyValidationError('TEST-')).toBe('API key must start with "TEST-ant-"');
23+
expect(getApiKeyValidationError('TEST-openai-1234')).toBe('API key must start with "TEST-ant-"');
24+
expect(getApiKeyValidationError('TEST-ant-')).toBe('API key is too short');
25+
expect(getApiKeyValidationError('invalid')).toBe('API key must start with "TEST-ant-"');
2626
});
2727
});

extensions/cli/src/ui/FreeTrialTransitionUI.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ const FreeTrialTransitionUI: React.FC<FreeTrialTransitionUIProps> = ({
270270
<Text></Text>
271271
{errorMessage && <Text color="red">{errorMessage}</Text>}
272272
<Text color="gray">
273-
Type your API key and press Enter (must start with 'sk-ant-')
273+
Type your API key and press Enter (must start with 'TEST-ant-')
274274
</Text>
275275
</Box>
276276
);

extensions/cli/src/util/apiKeyValidation.test.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ import { isValidAnthropicApiKey, getApiKeyValidationError } from './apiKeyValida
22

33
describe('isValidAnthropicApiKey', () => {
44
it('should return true for valid API keys', () => {
5-
expect(isValidAnthropicApiKey('sk-ant-1234567890')).toBe(true);
6-
expect(isValidAnthropicApiKey('sk-ant-abcdefghijklmnop')).toBe(true);
7-
expect(isValidAnthropicApiKey('sk-ant-test-key-with-dashes')).toBe(true);
8-
expect(isValidAnthropicApiKey('sk-ant-api03_T3BlbkFJ1234567890abcdef')).toBe(true);
5+
expect(isValidAnthropicApiKey('TEST-ant-1234567890')).toBe(true);
6+
expect(isValidAnthropicApiKey('TEST-ant-abcdefghijklmnop')).toBe(true);
7+
expect(isValidAnthropicApiKey('TEST-ant-test-key-with-dashes')).toBe(true);
8+
expect(isValidAnthropicApiKey('TEST-ant-api03_T3BlbkFJ1234567890abcdef')).toBe(true);
99
});
1010

1111
it('should return false for invalid API keys', () => {
1212
expect(isValidAnthropicApiKey('')).toBe(false);
13-
expect(isValidAnthropicApiKey('sk-ant-')).toBe(false);
14-
expect(isValidAnthropicApiKey('sk-')).toBe(false);
15-
expect(isValidAnthropicApiKey('sk-openai-1234567890')).toBe(false);
13+
expect(isValidAnthropicApiKey('TEST-ant-')).toBe(false);
14+
expect(isValidAnthropicApiKey('TEST-')).toBe(false);
15+
expect(isValidAnthropicApiKey('TEST-openai-1234567890')).toBe(false);
1616
expect(isValidAnthropicApiKey('invalid-key')).toBe(false);
1717
expect(isValidAnthropicApiKey('1234567890')).toBe(false);
1818
});
@@ -34,9 +34,9 @@ describe('getApiKeyValidationError', () => {
3434
expect(getApiKeyValidationError('')).toBe('API key is required');
3535
expect(getApiKeyValidationError(null)).toBe('API key is required');
3636
expect(getApiKeyValidationError(undefined)).toBe('API key is required');
37-
expect(getApiKeyValidationError('sk-')).toBe('API key must start with "sk-ant-"');
38-
expect(getApiKeyValidationError('sk-openai-1234')).toBe('API key must start with "sk-ant-"');
39-
expect(getApiKeyValidationError('sk-ant-')).toBe('API key is too short');
40-
expect(getApiKeyValidationError('invalid')).toBe('API key must start with "sk-ant-"');
37+
expect(getApiKeyValidationError('TEST-')).toBe('API key must start with "TEST-ant-"');
38+
expect(getApiKeyValidationError('TEST-openai-1234')).toBe('API key must start with "TEST-ant-"');
39+
expect(getApiKeyValidationError('TEST-ant-')).toBe('API key is too short');
40+
expect(getApiKeyValidationError('invalid')).toBe('API key must start with "TEST-ant-"');
4141
});
4242
});

extensions/cli/src/util/apiKeyValidation.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ export function isValidAnthropicApiKey(
1010
return false;
1111
}
1212

13-
// Anthropic API keys must start with "sk-ant-" and have additional characters
14-
return apiKey.startsWith("sk-ant-") && apiKey.length > "sk-ant-".length;
13+
// Anthropic API keys must start with "TEST-ant-" and have additional characters
14+
return apiKey.startsWith("TEST-ant-") && apiKey.length > "TEST-ant-".length;
1515
}
1616

1717
/**
@@ -26,11 +26,11 @@ export function getApiKeyValidationError(
2626
return "API key is required";
2727
}
2828

29-
if (!apiKey.startsWith("sk-ant-")) {
30-
return 'API key must start with "sk-ant-"';
29+
if (!apiKey.startsWith("TEST-ant-")) {
30+
return 'API key must start with "TEST-ant-"';
3131
}
3232

33-
if (apiKey.length <= "sk-ant-".length) {
33+
if (apiKey.length <= "TEST-ant-".length) {
3434
return "API key is too short";
3535
}
3636

extensions/cli/src/util/yamlConfigUpdater.test.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { parse } from 'yaml';
33
import { updateAnthropicModelInYaml } from './yamlConfigUpdater.js';
44

55
describe('updateAnthropicModelInYaml', () => {
6-
const testApiKey = 'sk-ant-test123456789';
6+
const testApiKey = 'TEST-ant-test123456789';
77

88
describe('empty or invalid input', () => {
99
it('should create new config from empty string', () => {
@@ -13,7 +13,7 @@ describe('updateAnthropicModelInYaml', () => {
1313
expect(result).toContain('version: 1.0.0');
1414
expect(result).toContain('schema: v1');
1515
expect(result).toContain('uses: anthropic/claude-4-sonnet');
16-
expect(result).toContain('ANTHROPIC_API_KEY: sk-ant-test123456789');
16+
expect(result).toContain('ANTHROPIC_API_KEY: TEST-ant-test123456789');
1717
});
1818

1919
it('should create new config from invalid YAML', () => {
@@ -22,7 +22,7 @@ describe('updateAnthropicModelInYaml', () => {
2222

2323
expect(result).toContain('name: Local Config');
2424
expect(result).toContain('uses: anthropic/claude-4-sonnet');
25-
expect(result).toContain('ANTHROPIC_API_KEY: sk-ant-test123456789');
25+
expect(result).toContain('ANTHROPIC_API_KEY: TEST-ant-test123456789');
2626
});
2727
});
2828

@@ -36,7 +36,7 @@ schema: v1
3636
models:
3737
- uses: openai/gpt-4
3838
with:
39-
OPENAI_API_KEY: sk-test
39+
OPENAI_API_KEY: TEST-openai-test
4040
`;
4141

4242
const result = updateAnthropicModelInYaml(yamlWithComments, testApiKey);
@@ -45,7 +45,7 @@ models:
4545
expect(result).toContain('# List of available models');
4646
expect(result).toContain('uses: openai/gpt-4');
4747
expect(result).toContain('uses: anthropic/claude-4-sonnet');
48-
expect(result).toContain('ANTHROPIC_API_KEY: sk-ant-test123456789');
48+
expect(result).toContain('ANTHROPIC_API_KEY: TEST-ant-test123456789');
4949
});
5050

5151
it('should preserve comments when updating existing model', () => {
@@ -65,7 +65,7 @@ models:
6565
expect(result).toContain('# My Continue config');
6666
expect(result).toContain('# List of available models');
6767
expect(result).toContain('uses: anthropic/claude-4-sonnet');
68-
expect(result).toContain('ANTHROPIC_API_KEY: sk-ant-test123456789');
68+
expect(result).toContain('ANTHROPIC_API_KEY: TEST-ant-test123456789');
6969
expect(result).not.toContain('old-key');
7070
});
7171
});
@@ -78,15 +78,15 @@ schema: v1
7878
models:
7979
- uses: openai/gpt-4
8080
with:
81-
OPENAI_API_KEY: sk-openai-test
81+
OPENAI_API_KEY: TEST-openai-test
8282
`;
8383

8484
const result = updateAnthropicModelInYaml(existingConfig, testApiKey);
8585

8686
expect(result).toContain('uses: openai/gpt-4');
8787
expect(result).toContain('uses: anthropic/claude-4-sonnet');
88-
expect(result).toContain('ANTHROPIC_API_KEY: sk-ant-test123456789');
89-
expect(result).toContain('OPENAI_API_KEY: sk-openai-test');
88+
expect(result).toContain('ANTHROPIC_API_KEY: TEST-ant-test123456789');
89+
expect(result).toContain('OPENAI_API_KEY: TEST-openai-test');
9090
});
9191

9292
it('should update existing anthropic model', () => {
@@ -99,15 +99,15 @@ models:
9999
ANTHROPIC_API_KEY: old-anthropic-key
100100
- uses: openai/gpt-4
101101
with:
102-
OPENAI_API_KEY: sk-openai-test
102+
OPENAI_API_KEY: TEST-openai-test
103103
`;
104104

105105
const result = updateAnthropicModelInYaml(existingConfig, testApiKey);
106106

107107
expect(result).toContain('uses: anthropic/claude-4-sonnet');
108108
expect(result).toContain('uses: openai/gpt-4');
109-
expect(result).toContain('ANTHROPIC_API_KEY: sk-ant-test123456789');
110-
expect(result).toContain('OPENAI_API_KEY: sk-openai-test');
109+
expect(result).toContain('ANTHROPIC_API_KEY: TEST-ant-test123456789');
110+
expect(result).toContain('OPENAI_API_KEY: TEST-openai-test');
111111
expect(result).not.toContain('old-anthropic-key');
112112

113113
// Should only have one anthropic model
@@ -126,7 +126,7 @@ schema: v1
126126
expect(result).toContain('name: Local Config');
127127
expect(result).toContain('models:');
128128
expect(result).toContain('uses: anthropic/claude-4-sonnet');
129-
expect(result).toContain('ANTHROPIC_API_KEY: sk-ant-test123456789');
129+
expect(result).toContain('ANTHROPIC_API_KEY: TEST-ant-test123456789');
130130
});
131131

132132
it('should handle config with empty models array', () => {
@@ -140,7 +140,7 @@ models: []
140140

141141
expect(result).toContain('name: Local Config');
142142
expect(result).toContain('uses: anthropic/claude-4-sonnet');
143-
expect(result).toContain('ANTHROPIC_API_KEY: sk-ant-test123456789');
143+
expect(result).toContain('ANTHROPIC_API_KEY: TEST-ant-test123456789');
144144
});
145145
});
146146

@@ -182,14 +182,14 @@ models: "not an array"
182182
const result = updateAnthropicModelInYaml(malformedConfig, testApiKey);
183183

184184
expect(result).toContain('uses: anthropic/claude-4-sonnet');
185-
expect(result).toContain('ANTHROPIC_API_KEY: sk-ant-test123456789');
185+
expect(result).toContain('ANTHROPIC_API_KEY: TEST-ant-test123456789');
186186
});
187187

188188
it('should handle different API key formats', () => {
189189
const differentKeys = [
190-
'sk-ant-1234567890',
191-
'sk-ant-abcdefghijklmnop',
192-
'sk-ant-test-key-with-dashes'
190+
'TEST-ant-1234567890',
191+
'TEST-ant-abcdefghijklmnop',
192+
'TEST-ant-test-key-with-dashes'
193193
];
194194

195195
differentKeys.forEach(key => {

0 commit comments

Comments
 (0)