Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.devonfw.tools.ide.url.tool.cdk;

import com.devonfw.tools.ide.url.updater.NpmBasedUrlUpdater;

/**
* {@link NpmBasedUrlUpdater} for nest.
*/
public class CdkUrlUpdater extends NpmBasedUrlUpdater {

@Override
public String getTool() {
return "cdk";
}

@Override
protected String getPackageName() {
return "aws-cdk";
}

@Override
public String getCpeVendor() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It seems like the cdk:cdk (vendor:product) doesn't exist. I've found this CVE which is related to the aws-cdk-cli tool but mapped to the CPE: cpe:2.3:a:amazon:aws_cloud_development_kit::::::::. I couldn't find any direct match for a cpe. We should discuss if we should leave the two CPE related methods empty.

https://nvd.nist.gov/vuln/detail/CVE-2025-2598

return "cdk";
}

@Override
public String getCpeProduct() {
return "cdk";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import java.time.Instant;
import java.util.List;

import com.devonfw.tools.ide.url.tool.java.JavaAzulUrlUpdater;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -14,6 +12,7 @@
import com.devonfw.tools.ide.url.tool.androidstudio.AndroidStudioUrlUpdater;
import com.devonfw.tools.ide.url.tool.aws.AwsUrlUpdater;
import com.devonfw.tools.ide.url.tool.az.AzureUrlUpdater;
import com.devonfw.tools.ide.url.tool.cdk.CdkUrlUpdater;
import com.devonfw.tools.ide.url.tool.copilot.CopilotUrlUpdater;
import com.devonfw.tools.ide.url.tool.corepack.CorepackUrlUpdater;
import com.devonfw.tools.ide.url.tool.docker.DockerDesktopUrlUpdater;
Expand All @@ -32,6 +31,7 @@
import com.devonfw.tools.ide.url.tool.helm.HelmUrlUpdater;
import com.devonfw.tools.ide.url.tool.intellij.IntellijUrlUpdater;
import com.devonfw.tools.ide.url.tool.jasypt.JasyptUrlUpdater;
import com.devonfw.tools.ide.url.tool.java.JavaAzulUrlUpdater;
import com.devonfw.tools.ide.url.tool.java.JavaUrlUpdater;
import com.devonfw.tools.ide.url.tool.jenkins.JenkinsUrlUpdater;
import com.devonfw.tools.ide.url.tool.jmc.JmcUrlUpdater;
Expand Down Expand Up @@ -69,15 +69,17 @@ public class UpdateManager extends AbstractProcessorWithTimeout {
private final UrlFinalReport urlFinalReport;

private final List<AbstractUrlUpdater> updaters = List.of(
new AndroidStudioUrlUpdater(), new AwsUrlUpdater(), new AzureUrlUpdater(), new CopilotUrlUpdater(), new CorepackUrlUpdater(), new DockerDesktopUrlUpdater(),
new AndroidStudioUrlUpdater(), new AwsUrlUpdater(), new AzureUrlUpdater(), new CdkUrlUpdater(), new CopilotUrlUpdater(), new CorepackUrlUpdater(),
new DockerDesktopUrlUpdater(),
new DotNetUrlUpdater(),
new EclipseCppUrlUpdater(), new EclipseJeeUrlUpdater(), new EclipseJavaUrlUpdater(), new GCloudUrlUpdater(),
new GcViewerUrlUpdater(), new GhUrlUpdater(), new GoUrlUpdater(), new GraalVmCommunityUpdater(), new GraalVmOracleUrlUpdater(),
new GradleUrlUpdater(), new HelmUrlUpdater(), new IntellijUrlUpdater(), new JasyptUrlUpdater(),
new JavaUrlUpdater(), new JavaAzulUrlUpdater(), new JenkinsUrlUpdater(), new JmcUrlUpdater(), new KotlincUrlUpdater(),
new KotlincNativeUrlUpdater(), new LazyDockerUrlUpdater(), new MvnUrlUpdater(),
new NgUrlUpdater(), new NodeUrlUpdater(), new NpmUrlUpdater(), new OcUrlUpdater(), new PgAdminUrlUpdater(), new PipUrlUpdater(), new PycharmUrlUpdater(),
new PythonUrlUpdater(), new QuarkusUrlUpdater(), new RustUrlUpdater(), new DockerRancherDesktopUrlUpdater(), new SonarUrlUpdater(), new SquirrelSqlUrlUpdater(),
new PythonUrlUpdater(), new QuarkusUrlUpdater(), new RustUrlUpdater(), new DockerRancherDesktopUrlUpdater(), new SonarUrlUpdater(),
new SquirrelSqlUrlUpdater(),
new TerraformUrlUpdater(), new TomcatUrlUpdater(), new UvUrlUpdater(), new VsCodeUrlUpdater());

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.devonfw.tools.ide.url.tool.cdk;

import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo;

/**
* Mock of {@link CdkUrlUpdater} to allow integration testing with wiremock.
*/
public class CdkUrlUpdaterMock extends CdkUrlUpdater {

private final String baseUrl;

CdkUrlUpdaterMock(WireMockRuntimeInfo wireMockRuntimeInfo) {
super();
this.baseUrl = wireMockRuntimeInfo.getHttpBaseUrl() + "/";
}

@Override
protected String getDownloadBaseUrl() {

return this.baseUrl;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package com.devonfw.tools.ide.url.tool.cdk;

import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.any;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;

import java.io.IOException;
import java.nio.file.Path;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;

import com.devonfw.tools.ide.url.model.folder.UrlRepository;
import com.devonfw.tools.ide.url.updater.AbstractUrlUpdaterTest;
import com.devonfw.tools.ide.url.updater.JsonUrlUpdater;
import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo;
import com.github.tomakehurst.wiremock.junit5.WireMockTest;


/**
* Test of {@link CdkUrlUpdater}
*/
@WireMockTest
class CdkUrlUpdaterTest extends AbstractUrlUpdaterTest {

/**
* Test of {@link JsonUrlUpdater} for the creation of {@link CdkUrlUpdater} download URLs and checksums.
*
* @param tempDir Path to a temporary directory
* @param wmRuntimeInfo the {@link WireMockRuntimeInfo}.
* @throws IOException test fails
*/
@Test
void testCdkJsonUrlUpdaterCreatesDownloadUrlsAndChecksums(@TempDir Path tempDir, WireMockRuntimeInfo wmRuntimeInfo) throws IOException {

// arrange
stubFor(get(urlMatching("/aws-cdk")).willReturn(
aResponse().withStatus(200).withBody(getJsonBody(wmRuntimeInfo))));

stubFor(any(urlMatching("/aws-cdk/-/aws-cdk-[0-9.].*.tgz")).willReturn(aResponse().withStatus(200).withBody(DOWNLOAD_CONTENT)));

UrlRepository urlRepository = UrlRepository.load(tempDir);
CdkUrlUpdaterMock updater = new CdkUrlUpdaterMock(wmRuntimeInfo);

// act
updater.update(urlRepository);

// assert
assertUrlVersionAgnostic(tempDir.resolve("cdk").resolve("cdk").resolve("2.1120.0"));
}

private static String getJsonBody(WireMockRuntimeInfo wmRuntimeInfo) throws IOException {
return readAndResolve(PATH_INTEGRATION_TEST.resolve("CdkUrlUpdater").resolve("cdk-version.json"), wmRuntimeInfo);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"versions": {
"2.1120.0": {
"version": "2.1120.0",
"dist": {
"tarball": "${testbaseurl}/aws-cdk/-/aws-cdk-2.1120.0.tgz"
}
}
}
}
Loading