-
Notifications
You must be signed in to change notification settings - Fork 350
Add IAST benchmarks #3193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add IAST benchmarks #3193
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| This creates 150 HTTP requests from client to server. | ||
|
|
||
| The variants are: | ||
| - control tracer with non vulnerable endpoint without iast | ||
| - tracer with non vulnerable endpoint with iast active and default configuration | ||
| - tracer with non vulnerable endpoint with iast active and sampling 100 | ||
| - control tracer with vulnerable endpoint without iast | ||
| - tracer with vulnerable endpoint with iast active and default configuration | ||
| - tracer with vulnerable endpoint with iast active and sampling 100 |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| 'use strict' | ||
|
|
||
| const { port, reqs } = require('./common') | ||
| const http = require('http') | ||
|
|
||
| let connectionsMade = 0 | ||
| function request (opts) { | ||
| http.get(opts, (res) => { | ||
| res.on('data', () => {}) | ||
| res.on('end', () => { | ||
| if (++connectionsMade !== reqs) { | ||
| request(opts) | ||
| } | ||
| }) | ||
| }).on('error', (e) => { | ||
| setTimeout(() => { | ||
| request(opts) | ||
| }, 10) | ||
| }) | ||
| } | ||
|
|
||
| const path = '/?param=value' | ||
| const opts = { | ||
| headers: { | ||
| accept: 'text/html' | ||
| }, | ||
| port, | ||
| path | ||
| } | ||
| request(opts) |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| 'use strict' | ||
|
|
||
| module.exports = { | ||
| port: 3331 + parseInt(process.env.CPU_AFFINITY || '0'), | ||
| reqs: 350 | ||
| } |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| { | ||
| "name": "appsec-iast", | ||
| "cachegrind": false, | ||
| "instructions": true, | ||
| "iterations": 40, | ||
| "variants": { | ||
| "no-vulnerability-control": { | ||
| "setup": "bash -c \"nohup node client.js >/dev/null 2>&1 &\"", | ||
| "run": "node --require ../../../init.js server-without-vulnerability.js", | ||
simon-id marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "run_with_affinity": "bash -c \"taskset -c $CPU_AFFINITY node --require ../../../init.js server-without-vulnerability.js\"", | ||
| "env": { | ||
| "DD_IAST_ENABLED": "0" | ||
| } | ||
| }, | ||
| "no-vulnerability-iast-enabled-default-config": { | ||
| "setup": "bash -c \"nohup node client.js >/dev/null 2>&1 &\"", | ||
| "run": "node --require ../../../init.js server-without-vulnerability.js", | ||
| "run_with_affinity": "bash -c \"taskset -c $CPU_AFFINITY node --require ../../../init.js server-without-vulnerability.js\"", | ||
| "baseline": "no-vulnerability-control", | ||
| "env": { | ||
| "DD_IAST_ENABLED": "1" | ||
| } | ||
| }, | ||
| "no-vulnerability-iast-enabled-always-active": { | ||
| "setup": "bash -c \"nohup node client.js >/dev/null 2>&1 &\"", | ||
| "run": "node --require ../../../init.js server-without-vulnerability.js", | ||
| "run_with_affinity": "bash -c \"taskset -c $CPU_AFFINITY node --require ../../../init.js server-without-vulnerability.js\"", | ||
| "baseline": "no-vulnerability-control", | ||
| "env": { | ||
| "DD_IAST_ENABLED": "1", | ||
| "DD_IAST_REQUEST_SAMPLING": "100", | ||
| "DD_IAST_MAX_CONCURRENT_REQUESTS": "1000", | ||
| "DD_IAST_MAX_CONTEXT_OPERATIONS": "100" | ||
| } | ||
| }, | ||
| "with-vulnerability-control": { | ||
| "setup": "bash -c \"nohup node client.js >/dev/null 2>&1 &\"", | ||
| "run": "node --require ../../../init.js server-with-vulnerability.js", | ||
| "run_with_affinity": "bash -c \"taskset -c $CPU_AFFINITY node --require ../../../init.js server-with-vulnerability.js\"", | ||
| "env": { | ||
| "DD_IAST_ENABLED": "0" | ||
| } | ||
| }, | ||
| "with-vulnerability-iast-enabled-default-config": { | ||
| "setup": "bash -c \"nohup node client.js >/dev/null 2>&1 &\"", | ||
| "run": "node --require ../../../init.js server-with-vulnerability.js", | ||
| "run_with_affinity": "bash -c \"taskset -c $CPU_AFFINITY node --require ../../../init.js server-with-vulnerability.js\"", | ||
| "baseline": "with-vulnerability-control", | ||
| "env": { | ||
| "DD_IAST_ENABLED": "1" | ||
| } | ||
| }, | ||
| "with-vulnerability-iast-enabled-always-active": { | ||
| "setup": "bash -c \"nohup node client.js >/dev/null 2>&1 &\"", | ||
| "run": "node --require ../../../init.js server-with-vulnerability.js", | ||
| "run_with_affinity": "bash -c \"taskset -c $CPU_AFFINITY node --require ../../../init.js server-with-vulnerability.js\"", | ||
| "baseline": "with-vulnerability-control", | ||
| "env": { | ||
| "DD_IAST_ENABLED": "1", | ||
| "DD_IAST_REQUEST_SAMPLING": "100", | ||
| "DD_IAST_MAX_CONCURRENT_REQUESTS": "1000", | ||
| "DD_IAST_MAX_CONTEXT_OPERATIONS": "100" | ||
| } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| 'use strict' | ||
|
|
||
| const { port, reqs } = require('./common') | ||
| const express = require('../../../versions/express').get() | ||
| const cookieParser = require('../../../versions/cookie-parser').get() | ||
| const childProcess = require('child_process') | ||
|
|
||
| const app = express() | ||
| app.use(cookieParser()) | ||
|
|
||
| let connectionsMade = 0 | ||
|
|
||
| function noop () {} | ||
|
|
||
| app.get('/', (req, res) => { | ||
| childProcess.exec('echo #' + req.query.param, noop) | ||
| res.writeHead(200) | ||
| res.end('Hello, World!') | ||
|
|
||
| if (++connectionsMade === reqs) { | ||
| server.close() | ||
| } | ||
| }) | ||
|
|
||
| const server = app.listen(port) |
21 changes: 21 additions & 0 deletions
21
benchmark/sirun/appsec-iast/server-without-vulnerability.js
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| 'use strict' | ||
|
|
||
| const { port, reqs } = require('./common') | ||
| const express = require('../../../versions/express').get() | ||
| const cookieParser = require('../../../versions/cookie-parser').get() | ||
|
|
||
| const app = express() | ||
| app.use(cookieParser()) | ||
|
|
||
| let connectionsMade = 0 | ||
|
|
||
| app.get('/', (req, res) => { | ||
| res.writeHead(200) | ||
| res.end('Hello, World!') | ||
|
|
||
| if (++connectionsMade === reqs) { | ||
| server.close() | ||
| } | ||
| }) | ||
|
|
||
| const server = app.listen(port) |
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.