Skip to content

Commit d5f656b

Browse files
committed
Merge branch 'refs/heads/support-gpp-usnat-v2' into functional-tests/support-gpp-usnat-v2
# Conflicts: # src/test/groovy/org/prebid/server/functional/tests/privacy/GppCookieSyncSpec.groovy # src/test/groovy/org/prebid/server/functional/tests/privacy/GppSyncUserActivitiesSpec.groovy # src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitUfpdActivitiesSpec.groovy # src/test/groovy/org/prebid/server/functional/util/privacy/gpp/GppConsent.groovy # src/test/groovy/org/prebid/server/functional/util/privacy/gpp/UsUtV1Consent.groovy # src/test/groovy/org/prebid/server/functional/util/privacy/gpp/UsVaV1Consent.groovy # src/test/groovy/org/prebid/server/functional/util/privacy/gpp/v1/UsCaV1Consent.groovy # src/test/groovy/org/prebid/server/functional/util/privacy/gpp/v1/UsCoV1Consent.groovy # src/test/groovy/org/prebid/server/functional/util/privacy/gpp/v1/UsCtV1Consent.groovy # src/test/groovy/org/prebid/server/functional/util/privacy/gpp/v1/UsNatV1Consent.groovy
2 parents a1e5e05 + aa654a3 commit d5f656b

File tree

2,259 files changed

+93841
-12468
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,259 files changed

+93841
-12468
lines changed

.github/workflows/pr-java-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- uses: actions/checkout@v4
2424

2525
- name: Set up JDK
26-
uses: actions/setup-java@v3
26+
uses: actions/setup-java@v4
2727
with:
2828
distribution: 'temurin'
2929
cache: 'maven'

.github/workflows/scripts/codepath-notification

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,10 @@
1717
# The aim is to find a minimal set of regex patterns that matches any file in these paths
1818

1919
/ix|Ix|ix.json|ix.yaml: [email protected]
20+
appnexus|Appnexus: [email protected]
21+
pubmatic|Pubmatic: [email protected]
22+
openx|OpenX: [email protected]
23+
medianet|Medianet: [email protected]
24+
thetradedesk|TheTradeDesk: [email protected]
25+
gumgum|GumGum: [email protected]
26+
kargo|Kargo: [email protected]

.mvn/wrapper/maven-wrapper.jar

-58.5 KB
Binary file not shown.

.mvn/wrapper/maven-wrapper.properties

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66
# "License"); you may not use this file except in compliance
77
# with the License. You may obtain a copy of the License at
88
#
9-
# https://www.apache.org/licenses/LICENSE-2.0
9+
# http://www.apache.org/licenses/LICENSE-2.0
1010
#
1111
# Unless required by applicable law or agreed to in writing,
1212
# software distributed under the License is distributed on an
1313
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1414
# KIND, either express or implied. See the License for the
1515
# specific language governing permissions and limitations
1616
# under the License.
17-
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip
18-
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
17+
wrapperVersion=3.3.2
18+
distributionType=only-script
19+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM amazoncorretto:21
1+
FROM amazoncorretto:21.0.8-al2023
22

33
WORKDIR /app/prebid-server
44

Dockerfile-modules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM amazoncorretto:21
1+
FROM amazoncorretto:21.0.8-al2023
22

33
WORKDIR /app/prebid-server
44

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Follow next steps to create JAR file which can be deployed locally.
4242

4343
- Install prerequsites
4444
- Java SDK: Oracle's or Corretto. Let us know if there's a distribution PBS-Java doesn't work with.
45+
- Java SDK Version: 21
4546
- Maven
4647

4748
- Clone the project:

