Skip to content

Commit 1a00350

Browse files
Merge pull request #550 from AikidoSec/code-injection
Use code_injection instead of js_injection
2 parents 609f8c8 + cf2ff51 commit 1a00350

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

library/agent/Attack.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export type Kind =
44
| "shell_injection"
55
| "path_traversal"
66
| "ssrf"
7-
| "js_injection";
7+
| "code_injection";
88

99
export function attackKindHumanName(kind: Kind) {
1010
switch (kind) {
@@ -18,7 +18,7 @@ export function attackKindHumanName(kind: Kind) {
1818
return "a path traversal attack";
1919
case "ssrf":
2020
return "a server-side request forgery";
21-
case "js_injection":
21+
case "code_injection":
2222
return "a JavaScript injection";
2323
}
2424
}

library/vulnerabilities/js-injection/checkContextForJsInjection.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@ t.test("it returns correct path", async () => {
2323
}),
2424
{
2525
operation: "eval",
26-
kind: "js_injection",
26+
kind: "code_injection",
2727
source: "body",
2828
pathsToPayload: [".calc"],
2929
metadata: {
30-
js: "const x = 1 + 1; fetch();",
30+
code: "const x = 1 + 1; fetch();",
31+
language: "js",
3132
},
3233
payload: "1 + 1; fetch()",
3334
}

library/vulnerabilities/js-injection/checkContextForJsInjection.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@ export function checkContextForJsInjection({
2828
if (detectJsInjection(js, str)) {
2929
return {
3030
operation: operation,
31-
kind: "js_injection",
31+
kind: "code_injection",
3232
source: source,
3333
pathsToPayload: getPathsToPayload(str, context[source]),
3434
metadata: {
35-
js: js,
35+
language: "js",
36+
code: js,
3637
},
3738
payload: str,
3839
};

0 commit comments

Comments
 (0)