-
Notifications
You must be signed in to change notification settings - Fork 317
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into appsec_session_id
- Loading branch information
Showing
291 changed files
with
5,312 additions
and
1,387 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
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
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
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
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
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
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,69 @@ | ||
'use strict' | ||
|
||
import childProcess from 'node:child_process' | ||
import express from 'express' | ||
import { sanitize } from './sanitizer.mjs' | ||
import sanitizeDefault from './sanitizer-default.mjs' | ||
import { validate, validateNotConfigured } from './validator.mjs' | ||
|
||
const app = express() | ||
const port = process.env.APP_PORT || 3000 | ||
|
||
app.get('/cmdi-s-secure', (req, res) => { | ||
const command = sanitize(req.query.command) | ||
try { | ||
childProcess.execSync(command) | ||
} catch (e) { | ||
// ignore | ||
} | ||
|
||
res.end() | ||
}) | ||
|
||
app.get('/cmdi-s-secure-comparison', (req, res) => { | ||
const command = sanitize(req.query.command) | ||
try { | ||
childProcess.execSync(command) | ||
} catch (e) { | ||
// ignore | ||
} | ||
|
||
try { | ||
childProcess.execSync(req.query.command) | ||
} catch (e) { | ||
// ignore | ||
} | ||
|
||
res.end() | ||
}) | ||
|
||
app.get('/cmdi-s-secure-default', (req, res) => { | ||
const command = sanitizeDefault(req.query.command) | ||
try { | ||
childProcess.execSync(command) | ||
} catch (e) { | ||
// ignore | ||
} | ||
|
||
res.end() | ||
}) | ||
|
||
app.get('/cmdi-iv-insecure', (req, res) => { | ||
if (validateNotConfigured(req.query.command)) { | ||
childProcess.execSync(req.query.command) | ||
} | ||
|
||
res.end() | ||
}) | ||
|
||
app.get('/cmdi-iv-secure', (req, res) => { | ||
if (validate(req.query.command)) { | ||
childProcess.execSync(req.query.command) | ||
} | ||
|
||
res.end() | ||
}) | ||
|
||
app.listen(port, () => { | ||
process.send({ port }) | ||
}) |
7 changes: 7 additions & 0 deletions
7
integration-tests/appsec/esm-security-controls/sanitizer-default.mjs
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,7 @@ | ||
'use strict' | ||
|
||
function sanitizeDefault (input) { | ||
return input | ||
} | ||
|
||
export default sanitizeDefault |
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,5 @@ | ||
'use strict' | ||
|
||
export function sanitize (input) { | ||
return input | ||
} |
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 @@ | ||
'use strict' | ||
|
||
export function validate (input) { | ||
return true | ||
} | ||
|
||
export function validateNotConfigured (input) { | ||
return true | ||
} |
Oops, something went wrong.