Skip to content

Commit 2f1cca9

Browse files
authored
Merge pull request #814 from AikidoSec/empty-strings
Don't add empty strings to the context
2 parents 1c18eec + 5e455ad commit 2f1cca9

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

library/helpers/extractStringsFromUserInput.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ t.test("empty object returns empty array", async () => {
1010
t.same(extractStringsFromUserInput({}), fromArr([]));
1111
});
1212

13+
t.test("empty strings are ignored", async () => {
14+
t.same(extractStringsFromUserInput({ abc: "" }), fromArr(["abc"]));
15+
});
16+
1317
t.test("it can extract query objects", async () => {
1418
t.same(
1519
extractStringsFromUserInput({ age: { $gt: "21" } }),

library/helpers/extractStringsFromUserInput.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export function extractStringsFromUserInput(
4242
results.add(obj.join());
4343
}
4444

45-
if (typeof obj === "string") {
45+
if (typeof obj === "string" && obj.length > 0) {
4646
results.add(obj);
4747

4848
if (obj.includes("%") && obj.length >= 3) {

0 commit comments

Comments
 (0)