-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsmoke-firewall.ts
More file actions
37 lines (30 loc) 路 1.23 KB
/
Copy pathsmoke-firewall.ts
File metadata and controls
37 lines (30 loc) 路 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { createKeyhole } from './src/index.js';
import { promptSecret } from './src/cli/shared.js';
async function main() {
console.log('Starting Keyhole with autoPatch...');
const kh = await createKeyhole({ config: './keyhole.yaml', autoPatch: true });
console.log('Sidecar ready. State:', kh.state);
if (kh.state === 'pending_unlock') {
const passphrase = await promptSecret('Enter vault passphrase: ');
await kh.unlock(passphrase);
console.log('Vault unlocked. State:', kh.state);
}
// Inject placeholder env vars
const env = kh.getSafeEnv();
Object.assign(process.env, env);
// Verify agent only sees placeholder
console.log('\n--- Credential Firewall Check ---');
console.log('GITHUB_TOKEN env:', process.env.GITHUB_TOKEN);
console.log('Expected: KEYHOLE_MANAGED (or configured placeholder)');
// Make a request through the intercepted fetch
console.log('\n--- Intercepted Fetch ---');
const res = await fetch('https://api.github.com/user');
console.log('Status:', res.status);
console.log('Body:', JSON.stringify(await res.json(), null, 2));
await kh.shutdown();
console.log('\nShutdown complete.');
}
main().catch((err) => {
console.error('SMOKE TEST FAILED:', err);
process.exit(1);
});