-
Notifications
You must be signed in to change notification settings - Fork 8
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
[Local] Test after ENG-694 migration #142
Conversation
✨ Amplify has finished checking this pull requestSecurity Pipeline
Vulnerabilities Detected
Note To ignore a finding, append |
models.sequelize.query(`SELECT * FROM Products WHERE ((name LIKE '%${criteria}%' OR description LIKE '%${criteria}%') AND deletedAt IS NULL) ORDER BY name`) | ||
.then(([products]: any) => { |
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.
Warning
Amplify has been notified that this line contains a vulnerability 🕷️.
Vulnerability: CWE-89 Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Impact: HIGH
Code Fix: ✅
Amplify Security has prepared an automated remediation for review. Click here to review and commit the code fix.
models.sequelize.query(`SELECT * FROM Products WHERE ((name LIKE '%${criteria}%' OR description LIKE '%${criteria}%') AND deletedAt IS NULL) ORDER BY name`) | |
.then(([products]: any) => { | |
models.sequelize.query(`SELECT * FROM Products WHERE ((name LIKE :criteria OR description LIKE :criteria) AND deletedAt IS NULL) ORDER BY name`, { replacements: { criteria: `%${criteria}%` }, type: models.sequelize.QueryTypes.SELECT }) | |
.then((products: any) => { |
The code change fixes the SQL Injection vulnerability by using parameterized queries instead of directly concatenating user input into the SQL query string.
In the original code, the user input criteria
is directly concatenated into the SQL query using string interpolation (%${criteria}%
). This allows an attacker to manipulate the criteria
value and inject malicious SQL code, potentially leading to unauthorized access or data manipulation.
In the updated code, the criteria
value is passed as a parameter using the replacements
option in the sequelize.query
method. This ensures that the user input is properly sanitized and escaped before being included in the SQL query. By using parameterized queries, the code prevents SQL Injection attacks by treating the user input as data rather than executable code.
For more information on preventing SQL Injection vulnerabilities, you can refer to the OWASP SQL Injection Prevention Cheat Sheet: OWASP SQL Injection Prevention Cheat Sheet
Note
Have a question or concern about this vulnerability fix? Get an answer within seconds by asking our Concierge 🤖 with @amplify-security
.
i.e. @amplify-security are there known performance issues resulting from this fix?
models.sequelize.query(`SELECT * FROM Products WHERE ((name LIKE '%${criteria}%' OR description LIKE '%${criteria}%') AND deletedAt IS NULL) ORDER BY name`) | ||
.then(([products]: any) => { |
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.
Warning
Amplify has been notified that this line contains a vulnerability 🕷️.
Vulnerability: CWE-79 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Impact: MEDIUM
Code Fix: ✅
Amplify Security has prepared an automated remediation for review. Click here to review and commit the code fix.
models.sequelize.query(`SELECT * FROM Products WHERE ((name LIKE '%${criteria}%' OR description LIKE '%${criteria}%') AND deletedAt IS NULL) ORDER BY name`) | |
.then(([products]: any) => { | |
models.sequelize.query(`SELECT * FROM Products WHERE ((name LIKE ? OR description LIKE ?) AND deletedAt IS NULL) ORDER BY name`, { | |
replacements: [`%${criteria}%`, `%${criteria}%`], | |
type: models.sequelize.QueryTypes.SELECT | |
}) | |
.then((products: any) => { |
The code change fixes the 'Cross-site Scripting' vulnerability by properly neutralizing the input during web page generation.
In the original code, the criteria
variable is directly interpolated into the SQL query string without any sanitization or parameterization. This allows an attacker to inject malicious code into the query, leading to a potential XSS vulnerability.
The code change replaces the direct interpolation with parameterized queries using the replacements
option. The ?
placeholders in the query string are replaced with the sanitized criteria
value. This ensures that the input is properly escaped and prevents any malicious code from being executed.
By using parameterized queries, the code change mitigates the risk of XSS attacks by ensuring that user input is treated as data rather than executable code.
For more information on preventing XSS vulnerabilities, you can refer to the OWASP XSS Prevention Cheat Sheet: OWASP XSS Prevention Cheat Sheet
Note
Have a question or concern about this vulnerability fix? Get an answer within seconds by asking our Concierge 🤖 with @amplify-security
.
i.e. @amplify-security are there known performance issues resulting from this fix?
✨ Amplify has finished checking this pull requestSecurity Pipeline
Vulnerabilities Detected
Note To ignore a finding, append |
models.sequelize.query(`SELECT * FROM Products WHERE ((name LIKE '%${criteria}%' OR description LIKE '%${criteria}%') AND deletedAt IS NULL) ORDER BY name`) | ||
.then(([products]: any) => { |
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.
Warning
Amplify has been notified that this line contains a vulnerability 🕷️.
Vulnerability: CWE-89 Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Impact: HIGH
Code Fix: ✅
Amplify Security has prepared an automated remediation for review. Click here to review and commit the code fix.
models.sequelize.query(`SELECT * FROM Products WHERE ((name LIKE '%${criteria}%' OR description LIKE '%${criteria}%') AND deletedAt IS NULL) ORDER BY name`) | |
.then(([products]: any) => { | |
models.sequelize.query(`SELECT * FROM Products WHERE ((name LIKE :criteria OR description LIKE :criteria) AND deletedAt IS NULL) ORDER BY name`, { replacements: { criteria: `%${criteria}%` }, type: models.sequelize.QueryTypes.SELECT }) | |
.then((products: any) => { |
The code change fixes the SQL Injection vulnerability by using parameterized queries instead of directly concatenating user input into the SQL query string.
In the original code, the user input criteria
is directly concatenated into the SQL query string using string interpolation (%${criteria}%
). This allows an attacker to manipulate the criteria
value and inject malicious SQL code, potentially leading to unauthorized access or data manipulation.
In the updated code, the criteria
value is passed as a parameter using the replacements
option in the sequelize.query
method. This ensures that the user input is properly sanitized and escaped before being included in the SQL query. By using parameterized queries, the code prevents SQL Injection attacks by treating the user input as data rather than executable code.
Here is the documentation for Sequelize's parameterized queries: Sequelize - Querying - Parameterized queries
Note
Have a question or concern about this vulnerability fix? Get an answer within seconds by asking our Concierge 🤖 with @amplify-security
.
i.e. @amplify-security are there known performance issues resulting from this fix?
models.sequelize.query(`SELECT * FROM Products WHERE ((name LIKE '%${criteria}%' OR description LIKE '%${criteria}%') AND deletedAt IS NULL) ORDER BY name`) | ||
.then(([products]: any) => { |
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.
Warning
Amplify has been notified that this line contains a vulnerability 🕷️.
Vulnerability: CWE-79 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Impact: MEDIUM
Code Fix: ✅
Amplify Security has prepared an automated remediation for review. Click here to review and commit the code fix.
models.sequelize.query(`SELECT * FROM Products WHERE ((name LIKE '%${criteria}%' OR description LIKE '%${criteria}%') AND deletedAt IS NULL) ORDER BY name`) | |
.then(([products]: any) => { | |
models.sequelize.query(`SELECT * FROM Products WHERE ((name LIKE :criteria OR description LIKE :criteria) AND deletedAt IS NULL) ORDER BY name`, { replacements: { criteria: `%${criteria}%` }, type: models.sequelize.QueryTypes.SELECT }) | |
.then((products: any) => { |
The code change fixes the 'Cross-site Scripting' vulnerability by properly neutralizing the input during web page generation.
In the original code, the criteria
variable is directly concatenated into the SQL query string using string interpolation (%${criteria}%
). This can allow an attacker to inject malicious code into the query, leading to potential cross-site scripting attacks.
The code change replaces the string interpolation with parameterized queries. Instead of directly concatenating the criteria
variable into the query string, it uses a placeholder (:criteria
) and provides the actual value as a replacement using the replacements
option. This ensures that the input is properly escaped and prevents any malicious code from being executed.
By using parameterized queries, the code change mitigates the risk of cross-site scripting vulnerabilities and improves the security of the application.
For more information on preventing cross-site scripting vulnerabilities, you can refer to the OWASP Cross-Site Scripting (XSS) Prevention Cheat Sheet: OWASP XSS Prevention Cheat Sheet
Note
Have a question or concern about this vulnerability fix? Get an answer within seconds by asking our Concierge 🤖 with @amplify-security
.
i.e. @amplify-security are there known performance issues resulting from this fix?
Description
A clear and concise summary of the change and which issue (if any) it fixes. Should also include relevant motivation and context.
Resolved or fixed issue:
Affirmation