diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 74747d3fe15..f64a14137d4 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,3 +1,3 @@ # From https://github.com/microsoft/vscode-dev-containers/blob/master/containers/go/.devcontainer/Dockerfile -ARG VARIANT="17-jdk-bookworm" +ARG VARIANT="21-jdk-bookworm" FROM mcr.microsoft.com/vscode/devcontainers/java:${VARIANT} diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index d167be89720..d9a309d3661 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -5,7 +5,7 @@ "dockerfile": "Dockerfile", "args": { // Update the VARIANT arg to pick a version of Java - "VARIANT": "17-jdk-bookworm", + "VARIANT": "21-jdk-bookworm", } }, "containerEnv": { diff --git a/.github/workflows/docker-image-publish.yml b/.github/workflows/docker-image-publish.yml index 63d1961388d..4249a8370a9 100644 --- a/.github/workflows/docker-image-publish.yml +++ b/.github/workflows/docker-image-publish.yml @@ -19,7 +19,7 @@ jobs: packages: write strategy: matrix: - java: [ 17 ] + java: [ 21 ] dockerfile-path: [Dockerfile, extra/Dockerfile] include: - dockerfile-path: Dockerfile diff --git a/.github/workflows/pr-functional-tests.yml b/.github/workflows/pr-functional-tests.yml index 610c6693193..e3ac3ffcd10 100644 --- a/.github/workflows/pr-functional-tests.yml +++ b/.github/workflows/pr-functional-tests.yml @@ -17,7 +17,7 @@ jobs: strategy: matrix: - java: [ 17 ] + java: [ 21 ] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/pr-java-ci.yml b/.github/workflows/pr-java-ci.yml index 79a904c3636..3ead6423d9f 100644 --- a/.github/workflows/pr-java-ci.yml +++ b/.github/workflows/pr-java-ci.yml @@ -17,7 +17,7 @@ jobs: strategy: matrix: - java: [ 17 ] + java: [ 21 ] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/pr-module-functional-tests.yml b/.github/workflows/pr-module-functional-tests.yml index d8f1e925a07..d87fbe4857a 100644 --- a/.github/workflows/pr-module-functional-tests.yml +++ b/.github/workflows/pr-module-functional-tests.yml @@ -17,7 +17,7 @@ jobs: strategy: matrix: - java: [ 17 ] + java: [ 21 ] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/release-asset-publish.yml b/.github/workflows/release-asset-publish.yml index 1de13751c3a..fb1057d8ee8 100644 --- a/.github/workflows/release-asset-publish.yml +++ b/.github/workflows/release-asset-publish.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: [ 17 ] + java: [ 21 ] steps: - uses: actions/checkout@v4 - name: Set up JDK diff --git a/Dockerfile b/Dockerfile index d69d5346506..b1fab501fa9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM amazoncorretto:17 +FROM amazoncorretto:21 WORKDIR /app/prebid-server diff --git a/Dockerfile-modules b/Dockerfile-modules index a9cbfe71b31..d3338d2c376 100644 --- a/Dockerfile-modules +++ b/Dockerfile-modules @@ -1,4 +1,4 @@ -FROM amazoncorretto:17 +FROM amazoncorretto:21 WORKDIR /app/prebid-server diff --git a/extra/bundle/pom.xml b/extra/bundle/pom.xml index 30748f5061f..2c66f1b22f2 100644 --- a/extra/bundle/pom.xml +++ b/extra/bundle/pom.xml @@ -17,7 +17,7 @@ UTF-8 UTF-8 - 17 + 21 ${java.version} ${java.version} 2.5.6 diff --git a/extra/modules/pom.xml b/extra/modules/pom.xml index 6a0d60bc391..0d442c3d4ef 100644 --- a/extra/modules/pom.xml +++ b/extra/modules/pom.xml @@ -25,7 +25,7 @@ UTF-8 UTF-8 - 17 + 21 ${java.version} ${java.version} @@ -34,7 +34,7 @@ 4.13.2 4.7.0 - 3.10.1 + 3.11.0 2.22.2 diff --git a/extra/pom.xml b/extra/pom.xml index 0afb89a0b85..7b8a60f2108 100644 --- a/extra/pom.xml +++ b/extra/pom.xml @@ -17,8 +17,8 @@ UTF-8 UTF-8 - 17 - 17 + 21 + 21 4.5.5 1.18.30 3.0.0-M6 diff --git a/pom.xml b/pom.xml index 638bf87e9f5..753fd5f064b 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ UTF-8 UTF-8 - 17 + 21 ${java.version} ${java.version} Dockerfile @@ -64,7 +64,7 @@ 5.4.0 2.2.220 2.4-M2-groovy-4.0 - 3.0.14 + 4.0.15 1.17.4 5.14.0 1.9.9.1 @@ -76,11 +76,11 @@ 1.2.0 0.8.11 2.2.4 - 3.10.1 + 3.11.0 2.22.2 ${maven-surefire-plugin.version} 0.40.2 - 1.13.1 + 3.0.2 false true false @@ -523,15 +523,21 @@ spock-core ${spock.version} test + + + org.apache.groovy + groovy + + - org.codehaus.groovy + org.apache.groovy groovy ${groovy.version} test - org.codehaus.groovy + org.apache.groovy groovy-yaml ${groovy.version} test @@ -949,8 +955,8 @@ org.apache.maven.plugins maven-compiler-plugin - 17 - 17 + 21 + 21 diff --git a/src/main/java/org/prebid/server/bidder/adot/AdotBidder.java b/src/main/java/org/prebid/server/bidder/adot/AdotBidder.java index 54b8cf8cf12..1c406402069 100644 --- a/src/main/java/org/prebid/server/bidder/adot/AdotBidder.java +++ b/src/main/java/org/prebid/server/bidder/adot/AdotBidder.java @@ -39,7 +39,7 @@ public class AdotBidder implements Bidder { private static final List ALLOWED_BID_TYPES = Arrays.asList(BidType.banner, BidType.video, BidType.xNative); private static final String PRICE_MACRO = "${AUCTION_PRICE}"; - private static final String PUBLISHER_MACRO = "{PUBLISHER_PATH}"; + private static final String PUBLISHER_MACRO = "{{PUBLISHER_PATH}}"; private static final TypeReference> ADOT_EXT_TYPE_REFERENCE = new TypeReference<>() { }; diff --git a/src/main/java/org/prebid/server/bidder/algorix/AlgorixBidder.java b/src/main/java/org/prebid/server/bidder/algorix/AlgorixBidder.java index 43549c101e8..0ddf5827f9a 100644 --- a/src/main/java/org/prebid/server/bidder/algorix/AlgorixBidder.java +++ b/src/main/java/org/prebid/server/bidder/algorix/AlgorixBidder.java @@ -46,9 +46,9 @@ public class AlgorixBidder implements Bidder { new TypeReference<>() { }; - private static final String URL_REGION_MACRO = "{HOST}"; - private static final String URL_SID_MACRO = "{SID}"; - private static final String URL_TOKEN_MACRO = "{TOKEN}"; + private static final String URL_REGION_MACRO = "{{HOST}}"; + private static final String URL_SID_MACRO = "{{SID}}"; + private static final String URL_TOKEN_MACRO = "{{TOKEN}}"; private static final int FIRST_INDEX = 0; diff --git a/src/main/java/org/prebid/server/util/HttpUtil.java b/src/main/java/org/prebid/server/util/HttpUtil.java index 005230166e7..9a21fcc0681 100644 --- a/src/main/java/org/prebid/server/util/HttpUtil.java +++ b/src/main/java/org/prebid/server/util/HttpUtil.java @@ -74,6 +74,8 @@ public final class HttpUtil { public static final CharSequence SEC_CH_UA = HttpHeaders.createOptimized("Sec-CH-UA"); public static final CharSequence SEC_CH_UA_MOBILE = HttpHeaders.createOptimized("Sec-CH-UA-Mobile"); public static final CharSequence SEC_CH_UA_PLATFORM = HttpHeaders.createOptimized("Sec-CH-UA-Platform"); + public static final String MACROS_OPEN = "{{"; + public static final String MACROS_CLOSE = "}}"; private HttpUtil() { } @@ -82,6 +84,10 @@ private HttpUtil() { * Checks the input string for using as URL. */ public static String validateUrl(String url) { + if (containsMacrosses(url)) { + return url; + } + try { return new URL(url).toString(); } catch (MalformedURLException e) { @@ -89,6 +95,11 @@ public static String validateUrl(String url) { } } + // TODO: We need our own way to work with url macrosses + private static boolean containsMacrosses(String url) { + return StringUtils.contains(url, MACROS_OPEN) && StringUtils.contains(url, MACROS_CLOSE); + } + /** * Returns encoded URL for the given value. *

