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

Sast security fix #455

Closed

Conversation

arunvenmany-ibm
Copy link
Contributor

No description provided.

factory.setXIncludeAware(false);
factory.setNamespaceAware(true);
factory.setExpandEntityReferences(false);
return factory;
Copy link
Member

Choose a reason for hiding this comment

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

Are we not allowed to have a singleton instance of the factory? We were only doing the initialization once before. This can get called many times from maven/gradle plugins. This new code is creating a new one every single time.

XPath xPath = XPathFactory.newInstance().newXPath();
NodeList nodeList = (NodeList) xPath.compile(expression).evaluate(doc, XPathConstants.NODESET);
NodeList nodeList = (NodeList) expression
.evaluate(doc, XPathConstants.NODESET);
Copy link
Member

Choose a reason for hiding this comment

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

spacing is weird here

@@ -511,8 +521,14 @@ private Document parseDocument(URL url) throws IOException, SAXException {
}

private Document parseDocument(InputStream in) throws SAXException, IOException {
try (InputStream ins = in) { // ins will be auto-closed
InputStream ins = null;
Copy link
Member

Choose a reason for hiding this comment

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

Why are we getting rid of try with resources which is the new better way to ensure streams are closed?

@@ -52,8 +52,8 @@ public abstract class BinaryScannerUtil {
"in the application’s API usage: %s. Review and update your application to ensure it is not using conflicting APIs " +
"from different levels of MicroProfile, Java EE, or Jakarta EE.";
public static final String BINARY_SCANNER_CONFLICT_MESSAGE4 = "[None available]"; // format should match JVM Set.toString()
public static final String BINARY_SCANNER_CONFLICT_MESSAGE5 = "A working set of features could not be generated due to conflicts " +
"in the required features: %s and required levels of MicroProfile: %s, Java EE or Jakarta EE: %s. Review and update your application to ensure it " +
public static final String BINARY_SCANNER_CONFLICT_MESSAGE5 = "A working set of features could not be generated due to conflicts " +
Copy link
Member

Choose a reason for hiding this comment

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

Are there any actual changes to this file? or all formatting? If the latter, please revert the changes to this file.

@@ -947,7 +948,7 @@ public void onFileChange(File file) {
// Parse hostname, http, https ports for integration tests to use
parseHostNameAndPorts(serverTask, messagesLogFile);
} catch (IOException e) {
throw new PluginExecutionException("An error occurred while starting the server: " + e.getMessage(), e);
throw new PluginExecutionException("An error occurred while starting the server: " + e.getMessage());
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we should do these changes. There is no security risk here because this is all open source. We need this level of detail to support our customers when they report issues. We can document this reasoning in the spreadsheet for all of this category of issues.

@@ -53,7 +53,7 @@ public static boolean isServerRunning(File installDirectory, File outputDirector
return false;
}
} catch (Exception e) {
e.printStackTrace();
System.out.println("exception while reading pidfile " + e.getMessage());
Copy link
Member

Choose a reason for hiding this comment

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

We should not do System.out.println. Can a logger be passed in?

@arunvenmany-ibm arunvenmany-ibm deleted the sast_security_fix branch September 26, 2024 05:06
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.

2 participants