Skip to content
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

Closed
wants to merge 4 commits into from
Closed

Vulnerability SQL tests #2

wants to merge 4 commits into from

Conversation

pflynn-virtru
Copy link
Member

@pflynn-virtru pflynn-virtru commented Jan 21, 2022

  • adds SQL injection tests

Comment on lines +23 to +37
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()];
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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()) {

Copy link
Member

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

Comment on lines +23 to +37
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()];
}
Copy link
Member

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());
Copy link
Member

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...

dmihalcik-virtru added a commit that referenced this pull request Mar 16, 2022
krokhmaliuk-virtru pushed a commit that referenced this pull request Apr 24, 2024
@cassandrabailey293
Copy link
Contributor

closing as stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants