fix: keep Alta bearer out of proxy command lines
This commit is contained in:
@@ -79,11 +79,14 @@ test('runtime keeps Alta credentials in main-owned modules and exposes only non-
|
||||
});
|
||||
|
||||
assert.deepEqual(await runtime.getDevices(), { success: true, devices: [{ guid: '550e8400-e29b-41d4-a716-446655440000' }] });
|
||||
const launched = await runtime.launchProxy('550e8400-e29b-41d4-a716-446655440000');
|
||||
const launched = await runtime.launchProxy(
|
||||
'550e8400-e29b-41d4-a716-446655440000',
|
||||
'proxy.operator@example.com'
|
||||
);
|
||||
assert.equal(launched.success, true);
|
||||
assert.deepEqual(calls[0], {
|
||||
deploymentHost: 'customer.avasecurity.com',
|
||||
cookie: 'top-secret-cookie',
|
||||
username: 'proxy.operator@example.com',
|
||||
deviceId: '550e8400-e29b-41d4-a716-446655440000',
|
||||
});
|
||||
assert.deepEqual(runtime.getConnectionState(), {
|
||||
@@ -99,6 +102,29 @@ test('runtime keeps Alta credentials in main-owned modules and exposes only non-
|
||||
assert.equal((await runtime.stopProxy(999)).success, false);
|
||||
});
|
||||
|
||||
test('runtime rejects invalid usernames before calling the proxy manager', async () => {
|
||||
const sessionStore = createSessionStore();
|
||||
sessionStore.establish('https://customer.avasecurity.com', 'top-secret-cookie');
|
||||
const deviceId = '550e8400-e29b-41d4-a716-446655440000';
|
||||
let launches = 0;
|
||||
const runtime = new AppRuntime({
|
||||
sessionStore,
|
||||
altaClient: { getDevices: async () => [{ guid: deviceId }] },
|
||||
proxyManager: {
|
||||
launchProxy() { launches += 1; },
|
||||
listTrackedProxies() { return []; },
|
||||
},
|
||||
});
|
||||
await runtime.getDevices();
|
||||
|
||||
for (const username of ['', 'x'.repeat(255), 'operator@example.com\r\n-k secret', null]) {
|
||||
const result = await runtime.launchProxy(deviceId, username);
|
||||
assert.equal(result.success, false);
|
||||
assert.match(result.message, /username/i);
|
||||
}
|
||||
assert.equal(launches, 0);
|
||||
});
|
||||
|
||||
test('bridge authenticates itself before accepting a one-time HMAC cookie request', async () => {
|
||||
const protect = (value) => Buffer.from(`protected:${value}`);
|
||||
const unprotect = (value) => Buffer.from(value).toString().slice('protected:'.length);
|
||||
@@ -223,10 +249,10 @@ test('runtime reconciles exited children and permits relaunch for the same devic
|
||||
},
|
||||
});
|
||||
await runtime.getDevices();
|
||||
assert.equal((await runtime.launchProxy(deviceId)).processId, 4101);
|
||||
assert.equal((await runtime.launchProxy(deviceId, 'operator@example.com')).processId, 4101);
|
||||
tracked.length = 0;
|
||||
assert.deepEqual(runtime.getConnectionState().activeProxies, []);
|
||||
assert.equal((await runtime.launchProxy(deviceId)).processId, 4102);
|
||||
assert.equal((await runtime.launchProxy(deviceId, 'operator@example.com')).processId, 4102);
|
||||
});
|
||||
|
||||
test('disconnect stops every owned proxy before clearing the Alta session', async () => {
|
||||
@@ -304,8 +330,12 @@ test('preload and renderer expose only narrow, credential-free contracts', () =>
|
||||
];
|
||||
for (const method of expectedMethods) assert.match(preload, new RegExp(`\\b${method}\\b`));
|
||||
assert.doesNotMatch(preload, /downloadAndInstall|download-and-install|onUpdateDownloadProgress|onExtensionCookie/);
|
||||
assert.match(preload, /launchProxy:\s*\(deviceId, username\)/);
|
||||
assert.doesNotMatch(preload, /launchProxy:\s*\([^)]*(?:cookie|origin)/i);
|
||||
assert.doesNotMatch(renderer, /cookieValue|sessionData\.cookies|cookies\s*:/);
|
||||
assert.match(renderer, /state\.connected\s*&&\s*\(!wasConnected\s*\|\|\s*state\.origin\s*!==\s*previousOrigin\)/);
|
||||
assert.doesNotMatch(html, /id="cookieKey"|updateProgress|Install Update/);
|
||||
assert.match(html, /id="altaUsername"/);
|
||||
assert.match(renderer, /openFixedReleasesPage/);
|
||||
assert.match(html, /Bridge Pairing/);
|
||||
});
|
||||
@@ -327,3 +357,15 @@ test('source policy removes legacy credential IPC, shell launch, broad kill, and
|
||||
assert.match(read('main.js'), /18247/);
|
||||
assert.match(read('main.js'), /shell\.openExternal/);
|
||||
});
|
||||
|
||||
test('production source and documentation are GitPeji-only with no active GitHub workflow', () => {
|
||||
assert.equal(fs.existsSync(path.join(ROOT, '.github', 'workflows', 'deploy-pages.yml')), false);
|
||||
const sourceAndDocs = [
|
||||
'main.js', 'preload.js', 'renderer.js', 'renderer-controller.js', 'index.html',
|
||||
'src/electron-runtime.js', 'src/proxy-launch.js', 'README.md', 'CLAUDE.md',
|
||||
'docs/security/2026-08-security-baseline.md',
|
||||
'docs/plans/2026-08-19-apt-security-foundation.md',
|
||||
].map(read).join('\n');
|
||||
assert.doesNotMatch(sourceAndDocs, /github/i);
|
||||
assert.match(sourceAndDocs, /GitPeji/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user