Skip to content

Commit 094577a

Browse files
committed
Rename, fix tests
1 parent b79cc2c commit 094577a

11 files changed

+21
-13
lines changed

library/agent/Attack.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export type Kind =
55
| "path_traversal"
66
| "ssrf"
77
| "code_injection"
8-
| "blocked_outgoing_request";
8+
| "blocked_outbound_connection";
99

1010
export function attackKindHumanName(kind: Kind) {
1111
switch (kind) {
@@ -21,7 +21,7 @@ export function attackKindHumanName(kind: Kind) {
2121
return "a server-side request forgery";
2222
case "code_injection":
2323
return "a JavaScript injection";
24-
case "blocked_outgoing_request":
25-
return "an outgoing request";
24+
case "blocked_outbound_connection":
25+
return "an outbound connection";
2626
}
2727
}

library/agent/api/ReportingAPIRateLimitedClientSide.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ t.test("it does not blow memory", async () => {
234234
heartbeatIntervalInMS: 10 * 60 * 1000,
235235
blockedUserIds: [],
236236
allowedIPAddresses: [],
237+
blockNewOutgoingRequests: false,
237238
});
238239
}
239240

library/agent/api/ReportingAPIRateLimitedServerSide.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ t.test("it stops sending requests if rate limited", async (t) => {
4949
configUpdatedAt: 0,
5050
blockedUserIds: [],
5151
allowedIPAddresses: [],
52+
blockNewOutgoingRequests: false,
5253
});
5354
t.match(api.getEvents(), [{ type: "started" }]);
5455

library/agent/api/ReportingAPIThatValidatesToken.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ t.test("it ignores valid tokens", async () => {
4747
heartbeatIntervalInMS: 10 * 60 * 1000,
4848
blockedUserIds: [],
4949
allowedIPAddresses: [],
50+
blockNewOutgoingRequests: false,
5051
});
5152
t.same(api.getEvents(), [event]);
5253

@@ -57,6 +58,7 @@ t.test("it ignores valid tokens", async () => {
5758
heartbeatIntervalInMS: 10 * 60 * 1000,
5859
blockedUserIds: [],
5960
allowedIPAddresses: [],
61+
blockNewOutgoingRequests: false,
6062
});
6163
t.same(api.getEvents(), [event, event]);
6264
});

library/agent/hooks/onInspectionInterceptorResult.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ export function onInspectionInterceptorResult(
4040
context.remoteAddress &&
4141
agent.getConfig().isBypassedIP(context.remoteAddress);
4242

43-
if (result && !isBypassedIP && result.kind === "blocked_outgoing_request") {
43+
if (
44+
result &&
45+
!isBypassedIP &&
46+
result.kind === "blocked_outbound_connection"
47+
) {
4448
throw cleanError(
4549
new Error(
4650
`Zen has blocked ${attackKindHumanName(result.kind)}: ${result.operation}(...) to ${escapeHTML(result.payload as string)}`

library/sinks/Fetch.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ t.test(
441441
if (blockedError1 instanceof Error) {
442442
t.same(
443443
blockedError1.message,
444-
"Zen has blocked an outgoing request: fetch(...) to https://aikido.dev/block"
444+
"Zen has blocked an outbound connection: fetch(...) to https://aikido.dev/block"
445445
);
446446
}
447447

@@ -459,7 +459,7 @@ t.test(
459459
if (blockedError2 instanceof Error) {
460460
t.same(
461461
blockedError2.message,
462-
"Zen has blocked an outgoing request: fetch(...) to https://example.com/"
462+
"Zen has blocked an outbound connection: fetch(...) to https://example.com/"
463463
);
464464
}
465465

library/sinks/Fetch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export class Fetch implements Wrapper {
2525

2626
return {
2727
operation: "fetch",
28-
kind: "blocked_outgoing_request",
28+
kind: "blocked_outbound_connection",
2929
source: "url",
3030
pathsToPayload: [],
3131
metadata: {},

library/sinks/HTTPRequest.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ t.test("it works", (t) => {
313313
if (blockedError1 instanceof Error) {
314314
t.same(
315315
blockedError1.message,
316-
"Zen has blocked an outgoing request: https.request(...) to https://aikido.dev/block"
316+
"Zen has blocked an outbound connection: https.request(...) to https://aikido.dev/block"
317317
);
318318
}
319319

@@ -331,7 +331,7 @@ t.test("it works", (t) => {
331331
if (blockedError2 instanceof Error) {
332332
t.same(
333333
blockedError2.message,
334-
"Zen has blocked an outgoing request: https.request(...) to https://example.com/"
334+
"Zen has blocked an outbound connection: https.request(...) to https://example.com/"
335335
);
336336
}
337337

library/sinks/HTTPRequest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class HTTPRequest implements Wrapper {
2828

2929
return {
3030
operation: `${module}.request`,
31-
kind: "blocked_outgoing_request",
31+
kind: "blocked_outbound_connection",
3232
source: "url",
3333
pathsToPayload: [],
3434
metadata: {},

library/sinks/Undici.tests.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ export function createUndiciTests(undiciPkgName: string, port: number) {
432432
if (blockedError1 instanceof Error) {
433433
t.same(
434434
blockedError1.message,
435-
"Zen has blocked an outgoing request: undici.request(...) to aikido.dev"
435+
"Zen has blocked an outbound connection: undici.request(...) to aikido.dev"
436436
);
437437
}
438438

@@ -457,7 +457,7 @@ export function createUndiciTests(undiciPkgName: string, port: number) {
457457
if (blockedError2 instanceof Error) {
458458
t.same(
459459
blockedError2.message,
460-
"Zen has blocked an outgoing request: undici.request(...) to example.com"
460+
"Zen has blocked an outbound connection: undici.request(...) to example.com"
461461
);
462462
}
463463

0 commit comments

Comments
 (0)