-
Notifications
You must be signed in to change notification settings - Fork 0
Fix SQL Injection for UAT #52
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
base: develop
Are you sure you want to change the base?
Conversation
| protected AttackResult injectableQueryIntegrity(String name, String auth_tan) { | ||
| StringBuffer output = new StringBuffer(); | ||
| String query = "SELECT * FROM employees WHERE last_name = '" + name + "' AND auth_tan = '" + auth_tan + "'"; | ||
| String query = "SELECT * FROM employees WHERE last_name = '" + name + "' AND auth_tan = " + "?"; |
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.
Mend Code Security Check
New finding (1 of 4)
The Mend Code Security Check of your branch failed because of a SQL Injection finding in this line.
| Severity | Vulnerability Type | CWE | File | Data Flows | Date | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| SQL Injection | 1 | 2023-07-04 09:25am | |||||||||||||||||||||
| |||||||||||||||||||||||
| @ResponseBody | |
| public List<Server> sort(@RequestParam String column) throws Exception { | |
| List<Server> servers = new ArrayList<>(); | |
| try (Connection connection = dataSource.getConnection(); | |
| PreparedStatement preparedStatement = connection.prepareStatement("select id, hostname, ip, mac, status, description from servers where status <> 'out of order' order by " + column)) { |
1 Data Flow/s detected
View Data Flow 1
Line 67 in 34571d5
| public List<Server> sort(@RequestParam String column) throws Exception { |
Line 71 in 34571d5
| PreparedStatement preparedStatement = connection.prepareStatement("select id, hostname, ip, mac, status, description from servers where status <> 'out of order' order by " + column)) { |
Line 71 in 34571d5
| PreparedStatement preparedStatement = connection.prepareStatement("select id, hostname, ip, mac, status, description from servers where status <> 'out of order' order by " + column)) { |
| SqlInjectionLesson8.log(connection, query); | ||
| ResultSet results = statement.executeQuery(query); | ||
| statement.setString(1, auth_tan); | ||
| ResultSet results = statement.executeQuery(); |
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.
Mend Code Security Check
New finding (2 of 4)
The Mend Code Security Check of your branch failed because of a XSS finding in this line.
| Severity | Vulnerability Type | CWE | File | Data Flows | Date | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| XSS | 1 | 2023-07-04 09:25am | |||||||||||||||||||||
| |||||||||||||||||||||||
| @ResponseBody | |
| public List<Server> sort(@RequestParam String column) throws Exception { | |
| List<Server> servers = new ArrayList<>(); | |
| try (Connection connection = dataSource.getConnection(); | |
| PreparedStatement preparedStatement = connection.prepareStatement("select id, hostname, ip, mac, status, description from servers where status <> 'out of order' order by " + column)) { |
1 Data Flow/s detected
View Data Flow 1
Line 67 in 34571d5
| public List<Server> sort(@RequestParam String column) throws Exception { |
Line 71 in 34571d5
| PreparedStatement preparedStatement = connection.prepareStatement("select id, hostname, ip, mac, status, description from servers where status <> 'out of order' order by " + column)) { |
Line 71 in 34571d5
| PreparedStatement preparedStatement = connection.prepareStatement("select id, hostname, ip, mac, status, description from servers where status <> 'out of order' order by " + column)) { |

This PR contains an automated remediation suggestion created by Mend SAST. It will fix the following vulnerability in your custom code: