security(alerts,ai): fix secret exfiltration, ReDoS/redactor bypasses, probe double-counting & add Security Event Alerting

This commit is contained in:
tyuXX 2026-11-28 05:09:46 +00:00
parent 2b878c1d99
commit 67137056f8
11 changed files with 613 additions and 173 deletions

View file

@ -287,6 +287,19 @@ describe('Phase 5: Optional BYO-API AI Assistant, Secret Redactor, Surface Guide
// Write-lock Vault -> AI runtime secret still works via VaultService.getRuntimeSecret
expect((await api('/api/vault/lock', { method: 'POST' })).data.state).toBe('locked');
// Default Zero-Trust egress policy blocks outbound calls to loopback until allowlisted
const blockedEp = await api('/api/ai/test', { method: 'POST', body: {} });
expect(blockedEp.data.ok).toBe(false);
expect(
(
await api('/api/auth/security-policy', {
method: 'PUT',
body: { egressAllowedCidrs: ['127.0.0.1/32'] },
})
).status,
).toBe(200);
const testEp = await api('/api/ai/test', { method: 'POST', body: {} });
expect(testEp.status).toBe(200);
expect(testEp.data.ok).toBe(true);

View file

@ -415,6 +415,19 @@ describe('Phase 4: AlertEngine, Webhooks, Silences & Maintenance Windows', () =>
expect(lockRes.data.state).toBe('locked');
expect(lockRes.data.runtimeReady).toBe(true);
// Default Zero-Trust egress policy blocks webhook dispatch to 127.0.0.1 until allowlisted
const deniedWebhook = await api('/api/alerts/channels/ch-discord/test', { method: 'POST' });
expect(deniedWebhook.data.ok).toBe(false);
expect(
(
await api('/api/auth/security-policy', {
method: 'PUT',
body: { egressAllowedCidrs: ['127.0.0.1/32'] },
})
).status,
).toBe(200);
// --- 1. Send Test Alert for all 4 channel types while Vault is write-locked ---
for (const chId of ['ch-discord', 'ch-tg', 'ch-ntfy', 'ch-generic']) {
const tRes = await api(`/api/alerts/channels/${chId}/test`, { method: 'POST' });

View file

@ -607,7 +607,7 @@ describe('Phase 4: Workflows, Snippets, Fleet Broadcast & Cross-Server Transfers
expect(dagStart.status).toBe(202);
const dagRunId = String(dagStart.data.runId);
const dagDetail = await waitForWorkflowRun(server, dagRunId, 10_000);
expect(dagDetail.run.status).toBe('succeeded');
expect(dagDetail.run.status, JSON.stringify(dagDetail.stepLogs)).toBe('succeeded');
const logByStep = new Map(dagDetail.stepLogs.map((l) => [l.stepId, l]));
expect(logByStep.get('gen-token')?.stdout).toBe('tok-v42');