Skip to content

Conversation

@KianRolf
Copy link
Contributor

#fixes #1144

@github-project-automation github-project-automation bot moved this to 🆕 New in IDEasy board Apr 29, 2025
@KianRolf KianRolf self-assigned this Apr 29, 2025
@KianRolf KianRolf added the security CVEs or other vulnerabilities label Apr 29, 2025
# Conflicts:
#	cli/src/main/java/com/devonfw/tools/ide/variable/IdeVariables.java
# Conflicts:
#	cli/src/main/java/com/devonfw/tools/ide/variable/IdeVariables.java
Copy link
Member

@hohwille hohwille left a comment

Choose a reason for hiding this comment

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

@KianRolf thanks for your PR. Quite some complexity and great that you found your way to get everything solved and working.
This is good work and only needs little polishing before we can merge. 👍
I left some review comments.
What I slightly dislike is the many and also empty *.urls files that you added what will cause us quite some maintenance effort later (will collide with #706). It would have been much better to add a new test-project for your scenario and even if you again would use intellij plus java as your scenario at least make the URLs OS-agnostic so you do not have to have 3 *.urls file for every version. Do these *.urls files actually matter for your test at all? Or could you also just add one single urls file in each of the versions folder you added?
I have not yet tested your code for bugs but just wrote my review comments from reading your code. Lets find a balance how you can get this PR done with low additional effort so we can merge it. Other things then have to be addressed after the merge.

}
}
return cves;
public List<CVE> findCVEs() {
Copy link
Member

Choose a reason for hiding this comment

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

This method is a getter and the same functionality already exists as getIssues().
It should simply be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

//arrange
context.setUrlsPath(URLS_PATH);
Intellij commandlet = new Intellij(this.context);
context.setAnswers("current");
Copy link
Member

Choose a reason for hiding this comment

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

very nice test. But why don't you also test the other 2 options? Too much effort?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

expanded test but ran into a problem with the java check on the latest option could not figure out what went wrong.

+ " Therefore, we install a compatible version in that range."),
new IdeLogEntry(IdeLogLevel.DEBUG, "Installed java in version " + javaVersionTomcat + " at ", true),
new IdeLogEntry(IdeLogLevel.SUCCESS, "Successfully installed tomcat in version " + tomcatVersion),
new IdeLogEntry(IdeLogLevel.INFO, "OpenJDK version " + javaVersionTomcat),
Copy link
Member

Choose a reason for hiding this comment

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

why was this removed? Did this fail after your changes?
Does it reveal a bug or are we sure this is OK?

Copy link
Contributor

Choose a reason for hiding this comment

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

Please re-add this assertion and try to find out why your changes caused this to fail.


// assert
assertThat(security).containsExactly(new CVE("CVE-2024-32002", 9.0f, versionRanges));
assertThat(security).contains(new CVE("CVE-2024-32002", 9.0f, versionRanges));
Copy link
Member

Choose a reason for hiding this comment

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

This is also confusing me. Why was the test changed from tomcat to intellij?
Why did you change from containsExactly to the weaker contains?

@github-project-automation github-project-automation bot moved this from Team Review to 👀 In review in IDEasy board Aug 29, 2025
VariableDefinitionPath WORKSPACE_PATH = new VariableDefinitionPath("WORKSPACE_PATH", null, c -> c.getWorkspacePath(), true);

/** {@link VariableDefinition} for default CVE_MIN_SEVERITY. */
VariableDefinitionDoulbe CVE_MIN_SEVERIRY = new VariableDefinitionDoulbe("CVE_MIN_SEVERITY", null, c -> 1.0);
Copy link
Contributor

@jan-vcapgemini jan-vcapgemini Sep 2, 2025

Choose a reason for hiding this comment

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

Typo in Class name and in constant CVE_MIN_SEVERIRY => CVE_MIN_SEVERITY


import com.devonfw.tools.ide.context.IdeContext;

public class VariableDefinitionDoulbe extends AbstractVariableDefinition<Double> {
Copy link
Contributor

@jan-vcapgemini jan-vcapgemini Sep 2, 2025

Choose a reason for hiding this comment

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

Typo in class name and Javadocs missing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

return install(silent, processContext, step, false);
}

public boolean install(boolean silent, ProcessContext processContext, Step step, boolean isDependency) {
Copy link
Contributor

@jan-vcapgemini jan-vcapgemini Sep 3, 2025

Choose a reason for hiding this comment

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

Please declare this install override method as an abstract in ToolCommandlet and use the @Override annotation here. Please also add Javadoc to the method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Comment on lines 92 to +95
private boolean doInstallStep(VersionIdentifier configuredVersion, VersionIdentifier installedVersion, boolean silent, ProcessContext processContext,
Step step) {
return doInstallStep(configuredVersion, installedVersion, silent, processContext, step, false);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This method is not in use anymore, delete?

* @return the {@link ToolInstallation} matching the given {@code version}.
*/
public ToolInstallation installTool(GenericVersionRange version, ProcessContext processContext) {
public ToolInstallation installTool(GenericVersionRange version, ProcessContext processContext, boolean isDependency) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add isDependency param to Javadoc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

* @return the {@link ToolInstallation} matching the given {@code version}.
*/
public ToolInstallation installTool(GenericVersionRange version, ProcessContext processContext, String edition) {
public ToolInstallation installTool(GenericVersionRange version, ProcessContext processContext, String edition, boolean isDependenny) {
Copy link
Contributor

@jan-vcapgemini jan-vcapgemini Sep 3, 2025

Choose a reason for hiding this comment

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

Please fix the typo and add isDependency param to Javadoc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

* @param allowedVersions the allowed {@link VersionRange}.
* @return {@code true} if the tool was newly installed, {@code false} otherwise (installation was already present).
*/
private VersionIdentifier lookForCVEs(VersionIdentifier version, String edition, ProcessContext processContext, VersionRange allowedVersions) {
Copy link
Contributor

@jan-vcapgemini jan-vcapgemini Sep 3, 2025

Choose a reason for hiding this comment

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

Please rename method to lookForCves.

Use CamelCase even for abbreviations (XmlUtil instead of XMLUtil).

See: https://github.com/devonfw/IDEasy/blob/main/documentation/coding-conventions.adoc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

/**
* Class used to handle and get {@link ToolSecurity}, {@link CVE} for specific tool.
*/
public class CVEFinder {
Copy link
Contributor

@jan-vcapgemini jan-vcapgemini Sep 3, 2025

Choose a reason for hiding this comment

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

Please rename class to CveFinder.

Use CamelCase even for abbreviations (XmlUtil instead of XMLUtil).

See: https://github.com/devonfw/IDEasy/blob/main/documentation/coding-conventions.adoc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

} else {
cveFinder = new CVEFinder(context, this, version, allowedVersions);
}
Collection<CVE> cves = cveFinder.getCVEs(version);
Copy link
Contributor

Choose a reason for hiding this comment

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

Please rename CVE class to Cve.

Use CamelCase even for abbreviations (XmlUtil instead of XMLUtil).

See: https://github.com/devonfw/IDEasy/blob/main/documentation/coding-conventions.adoc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

*
* @param versionIdentifier {@link VersionIdentifier}.
*/
public void listCVEs(VersionIdentifier versionIdentifier) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please rename method to listCves.

Use CamelCase even for abbreviations (XmlUtil instead of XMLUtil).

See: https://github.com/devonfw/IDEasy/blob/main/documentation/coding-conventions.adoc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

* @param versionIdentifier
* @return all {@link CVE}s from specific {@link VersionIdentifier}.
*/
public Collection<CVE> getCVEs(VersionIdentifier versionIdentifier) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please rename method to getCves.

Use CamelCase even for abbreviations (XmlUtil instead of XMLUtil).

See: https://github.com/devonfw/IDEasy/blob/main/documentation/coding-conventions.adoc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

/**
* Test for method lookForCVEs in {@link LocalToolCommandlet}.
*/
public class LookForCVEsTest extends AbstractIdeContextTest {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please rename class to LookForCvesTest.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

toolParent, this.tool, version, configuredVersion);
}
ToolInstallation toolInstallation = installTool(version, processContext);
ToolInstallation toolInstallation = installTool(
Copy link
Contributor

Choose a reason for hiding this comment

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

This change seems to break the TomcatTest. Please check why the version determined from the dependency file (21_35) is not being used.

KianRolf and others added 11 commits September 11, 2025 22:22
Co-authored-by: Jörg Hohwiller <hohwille@users.noreply.github.com>
Co-authored-by: Jörg Hohwiller <hohwille@users.noreply.github.com>
Co-authored-by: Jörg Hohwiller <hohwille@users.noreply.github.com>
Co-authored-by: Jörg Hohwiller <hohwille@users.noreply.github.com>
Co-authored-by: Jörg Hohwiller <hohwille@users.noreply.github.com>
Co-authored-by: Jörg Hohwiller <hohwille@users.noreply.github.com>
…java

Co-authored-by: Jörg Hohwiller <hohwille@users.noreply.github.com>
…et.java

Co-authored-by: jan-vcapgemini <59438728+jan-vcapgemini@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

security CVEs or other vulnerabilities

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

CVE: adapt IDEasy to consider security.json files to warn user

4 participants