diff --git a/src/main/resources/bidder-config/adot.yaml b/src/main/resources/bidder-config/adot.yaml index 91a975e521f..fa4a5a5f489 100644 --- a/src/main/resources/bidder-config/adot.yaml +++ b/src/main/resources/bidder-config/adot.yaml @@ -1,6 +1,6 @@ adapters: adot: - endpoint: https://dsp.adotmob.com/headerbidding{PUBLISHER_PATH}/bidrequest + endpoint: https://dsp.adotmob.com/headerbidding{{PUBLISHER_PATH}}/bidrequest meta-info: maintainer-email: admin@we-are-adot.com app-media-types: diff --git a/src/main/resources/bidder-config/algorix.yaml b/src/main/resources/bidder-config/algorix.yaml index 70c56825fdd..f76db6420ce 100644 --- a/src/main/resources/bidder-config/algorix.yaml +++ b/src/main/resources/bidder-config/algorix.yaml @@ -1,6 +1,6 @@ adapters: algorix: - endpoint: https://{HOST}.svr-algorix.com/rtb/sa?sid={SID}&token={TOKEN} + endpoint: https://{{HOST}}.svr-algorix.com/rtb/sa?sid={{SID}}&token={{TOKEN}} meta-info: maintainer-email: prebid@algorix.co app-media-types: diff --git a/src/test/java/org/prebid/server/bidder/HttpBidderRequesterTest.java b/src/test/java/org/prebid/server/bidder/HttpBidderRequesterTest.java index 6a7aeeb25bd..35bd07a6881 100644 --- a/src/test/java/org/prebid/server/bidder/HttpBidderRequesterTest.java +++ b/src/test/java/org/prebid/server/bidder/HttpBidderRequesterTest.java @@ -48,7 +48,6 @@ import java.time.ZoneId; import java.util.Arrays; import java.util.List; -import java.util.Map; import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.UnaryOperator; @@ -359,10 +358,9 @@ public void shouldReturnBidsCreatedByMakeBids() { // given givenSuccessfulBidderMakeHttpRequests(); - final List bids = asList( - BidderBid.of(Bid.builder().impid("1").build(), null, null), - BidderBid.of(Bid.builder().impid("2").build(), null, null)); - given(bidder.makeBids(any(), any())).willReturn(Result.of(bids, emptyList())); + final List bids = emptyList(); + given(bidder.makeBidderResponse(any(), any())) + .willReturn(CompositeBidderResponse.withBids(bids, null)); final BidderRequest bidderRequest = BidderRequest.builder() .bidder("bidder") @@ -383,8 +381,6 @@ public void shouldReturnBidsCreatedByMakeBids() { .result(); // then - verify(bidder, times(1)).makeBids(any(), any()); - verify(bidder, times(1)).makeBidderResponse(any(), any()); assertThat(bidderSeatBid.getBids()).hasSameElementsAs(bids); } @@ -727,20 +723,23 @@ public void shouldReturnRecordBidRejections() throws JsonProcessingException { } @Test - public void shouldNotReturnSensitiveHeadersInFullDebugInfo() { + public void shouldNotReturnSensitiveHeadersInFullDebugInfo() + throws JsonProcessingException { // given final MultiMap headers = MultiMap.caseInsensitiveMultiMap(); headers.add("headerKey", "headerValue"); headers.add("Authorization", "authorizationValue"); + final BidRequest givenBidRequest = givenBidRequest(identity()); + final byte[] requestBody = mapper.writeValueAsBytes(givenBidRequest); given(bidder.makeHttpRequests(any())).willReturn(Result.of(singletonList( givenSimpleHttpRequest(httpRequestBuilder -> httpRequestBuilder .uri("uri1") - .headers(headers))), + .headers(headers) + .payload(givenBidRequest) + .body(requestBody))), emptyList())); - given(requestEnricher.enrichHeaders(anyString(), any(), any(), any(), any())).willReturn(headers); - givenHttpClientReturnsResponses( - HttpClientResponse.of(200, null, "responseBody1")); + given(requestEnricher.enrichHeaders(anyString(), any(), any(), any(), any())).willReturn(headers); final BidderRequest bidderRequest = BidderRequest.builder() .bidder("bidder") @@ -749,12 +748,11 @@ public void shouldNotReturnSensitiveHeadersInFullDebugInfo() { // when final BidderSeatBid bidderSeatBid = - target - .requestBids( + target.requestBids( bidder, bidderRequest, bidRejectionTracker, - timeout, + expiredTimeout, CaseInsensitiveMultiMap.empty(), bidderAliases, true) @@ -763,8 +761,7 @@ public void shouldNotReturnSensitiveHeadersInFullDebugInfo() { // then assertThat(bidderSeatBid.getHttpCalls()) .extracting(ExtHttpCall::getRequestheaders) - .flatExtracting(Map::keySet) - .containsExactly("headerKey"); + .containsExactly(singletonMap("headerKey", singletonList("headerValue"))); } @Test diff --git a/src/test/java/org/prebid/server/bidder/adot/AdotBidderTest.java b/src/test/java/org/prebid/server/bidder/adot/AdotBidderTest.java index fb05f8387c9..fea318e7022 100644 --- a/src/test/java/org/prebid/server/bidder/adot/AdotBidderTest.java +++ b/src/test/java/org/prebid/server/bidder/adot/AdotBidderTest.java @@ -37,7 +37,7 @@ public class AdotBidderTest extends VertxTest { - private static final String ENDPOINT_URL = "https://test.endpoint{PUBLISHER_PATH}.com"; + private static final String ENDPOINT_URL = "https://test.endpoint{{PUBLISHER_PATH}}.com"; private final AdotBidder target = new AdotBidder(ENDPOINT_URL, jacksonMapper); diff --git a/src/test/java/org/prebid/server/bidder/algorix/AlgorixBidderTest.java b/src/test/java/org/prebid/server/bidder/algorix/AlgorixBidderTest.java index 3ffe4ba86ff..72748cc8d35 100644 --- a/src/test/java/org/prebid/server/bidder/algorix/AlgorixBidderTest.java +++ b/src/test/java/org/prebid/server/bidder/algorix/AlgorixBidderTest.java @@ -42,7 +42,7 @@ */ public class AlgorixBidderTest extends VertxTest { - private static final String ENDPOINT_URL = "https://{HOST}.svr-algorix.com/rtb/sa?sid={SID}&token={TOKEN}"; + private static final String ENDPOINT_URL = "https://{{HOST}}.svr-algorix.com/rtb/sa?sid={{SID}}&token={{TOKEN}}"; private final AlgorixBidder target = new AlgorixBidder(ENDPOINT_URL, jacksonMapper);