Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

feat(siem): allow a test event against a disabled destination (#4150)

Gergő Móricz9fdf28bb5142
diff --git a/apps/api/src/__tests__/snips/v2/team-siem-logging.test.ts b/apps/api/src/__tests__/snips/v2/team-siem-logging.test.ts
index 6376ae37f..b629a50e8 100644
--- a/apps/api/src/__tests__/snips/v2/team-siem-logging.test.ts
+++ b/apps/api/src/__tests__/snips/v2/team-siem-logging.test.ts
@@ -21,6 +21,12 @@ async function putConfig(identity: Identity, body: unknown) {
.send(body as object);
}
+async function testConfig(identity: Identity) {
+ return request(TEST_API_URL)
+ .post("/v2/team/siem/test")
+ .set("Authorization", `Bearer ${identity.apiKey}`);
+}
+
describeIf(TEST_PRODUCTION)("Team SIEM logging config API", () => {
it("rejects a team without the enterprise flag", async () => {
const identity = await idmux({ name: "team-siem-logging/no-flag" });
@@ -85,6 +91,17 @@ describeIf(TEST_PRODUCTION)("Team SIEM logging config API", () => {
);
});
+ it("refuses a test event before a destination is saved", async () => {
+ const unconfigured = await idmux({
+ name: "team-siem-logging/untested",
+ flags: { siemLogging: true },
+ });
+ const response = await testConfig(unconfigured);
+
+ expect(response.statusCode).toBe(409);
+ expect(response.body.error).toContain("not configured");
+ });
+
it("rejects non-Azure ingestion endpoints", async () => {
const response = await putConfig(identity, {
enabled: true,
diff --git a/apps/api/src/controllers/v2/team-siem-logging.ts b/apps/api/src/controllers/v2/team-siem-logging.ts
index f31a11635..e32ac1ce6 100644
--- a/apps/api/src/controllers/v2/team-siem-logging.ts
+++ b/apps/api/src/controllers/v2/team-siem-logging.ts
@@ -115,10 +115,14 @@ export async function testTeamSiemLoggingController(
const orgId = await resolveOrgId(req, res);
if (!orgId) return;
const siemConfig = await getOrgSiemLoggingConfig(orgId);
- if (!siemConfig?.enabled) {
+ // Deliberately does not require `enabled`: verifying a destination before
+ // turning it on is the point of this endpoint, and the dashboard gates the
+ // enable toggle on a passing test.
+ if (!siemConfig) {
res.status(409).json({
success: false,
- error: "SIEM Logging is not configured and enabled.",
+ error:
+ "SIEM Logging is not configured. Save a destination before sending a test event.",
});
return;
}