docs/application-settings.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ There are two ways to configure application settings: database and file. This do
1212
- `auction.truncate-target-attr` - Maximum targeting attributes size. Values between 1 and 255.
1313
- `auction.default-integration` - Default integration to assume.
1414
- `auction.debug-allow` - enables debug output in the auction response. Default `true`.
15+
- `auction.impression-limit` - a max number of impressions allowed for the auction, impressions that exceed this limit will be dropped, 0 means no limit.
1516
- `auction.bid-validations.banner-creative-max-size` - Overrides creative max size validation for banners. Valid values
1617
are:
1718
- "skip": don't do anything about creative max size for this publisher
@@ -25,6 +26,11 @@ There are two ways to configure application settings: database and file. This do
2526
- `auction.bidadjustments.mediatype.*.*.*[].value` - value of the bid adjustment
2627
- `auction.bidadjustments.mediatype.*.*.*[].currency` - currency of the bid adjustment
2728
- `auction.events.enabled` - enables events for account if true
29+
- `auction.bid-rounding` - bid rounding options are:
30+
- **down** - rounding down to the lower price bucket
31+
- **up** - rounding up to the higher price bucket
32+
- **timesplit** - 50% of the time rounding down to the lower PB and 50% of the time rounding up to the higher price bucket
33+
- **true** - if the price >= 50% of the range, rounding up to the higher price bucket, otherwise rounding down
2834
- `auction.price-floors.enabled` - enables price floors for account if true. Defaults to true.
2935
- `auction.price-floors.fetch.enabled`- enables data fetch for price floors for account if true. Defaults to false.
3036
- `auction.price-floors.fetch.url` - url to fetch price floors data from.
@@ -50,6 +56,7 @@ Keep in mind following restrictions:
5056
- `auction.preferredmediatype.<bidder>.<media-type>` - <media-type> that will be left for <bidder> that doesn't support multi-format. Other media types will be removed. Acceptable values: `banner`, `video`, `audio`, `native`.
5157
- `auction.privacysandbox.cookiedeprecation.enabled` - boolean that turns on setting and reading of the Chrome Privacy Sandbox testing label header. Defaults to false.
5258
- `auction.privacysandbox.cookiedeprecation.ttlsec` - if the above setting is true, how long to set the receive-cookie-deprecation cookie's expiration
59+
- `auction.cache.enabled` - enables bids caching for account if true. Defaults to true.
5360
- `privacy.gdpr.enabled` - enables gdpr verifications if true. Has higher priority than configuration in
5461
application.yaml.
5562
- `privacy.gdpr.eea-countries` - overrides the host-level list of 2-letter country codes where TCF processing is applied
@@ -277,8 +284,8 @@ The general idea is that you'll place all the account-specific settings in a sep
277284
```yaml
278285
settings:
279286
s3:
280-
accessKeyId: <S3 access key>
281-
secretAccessKey: <S3 access key>
287+
accessKeyId: <S3 access key> # optional
288+
secretAccessKey: <S3 access key> #optional
282289
endpoint: <endpoint> # http://s3.storage.com
283290
bucket: <bucket name> # prebid-application-settings
284291
region: <region name> # if not provided AWS_GLOBAL will be used. Example value: 'eu-central-1'
@@ -298,6 +305,14 @@ settings:
298305
timeout: 5000
299306
```
300307
308+
If `accessKeyId` and `secretAccessKey` are not specified in the Prebid Server configuration then AWS credentials will be looked up in this order:
309+
- Java System Properties - `aws.accessKeyId` and `aws.secretAccessKey`
310+
- Environment Variables - `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`
311+
- Web Identity Token credentials from system properties or environment variables
312+
- Credential profiles file at the default location (`~/.aws/credentials`) shared by all AWS SDKs and the AWS CLI
313+
- Credentials delivered through the Amazon EC2 container service if "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI" environment variable is set and security manager has permission to access the variable,
314+
- Instance profile credentials delivered through the Amazon EC2 metadata service
315+
301316
### File format
302317

303318
We recommend using the `json` format for your account configuration. A minimal configuration may look like this.

docs/config-app.md

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ This section can be extended against standard [Spring configuration](https://doc
1414
This parameter exists to allow to change the location of the directory Vert.x will create because it will and there is no way to make it not.
1515
- `vertx.init-timeout-ms` - time to wait for asynchronous initialization steps completion before considering them stuck. When exceeded - exception is thrown and Prebid Server stops.
1616
- `vertx.enable-per-client-endpoint-metrics` - enables HTTP client metrics per destination endpoint (`host:port`)
17+
- `vertx.round-robin-inet-address` - enables round-robin inet address selection of the ip address to use
1718

1819
## Server
1920
- `server.max-headers-size` - set the maximum length of all headers.
@@ -96,6 +97,7 @@ Removes and downloads file again if depending service cant process probably corr
9697
- `auction.cache.expected-request-time-ms` - approximate value in milliseconds for Cache Service interacting.
9798
- `auction.cache.only-winning-bids` - if equals to `true` only the winning bids would be cached. Has lower priority than request-specific flags.
9899
- `auction.generate-bid-id` - whether to generate seatbid[].bid[].ext.prebid.bidid in the OpenRTB response.
100+
- `auction.enforce-random-bid-id` - whether to enforce generating a robust random seatbid[].bid[].id in the OpenRTB response if the initial value is less than 17 characters.
99101
- `auction.validations.banner-creative-max-size` - enables creative max size validation for banners. Possible values: `skip`, `enforce`, `warn`. Default is `skip`.
100102
- `auction.validations.secure-markup` - enables secure markup validation. Possible values: `skip`, `enforce`, `warn`. Default is `skip`.
101103
- `auction.host-schain-node` - defines global schain node that will be appended to `request.source.ext.schain.nodes` passed to bidders
@@ -283,8 +285,12 @@ For `JVM` metrics
283285
- `cache.scheme` - set the external Cache Service protocol: `http`, `https`, etc.
284286
- `cache.host` - set the external Cache Service destination in format `host:port`.
285287
- `cache.path` - set the external Cache Service path, for example `/cache`.
288+
- `cache.internal.scheme` - set the internal Cache Service protocol: `http`, `https`, etc., the internal scheme get priority over the external one when provided.
289+
- `cache.internal.host` - set the internal Cache Service destination in format `host:port`, the internal port get priority over the external one when provided.
290+
- `cache.internal.path` - set the internal Cache Service path, for example `/cache`, the internal path get priority over the external one when provided.
286291
- `storage.pbc.enabled` - If set to true, this will allow storing modules’ data in third-party storage.
287292
- `storage.pbc.path` - set the external Cache Service path for module caching, for example `/pbc-storage`.
293+
- `cache.api-key-secured` - if set to `true`, will cause Prebid Server to add a special API key header to Prebid Cache requests.
288294
- `pbc.api.key` - set the external Cache Service api key for secured calls.
289295
- `cache.query` - appends to the cache path as query string params (used for legacy Auction requests).
290296
- `cache.banner-ttl-seconds` - how long (in seconds) banner will be available via the external Cache Service.
@@ -294,6 +300,7 @@ for particular publisher account. Overrides `cache.banner-ttl-seconds` property.
294300
- `cache.account.<ACCOUNT>.video-ttl-seconds` - how long (in seconds) video creative will be available in Cache Service
295301
for particular publisher account. Overrides `cache.video-ttl-seconds` property.
296302
- `cache.default-ttl-seconds.{banner, video, audio, native}` - a default value how long (in seconds) a creative of the specific type will be available in Cache Service
303+
- `cache.append-trace-info-to-cache-id` - if set to `true`, causes the addition account ID and datacenter to cache UUID: _ACCOUNT-DATACENTER-remainderOfUUID_. Implies that cache UUID will be generated by the Prebid Server.
297304

298305
## Application settings (account configuration, stored ad unit configurations, stored requests)
299306
Preconfigured application settings can be obtained from multiple data sources consequently:
@@ -303,6 +310,10 @@ Preconfigured application settings can be obtained from multiple data sources co
303310

304311
Warning! Application will not start in case of no one data source is defined and you'll get an exception in logs.
305312

313+
For requests validation mode available next options:
314+
- `settings.fail-on-unknown-bidders` - fail with validation error or just make warning for unknown bidders.
315+
- `settings.fail-on-disabled-bidders` - fail with validation error or just make warning for disabled bidders.
316+
306317
For filesystem data source available next options:
307318
- `settings.filesystem.settings-filename` - location of file settings.
308319
- `settings.filesystem.stored-requests-dir` - directory with stored requests.
@@ -335,9 +346,10 @@ For HTTP data source available next options:
335346
- `settings.http.amp-endpoint` - the url to fetch AMP stored requests.
336347
- `settings.http.video-endpoint` - the url to fetch video stored requests.
337348
- `settings.http.category-endpoint` - the url to fetch categories for long form video.
349+
- `settings.http.rfc3986-compatible` - if equals to `true` the url will be build according to RFC 3986, `false` by default
338350

339351
For account processing rules available next options:
340-
- `settings.enforce-valid-account` - if equals to `true` then request without account id will be rejected with 401.
352+
- `settings.enforce-valid-account` - if equals to `true` then request without account id will be rejection with 401.
341353
- `settings.generate-storedrequest-bidrequest-id` - overrides `bidrequest.id` in amp or app stored request with generated UUID if true. Default value is false. This flag can be overridden by setting `bidrequest.id` as `{{UUID}}` placeholder directly in stored request.
342354

343355
It is possible to specify default account configuration values that will be assumed if account config have them
@@ -384,8 +396,8 @@ contain 'WHERE last_updated > ?' for MySQL and 'WHERE last_updated > $1' for Pos
384396

385397
For S3 storage configuration
386398
- `settings.in-memory-cache.s3-update.refresh-rate` - refresh period in ms for stored request updates in S3
387-
- `settings.s3.access-key-id` - an access key
388-
- `settings.s3.secret-access-key` - a secret access key
399+
- `settings.s3.access-key-id` - an access key (optional)
400+
- `settings.s3.secret-access-key` - a secret access key (optional)
389401
- `settings.s3.region` - a region, AWS_GLOBAL by default
390402
- `settings.s3.endpoint` - an endpoint
391403
- `settings.s3.bucket` - a bucket name
@@ -395,6 +407,15 @@ For S3 storage configuration
395407
- `settings.s3.stored-requests-dir` - a directory with stored requests
396408
- `settings.s3.stored-responses-dir` - a directory with stored responses
397409

410+
If `settings.s3.access-key-id` and `settings.s3.secret-access-key` are not specified in the Prebid Server configuration then AWS credentials will be looked up in this order:
411+
- Java System Properties - `aws.accessKeyId` and `aws.secretAccessKey`
412+
- Environment Variables - `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`
413+
- Web Identity Token credentials from system properties or environment variables
414+
- Credential profiles file at the default location (`~/.aws/credentials`) shared by all AWS SDKs and the AWS CLI
415+
- Credentials delivered through the Amazon EC2 container service if "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI" environment variable is set and security manager has permission to access the variable,
416+
- Instance profile credentials delivered through the Amazon EC2 metadata service
417+
418+
398419
For targeting available next options:
399420
- `settings.targeting.truncate-attr-chars` - set the max length for names of targeting keywords (0 means no truncation).
400421

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Porting Guide
2+
3+
## Overview
4+
5+
First, thank you for taking on the migration of an adapter from Go to Java. But really the best way to think of it is not as straight port. Instead, we recommend treat this task as a re-implementation. It will take a few adapters before you fully get the hang of it, and that's okay—everyone goes through a learning curve.
6+
7+
Keep in mind that the PBS-Go team is more lenient about what they allow in adapters compared to the PBS-Java team.
8+
9+
## Pull Request Requirements
10+
11+
We would appreciate it if your porting PR title follows these patterns:
12+
13+
- `Port <adapter_name>: New Adapter` – For porting a completely new adapter to the project (e.g., `Port Kobler: New Adapter`).
14+
- `Port <adapter_name>: <update_description>` – For porting a specific update to an existing adapter (e.g., `Port OpenX: Native Support`).
15+
- `Port <alias_name>: New alias for <adapter_name>` – For porting an alias of an existing adapter to the project (e.g., `Port Artechnology: New alias of StartHub`).
16+
17+
Additionally, we kindly ask that you:
18+
19+
- Link any existing GitHub issues that your PR resolves. This ensures the issue will be automatically closed when your PR is merged.
20+
- Add the label `do not port` to your PR.
21+
22+
## Porting Requirements
23+
24+
1. **Feature Parity**: A Java adapter should have the same functionality as the Go adapter.
25+
2. **Java Adapter Code Should:**
26+
- Follow the code style of the PBS-Java repository (see [the code style page](code-style.md)).
27+
- Be well-written Java code: clear, readable, optimized, and following best practices.
28+
- Maintain a structure similar to existing adapters (see below).
29+
3. **The adapter should be covered with tests:**
30+
- Unit tests for implementation details.
31+
- A simple integration test to ensure the adapter is reachable, can send requests to the bidder, and that its configuration works.
32+
33+
### What does "having a similar structure to existing adapters" mean?
34+
35+
The PBS-Java codebase has evolved over time. While existing adapters may not be perfect and could contain legacy issues (e.g., using outdated Java syntax), they still serve as a valuable reference for learning, inspiration, and even reuse.
36+
37+
Each adapter is unique, but most share common patterns. For example, nearly every adapter includes:
38+
39+
1. **A `makeHttpRequests(...)` method**
40+
- Iterates over the `imps` in the bid request:
41+
- Parses `imp[].ext.prebid.bidder` (i.e., bidder static parameters).
42+
- Modifies the `imp`.
43+
- Collects errors encountered during `imp` processing.
44+
- Prepares outgoing request(s):
45+
- Constructs headers.
46+
- Builds the request URL.
47+
- Modifies the incoming bid request based on the updated `imps`.
48+
49+
2. **A `makeBids(...)` method**
50+
- Parses the `BidResponse`.
51+
- Iterates over `seatBids` and `bids`.
52+
- Creates a list of `BidderBid` objects.
53+
54+
### Ensuring Structural Consistency
55+
56+
To maintain consistency across adapters:
57+
- Fit the Go adapter functionality into the Java adapter structure.
58+
- Use the same or similar method and variable names where applicable.
59+
- Reuse existing solutions for common functionality (e.g., use `BidderUtil`, `HttpUtil` classes).
60+
- Ensure unit tests follow a similar structure, with comparable test cases and code patterns.
61+
62+
## Specific Rules and Tips for Porting
63+
64+
1. Begin by determining how the Go adapter's functionality fits into the Java adapter structure.
65+
2. Go adapters deserialize JSON objects in-place, while Java adapters work with pre-deserialized objects. As a result, many errors thrown in the Go version do not apply in Java.
66+
3. **No hardcoded URLs.** If an adapter has a "test URL," it must be defined in the YAML file. See `org.prebid.server.spring.config.bidder.NextMillenniumConfiguration.NextMillenniumConfigurationProperties` for an example of how to handle special YAML entries.
67+
4. The structure of Go and Java bidder configuration files differs—do not copy and paste directly. Pay attention to details such as macros in the endpoint and redirect/iframe URLs.
68+
5. **Prohibited in bidder adapters:**
69+
- Blocking code.
70+
- Fully dynamic hostnames in URLs.
71+
- Non-thread-safe code (bidder adapters should not store state internally).
72+
6. If an adapter has no special logic, consider using an alias to `Generic` instead. In this case, there will still need to be an integration test for this bidder. e.g. `src/test/java/org/prebid/server/it/BidderNameTest.java`

0 commit comments

Comments
 (0)