-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
279 changed files
with
2,345 additions
and
10,828 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
534 changes: 0 additions & 534 deletions
534
tests/javascript/express/cross_site_scripting/__snapshots__/test.js.snap
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,50 @@ | ||
const { createInvoker, getEnvironment } = require("../../../helper.js") | ||
const { | ||
createNewInvoker, | ||
getEnvironment, | ||
} = require("../../../helper.js") | ||
const { ruleId, ruleFile, testBase } = getEnvironment(__dirname) | ||
|
||
describe(ruleId, () => { | ||
const invoke = createInvoker(ruleId, ruleFile, testBase) | ||
const invoke = createNewInvoker(ruleId, ruleFile, testBase) | ||
|
||
|
||
test("no_xss", () => { | ||
const testCase = "no_xss.js" | ||
|
||
const results = invoke(testCase) | ||
|
||
test("no_xss", () => { | ||
const testCase = "no_xss.js" | ||
expect(invoke(testCase)).toMatchSnapshot(); | ||
}) | ||
expect(results.Missing).toEqual([]) | ||
expect(results.Extra).toEqual([]) | ||
}) | ||
|
||
|
||
test("res_send_xss", () => { | ||
const testCase = "res_send_xss.js" | ||
expect(invoke(testCase)).toMatchSnapshot(); | ||
}) | ||
test("res_send_xss", () => { | ||
const testCase = "res_send_xss.js" | ||
|
||
const results = invoke(testCase) | ||
|
||
expect(results.Missing).toEqual([]) | ||
expect(results.Extra).toEqual([]) | ||
}) | ||
|
||
|
||
test("res_write_xss", () => { | ||
const testCase = "res_write_xss.js" | ||
expect(invoke(testCase)).toMatchSnapshot(); | ||
}) | ||
test("res_write_xss", () => { | ||
const testCase = "res_write_xss.js" | ||
|
||
const results = invoke(testCase) | ||
|
||
expect(results.Missing).toEqual([]) | ||
expect(results.Extra).toEqual([]) | ||
}) | ||
|
||
|
||
test("user_input_types", () => { | ||
const testCase = "user_input_types.ts" | ||
expect(invoke(testCase)).toMatchSnapshot(); | ||
}) | ||
test("user_input_types", () => { | ||
const testCase = "user_input_types.ts" | ||
|
||
const results = invoke(testCase) | ||
|
||
expect(results.Missing).toEqual([]) | ||
expect(results.Extra).toEqual([]) | ||
}) | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
tests/javascript/express/cross_site_scripting/testdata/user_input_types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,48 @@ | ||
// This file is indirectly testing javascript_shared_express_user_input | ||
|
||
// bearer:expected javascript_express_cross_site_scripting | ||
res.send(req.params.oops) | ||
|
||
let { params } = req | ||
let { oops } = params | ||
let { subOops } = oops | ||
|
||
// bearer:expected javascript_express_cross_site_scripting | ||
res.send(params.oops) | ||
// bearer:expected javascript_express_cross_site_scripting | ||
res.send(oops) | ||
|
||
const foo: Request = x | ||
// bearer:expected javascript_express_cross_site_scripting | ||
res.send(foo.params.oops) | ||
|
||
const f = (x: string, foo2: Request, { params }: Request) => { | ||
// bearer:expected javascript_express_cross_site_scripting | ||
res.send(foo2.params.oops) | ||
// bearer:expected javascript_express_cross_site_scripting | ||
res.send(params.oops) | ||
} | ||
|
||
function(foo3: Request, { params }: Request) { | ||
// bearer:expected javascript_express_cross_site_scripting | ||
res.send(foo3.params.oops) | ||
// bearer:expected javascript_express_cross_site_scripting | ||
res.send(params.oops) | ||
} | ||
|
||
function f2(foo4: Request, { params }: Request) { | ||
// bearer:expected javascript_express_cross_site_scripting | ||
res.send(foo4.params.oops) | ||
// bearer:expected javascript_express_cross_site_scripting | ||
res.send(params.oops) | ||
} | ||
|
||
|
||
class X extends Y { | ||
m(foo5: Request, { params }: Request) { | ||
// bearer:expected javascript_express_cross_site_scripting | ||
res.send(foo5.params.oops) | ||
// bearer:expected javascript_express_cross_site_scripting | ||
res.send(params.oops) | ||
} | ||
} |
153 changes: 0 additions & 153 deletions
153
tests/javascript/express/default_cookie_config/__snapshots__/test.js.snap
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,40 @@ | ||
const { createInvoker, getEnvironment } = require("../../../helper.js") | ||
const { | ||
createNewInvoker, | ||
getEnvironment, | ||
} = require("../../../helper.js") | ||
const { ruleId, ruleFile, testBase } = getEnvironment(__dirname) | ||
|
||
describe(ruleId, () => { | ||
const invoke = createInvoker(ruleId, ruleFile, testBase) | ||
const invoke = createNewInvoker(ruleId, ruleFile, testBase) | ||
|
||
|
||
test("default_cookie_session_config", () => { | ||
const testCase = "default_cookie_session_config.js" | ||
|
||
const results = invoke(testCase) | ||
|
||
test("default_cookie_session_config", () => { | ||
const testCase = "default_cookie_session_config.js" | ||
expect(invoke(testCase)).toMatchSnapshot(); | ||
}) | ||
expect(results.Missing).toEqual([]) | ||
expect(results.Extra).toEqual([]) | ||
}) | ||
|
||
|
||
test("default_express_session_cookie_config", () => { | ||
const testCase = "default_express_session_cookie_config.js" | ||
expect(invoke(testCase)).toMatchSnapshot(); | ||
}) | ||
test("default_express_session_cookie_config", () => { | ||
const testCase = "default_express_session_cookie_config.js" | ||
|
||
const results = invoke(testCase) | ||
|
||
expect(results.Missing).toEqual([]) | ||
expect(results.Extra).toEqual([]) | ||
}) | ||
|
||
|
||
test("ok_cookie_configured", () => { | ||
const testCase = "ok_cookie_configured.js" | ||
expect(invoke(testCase)).toMatchSnapshot(); | ||
}) | ||
test("ok_cookie_configured", () => { | ||
const testCase = "ok_cookie_configured.js" | ||
|
||
const results = invoke(testCase) | ||
|
||
expect(results.Missing).toEqual([]) | ||
expect(results.Extra).toEqual([]) | ||
}) | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.