-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* appsec-iast benchmark tests * writing fixes Co-authored-by: simon-id <simon.id@datadoghq.com> * small fixes --------- Co-authored-by: simon-id <simon.id@datadoghq.com>
- Loading branch information
Showing
8 changed files
with
162 additions
and
1 deletion.
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
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 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 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 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", | ||
"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 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 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 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