Skip to content
This repository was archived by the owner on Feb 4, 2026. It is now read-only.

Add compliant and noncompliant examples of javascript/code-injection@v1.0#71

Open
karmakri wants to merge 5 commits intoaws-samples:mainfrom
karmakri:code_injection
Open

Add compliant and noncompliant examples of javascript/code-injection@v1.0#71
karmakri wants to merge 5 commits intoaws-samples:mainfrom
karmakri:code_injection

Conversation

@karmakri
Copy link
Contributor

Description of changes:

Add compliant and noncompliant examples of javascript/code-injection@v1.0.

const allowedParameters = ['-n', '-c']

// Compliant: validating user-supplied datas before passing them into the shell command.
if ( allowedCommands.indexOf(command) != -1 && allowedParameters.indexOf(parameter) != -1 && !isNaN(lines)) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you fix indentation:
if (allowedCommands.indexOf(command) != -1)
Note no tailing space after (

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants