Skip to content

Conversation

@NormanWenzelWSS
Copy link
Owner

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

File Vulnerability CWE Severity
SqlInjectionLesson9.java SQL Injection CWE-89 ⚠️ High

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 = " + "?";
Copy link
Owner Author

@NormanWenzelWSS NormanWenzelWSS Oct 30, 2023

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.

SeverityVulnerability TypeCWEFileData FlowsDate
HighSQL Injection

CWE-89

Servers.java:71

12023-07-04 09:25am
Vulnerable Code

@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

public List<Server> sort(@RequestParam String column) throws Exception {

PreparedStatement preparedStatement = connection.prepareStatement("select id, hostname, ip, mac, status, description from servers where status <> 'out of order' order by " + column)) {

PreparedStatement preparedStatement = connection.prepareStatement("select id, hostname, ip, mac, status, description from servers where status <> 'out of order' order by " + column)) {

Secure Code Warrior Training Material
Suppress Finding
  • ... as False Alarm
  • ... as Acceptable Risk

SqlInjectionLesson8.log(connection, query);
ResultSet results = statement.executeQuery(query);
statement.setString(1, auth_tan);
ResultSet results = statement.executeQuery();
Copy link
Owner Author

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.

SeverityVulnerability TypeCWEFileData FlowsDate
HighXSS

CWE-79

Servers.java:71

12023-07-04 09:25am
Vulnerable Code

@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

public List<Server> sort(@RequestParam String column) throws Exception {

PreparedStatement preparedStatement = connection.prepareStatement("select id, hostname, ip, mac, status, description from servers where status <> 'out of order' order by " + column)) {

PreparedStatement preparedStatement = connection.prepareStatement("select id, hostname, ip, mac, status, description from servers where status <> 'out of order' order by " + column)) {

Secure Code Warrior Training Material
Suppress Finding
  • ... as False Alarm
  • ... as Acceptable Risk

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.

1 participant