-
Notifications
You must be signed in to change notification settings - Fork 2
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
Vulnerability SQL tests #2
Conversation
pflynn-virtru
commented
Jan 21, 2022
•
edited
Loading
edited
- adds SQL injection tests
let genericSqlInjectionPayload: [string]; | ||
|
||
|
||
test.beforeAll(async ({playwright}) => { | ||
// read test data | ||
const rl = readline.createInterface({ | ||
input: fs.createReadStream('resources/generic-sql-injection-payload.txt'), | ||
output: process.stdout, | ||
terminal: false | ||
}); | ||
rl.on('line', (line) => { | ||
if (line.trim()) { | ||
if (!genericSqlInjectionPayload) { | ||
genericSqlInjectionPayload = [line.trim()]; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let genericSqlInjectionPayload: [string]; | |
test.beforeAll(async ({playwright}) => { | |
// read test data | |
const rl = readline.createInterface({ | |
input: fs.createReadStream('resources/generic-sql-injection-payload.txt'), | |
output: process.stdout, | |
terminal: false | |
}); | |
rl.on('line', (line) => { | |
if (line.trim()) { | |
if (!genericSqlInjectionPayload) { | |
genericSqlInjectionPayload = [line.trim()]; | |
} | |
let genericSqlInjectionPayload = []: [string]; | |
test.beforeAll(async ({playwright}) => { | |
// read test data | |
const rl = readline.createInterface({ | |
input: fs.createReadStream('resources/generic-sql-injection-payload.txt'), | |
output: process.stdout, | |
terminal: false | |
}); | |
rl.on('line', (line) => { | |
if (line.trim()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: ^ Initialize as an empty array. This also avoids your repeat-initial-line bug in the current code
let genericSqlInjectionPayload: [string]; | ||
|
||
|
||
test.beforeAll(async ({playwright}) => { | ||
// read test data | ||
const rl = readline.createInterface({ | ||
input: fs.createReadStream('resources/generic-sql-injection-payload.txt'), | ||
output: process.stdout, | ||
terminal: false | ||
}); | ||
rl.on('line', (line) => { | ||
if (line.trim()) { | ||
if (!genericSqlInjectionPayload) { | ||
genericSqlInjectionPayload = [line.trim()]; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: ^ Initialize as an empty array. This also avoids your repeat-initial-line bug in the current code
}); | ||
expect(response.status()).not.toBe(constants.HTTP_STATUS_INTERNAL_SERVER_ERROR); | ||
console.log(response.status()); | ||
console.log((await response.body()).toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add some expectations here and below in similar code? Ideally tests wouldn't require a manual review which these seem to...
closing as stale. |