Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
d51f0da
New Adapter: SUNT Content (#2420)
sag-celejd Nov 2, 2022
1347dfb
New Adapter: Appush (#2432)
nitzanappush Nov 7, 2022
452ea6f
New Adapter: Clickonometrics (#2410)
mjaworskiccx Nov 7, 2022
9d65c3f
Tappx: Fix bug in regex (#2444)
prebidtappx Nov 8, 2022
eb84f30
Pubmatic: Pass imp.ext.data to SSP (#2417)
pm-isha-bharti Nov 9, 2022
98b7bb4
GDPR: Basic enforcement (#2374)
bsardo Nov 9, 2022
b9bfa31
Declare request wrapper keys as constants (#2443)
guscarreon Nov 14, 2022
afa0e58
IX Adapter: Pass version information in Request.Ext field (#2449)
ccorbo Nov 14, 2022
d912d2a
New Adapter: freewheelssp (#2392)
mwang-sticky Nov 15, 2022
f769c64
Set Site.Publisher.Domain and setSiteImplicitly() Refactoring (#2422)
AlexBVolcy Nov 15, 2022
9af6a8c
Modularity: Basic types and module loading (#2448)
4lexvav Nov 15, 2022
79ae565
Add supply chain support for the yieldlab adapter (#2427)
Mufas61 Nov 17, 2022
563f6c6
Improve Digital adapter: Add deal id and rewardred inventory logic (#…
jbartek25 Nov 17, 2022
f40f0c3
Support MySql driver (#2356)
victorshevtsov Nov 17, 2022
8c5ebdf
IX Adapter: Fix panic when ext.prebid.channel is nil (#2476)
oronno Nov 30, 2022
00f2d13
Adnuntius Bid Adapter: fix order issue (#2457)
mikael-lundin Nov 30, 2022
de6ed82
Upgrade Messages For Legacy Bidder Params Location (#2460)
SyntaxNode Dec 1, 2022
79810b1
Modularity: Hook invocation Process [Entrypoint Stage] (#2462)
legendko Dec 6, 2022
46f8b61
Perform full path host db config lookups in migration to detect prese…
bsardo Dec 14, 2022
459fe58
Modularity: module builders generator (#2491)
4lexvav Dec 14, 2022
ff62d9a
Update OpenRTB 2.6 (#2494)
hhhjort Dec 14, 2022
1b3fa7a
New Adapter: Taboola (#2455)
ahmadlob Dec 14, 2022
5ba7a3e
Update OneTag usersync endpoint (#2430)
onetag-dev Dec 14, 2022
06c118b
adapter sspBC: Update to v5.8 (#2480)
spanwp Dec 14, 2022
491f006
Bidstack Adapter: Added optional Placement ID field (#2464)
valdis-abrams-bidstack Dec 14, 2022
6de5d10
fix extra-bid's multicurrency scenario (#2467)
pm-nilesh-chate Dec 14, 2022
83f4cc7
refactor: move from io/ioutil to io and os packages (#2463)
Juneezee Dec 14, 2022
4c9f779
Modularity: Metrics infrastructure and collection (#2484)
legendko Dec 14, 2022
dd909ba
Modularity: Raw auction stage implementation (#2495)
legendko Dec 19, 2022
bd9c42d
Update to support reading GDPR and US Privacy from GPP string (#2496)
hhhjort Dec 21, 2022
076d889
Modularity: Processed auction request stage implementation (#2497)
legendko Dec 21, 2022
6090897
Modularity: Bidder request stage implementation (#2498)
legendko Jan 4, 2023
588c883
Modularity: Raw bidder response stage implementation (#2499)
legendko Jan 4, 2023
fa50f2e
New Adapter: VideoHeroes (#2399)
videoheroes Jan 4, 2023
860437d
Modularity: All processed bid responses stage implementation (#2500)
legendko Jan 5, 2023
1cd35b4
Rubicon: Support `bidonmultiformat` parameter (#2465)
SerhiiNahornyi Jan 5, 2023
6fe7e3b
Increase test plan builder group timeouts and mockTimeoutHook sleep t…
bsardo Jan 6, 2023
2fbbb9d
Modularity: Auction response stage implementation (#2502)
legendko Jan 6, 2023
6e15ecc
Outbrain adapter: support video
markkuhar Jan 10, 2023
4dc1271
Modularity: Enrich Bid Response with hook execution results (#2516)
4lexvav Jan 11, 2023
bd3f4cc
bliink: bidder parameters added (#2489)
LouisBillaut Jan 11, 2023
da478e3
Bid Response Validation (#2450)
AlexBVolcy Jan 11, 2023
168e971
Improve Digital: adding publisher id as endpoint param (#2485)
jbartek25 Jan 11, 2023
053ec1f
Added GPP support on the yahoospp adapter. (#2503)
radubarbos Jan 11, 2023
82c03b0
Per Impression TID Generation and Source TID Logic Updated (#2412)
ccorbo Jan 12, 2023
669d7bd
VISX: Add string support to UID (#2501)
deubaka Jan 12, 2023
ca53d6c
Openrtb2blocking module part 1: module configuration (#2526)
4lexvav Jan 13, 2023
e6ff80a
Bid Response Validation Test Fix (#2529)
AlexBVolcy Jan 17, 2023
caced15
Account Service Optimisation (#2440)
Pubmatic-Dhruv-Sonone Jan 17, 2023
6315010
Openrtb2blocking module part 2: BidderRequestHook implementation (#2531)
4lexvav Jan 18, 2023
6aab539
FLEDGE server support (#2445)
laurb9 Jan 19, 2023
dac7dde
New Adapter: Definemedia (#2506)
dennisjay Jan 19, 2023
e56c8a3
Fix README Build Tag (#2520)
SyntaxNode Jan 19, 2023
b20fd64
Consumable adapter: add cats and adomain to bids (#2474)
jpiros Jan 19, 2023
09ee9ad
Rename synacormedia adapter to imds to reflect ownership change (#2508)
ecammit Jan 19, 2023
bb2157f
New Adapter: CWire (#2511)
espen-j Jan 19, 2023
5729eb1
Openrtb2blocking module part 3: RawBidderResponse Hook implementation…
legendko Jan 24, 2023
f29682a
E-Planning: Adding support for video auction (#2512)
fndigrazia Jan 24, 2023
e02fc1f
MobileFuse Adapter: add support for native (#2517)
erictmf Jan 25, 2023
4646432
IX Adapter: add test for regs gpp support (#2521)
shahinrahbariasl Jan 25, 2023
097626b
Removed iframe/redirect usersync urls in synacormedia config (#2543)
josecu Jan 26, 2023
06ac44b
AppNexus: Update Maintainer Email (#2537)
SyntaxNode Jan 26, 2023
6ab6ba2
cross-repo workflow (#2548)
bretg Jan 27, 2023
cf87e40
Changed price bucket calculation logic to start increment at bucketMi…
Pubmatic-Dhruv-Sonone Jan 30, 2023
e63f9a1
Address CVE-2022-41721 (#2545)
VeronikaSolovei9 Jan 30, 2023
30c86d4
New Adapter: Brave (#2396)
thebraveio Jan 31, 2023
5737020
Adnuntius Bid Adapter: Bugfix for extra info (#2525)
mikael-lundin Jan 31, 2023
e523594
openx: add FLEDGE support (#2535)
laurb9 Jan 31, 2023
91408f7
Issue tracker fix (#2547)
dgirardi Jan 31, 2023
a52ac8f
Bliink: endpoint set to https (#2553)
LouisBillaut Feb 2, 2023
6636bff
New Adapter: Adsinteractive (#2523)
balintvargha Feb 6, 2023
d762177
New Adapter: KiviAds (#2446)
KiviAds Feb 6, 2023
2dc2790
Rubicon: Replace admobject with adm_native (#2565)
SerhiiNahornyi Feb 6, 2023
5c72184
Global targeting parameters for AMP (#2513)
aidarbek Feb 7, 2023
15119b3
Add hb_deal targeting to video endpoint response (#2549)
shahinrahbariasl Feb 7, 2023
a58b8f5
Initial infrastructure to support bidder openRTB support flags (#2540)
hhhjort Feb 7, 2023
dc5df87
Optionally run Trivy scan check against PR (#2564)
onkarvhanumante Feb 8, 2023
1fce165
New Adapter: Logan (#2510)
WlsLogan Feb 9, 2023
4109b90
Taboola Adapter: support native (#2550)
ahmadlob Feb 13, 2023
543f288
GPP passthrough for cookiesync (#2575)
hhhjort Feb 13, 2023
a4b0ac6
Smaato: add gpp and gpp_sid into json to ensure it is being sent (#2579)
Enigo Feb 15, 2023
a306ee7
AndBeyondMedia Adapter: add userSync (#2546)
AndBeyondMediaHB Feb 15, 2023
0322c05
Refactor Targeting + Price Granularity JSON Unmarshal (#2567)
SyntaxNode Feb 15, 2023
2392780
Criteo : update adapter to send open rtb request (#2576)
vraybaud Feb 16, 2023
4ced5e7
OpenRTB 2.6: Remove 2.6-x Fields (#2577)
SyntaxNode Feb 16, 2023
15601e0
Update nextmillennium.yaml (#2583)
mifanich Feb 21, 2023
c9d63c4
cross-repo workflow update (#2596)
bretg Feb 21, 2023
6a06e75
bump golang.org/x/net from 0.5.0 to 0.7.0 (#2601)
dependabot[bot] Feb 21, 2023
73857bb
Floors: host and account config (#2568)
pm-jaydeep-mohite Feb 21, 2023
d347848
Metrics for deprecated account config fields (#2538)
AlexBVolcy Feb 22, 2023
11a3044
Unruly: Add support for siteId parameter - different casing (#2524)
arielunruly Feb 22, 2023
907facb
New Adapter: VisibleMeasures (#2560)
VisibleMeasuresHB Feb 24, 2023
769d680
New Adapter: Undertone (#2527)
tamarm-perion Feb 27, 2023
d3c7077
Criteo : Add user sync url for criteo (#2595)
vraybaud Feb 27, 2023
4657919
Openx: Pass through imp.ext wholesale except prebid, bidder (#2592)
laurb9 Feb 27, 2023
ed8e81e
add EUC EP for Algorix (#2602)
Bugxyb Feb 27, 2023
89f5210
Default imp.secure To 1 (#2608)
SyntaxNode Feb 27, 2023
1c06774
Taboola Bid Adapter: Support page type and position, Always support e…
thetalkeren Feb 28, 2023
8f265d4
New Adapter: Limelight Digital (#2539)
imedvedko Mar 2, 2023
6b4b3f1
CCX : Add user sync url (#2609)
mjaworskiccx Mar 3, 2023
d9106c1
Change tappx full dinamic endpoint to a parcial dinamic endpoint
TappxJon Mar 6, 2023
ec7cc78
Fix syncer_requests Metric (#2610)
SyntaxNode Mar 6, 2023
9145b07
Appnexus adapter - iab categories initialisation changes (#2619)
onkarvhanumante Mar 7, 2023
b77c77f
Multi-bid support (#2468)
pm-nilesh-chate Mar 7, 2023
aace8fc
AppNexus adapter - move struct to its own file (#2631)
gargcreation1992 Mar 9, 2023
7ac3666
Criteo: add video capability (#2611)
vraybaud Mar 10, 2023
2989b72
IX Bid Adapter: Fix overwriting of bids while building bid response (…
ccorbo Mar 13, 2023
2acd334
New Adapter: Globalsun (#2477)
GlobalsunHB Mar 13, 2023
07cd653
Handle set-output deprecation (#2634)
onkarvhanumante Mar 14, 2023
13207ae
Remove appnexusplatformtest directory.
Sonali-More-Xandr Mar 14, 2023
7cc7983
Appnexus adapter - refactor makeRequest (#2632)
onkarvhanumante Mar 14, 2023
0a9a6f5
Appnexus Adapter - refactor makeBids function (#2638)
gargcreation1992 Mar 14, 2023
a1f48b5
AppNexus adapter - Accept placementId as int or string (#2617)
gargcreation1992 Mar 15, 2023
439c7ed
TLS connection for MySql and Postgres drivers (#2507)
victorshevtsov Mar 16, 2023
60d4a81
Change contact email address (#2633)
thomasdseao Mar 17, 2023
2fb3b7e
Fix for storedauctionresponse bid type (#2615)
VeronikaSolovei9 Mar 20, 2023
68464b8
AppNexus: remove adpodId test cases (#2648)
gargcreation1992 Mar 21, 2023
c54adbc
Between: change a get parameter in userSync url (#2639)
ignat-one Mar 21, 2023
6df3105
Adnuntius Deal Id addition. (#2659)
mikael-lundin Mar 21, 2023
01f586d
Emit warnings on conflicts between openrtb 2.6 pre GPP privacy and GP…
hhhjort Mar 21, 2023
64c5e35
Support GDPR and USPrivacy from GPP downgrade for adapters that do no…
hhhjort Mar 21, 2023
40e69e0
Request Wrapper Usage In HoldAuction - Phase 1 (#2423)
SyntaxNode Mar 27, 2023
c22a61a
Bind TLS and query_string setting to env variables (#2666)
victorshevtsov Mar 27, 2023
943f193
fix undertone adapter user-sync (#2661)
shahaf-undertone Mar 28, 2023
5e9dc13
adtrgtme: add bidder param site_id (#2637)
grakholsky Mar 28, 2023
afbd867
New Adapter: Evolution Technologies (#2653)
imedvedko Mar 29, 2023
6810d84
New Adapter: pwbid (#2657)
Rothalack Apr 3, 2023
a81f4bd
Adserver targeting (#2593)
VeronikaSolovei9 Apr 3, 2023
2e15894
Appnexus: Increase Code Coverage (#2663)
Sonali-More-Xandr Apr 3, 2023
08d644d
Oftmedia: Remove 152Media / OFTMedia alias (#2670)
Sonali-More-Xandr Apr 4, 2023
4dc9d5c
Taboola Bid Adapter: Support insensitive tagId, gvlID as host name (#…
ahmadlob Apr 4, 2023
1c1c872
Appnexus adapter - refactor preprocess function (#2668)
gargcreation1992 Apr 4, 2023
7e390d8
email update (#2675)
jbartek25 Apr 5, 2023
f035f72
Modularity: per request module contexts and stage outcomes (#2677)
pm-nilesh-chate Apr 6, 2023
8282d94
Test to check expected BidResponse fields are present (#2680)
VeronikaSolovei9 Apr 6, 2023
7d3371c
AppNexus Adapter: handle rand.Int63 (#2679)
gargcreation1992 Apr 10, 2023
8da6f69
Update adyoulike.yaml (#2684)
SimonTvnt Apr 10, 2023
0087620
FPD for amp endpoint (#2672)
VeronikaSolovei9 Apr 10, 2023
4cb42fc
Rubicon: Initial ORTB 2.6 support (#2536)
CTMBNara Apr 10, 2023
8937049
Merge branch 'master' into master
prebidtappx Apr 11, 2023
5e0cc77
Update tappx.go
prebidtappx Apr 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
28 changes: 28 additions & 0 deletions .github/workflows/cross-repo-issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Cross-repo Issue Creation

on:
pull_request_target:
types: [closed]
branches:
- "master"

jobs:
cross-repo:
runs-on: ubuntu-latest
steps:
- name: Generate token
id: generate_token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.XREPO_APP_ID }}
private_key: ${{ secrets.XREPO_PEM }}
- name: create issue in other repo
if: "!contains(github.event.pull_request.labels.*.name, 'do not port') && github.event.pull_request.merged"
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
run: |
echo -e "A PR was merged over on PBS-Go\n\n- [https://github.com/prebid/prebid-server/pull/${{github.event.number}}](https://github.com/prebid/prebid-server/pull/${{github.event.number}})\n- timestamp: ${{ github.event.pull_request.merged_at}}" > msg
export msg=$(cat msg)
gh issue create --repo prebid/prebid-server-java --title "Port PR from PBS-Go: ${{ github.event.pull_request.title }}" \
--body "$msg" \
--label auto
41 changes: 26 additions & 15 deletions .github/workflows/issue_prioritization.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,30 @@ jobs:
gh api graphql -f query='
query($org: String!, $number: Int!) {
organization(login: $org){
projectNext(number: $number) {
projectV2(number: $number) {
id
fields(first:100) {
nodes {
id
name
settings
... on ProjectV2Field {
id
name
}
... on ProjectV2SingleSelectField {
id
name
options {
id
name
}
}
}
}
}
}
}' -f org=$ORGANIZATION -F number=$PROJECT_NUMBER > project_data.json

echo 'PROJECT_ID='$(jq '.data.organization.projectNext.id' project_data.json) >> $GITHUB_ENV
echo 'DATE_FIELD_ID='$(jq '.data.organization.projectNext.fields.nodes[] | select(.name== "'"$DATE_FIELD"'") | .id' project_data.json) >> $GITHUB_ENV
echo 'PROJECT_ID='$(jq '.data.organization.projectV2.id' project_data.json) >> $GITHUB_ENV
echo 'DATE_FIELD_ID='$(jq '.data.organization.projectV2.fields.nodes[] | select(.name=="'"$DATE_FIELD"'") | .id' project_data.json) >> $GITHUB_ENV

- name: Add issue to project
env:
Expand All @@ -48,9 +57,9 @@ jobs:
run: |
gh api graphql -f query='
mutation($project:ID!, $issue:ID!) {
addProjectNextItem(input: {projectId: $project, contentId: $issue}) {
projectNextItem {
id,
addProjectV2ItemById(input: {projectId: $project, contentId: $issue}) {
item {
id
content {
... on Issue {
createdAt
Expand All @@ -63,8 +72,8 @@ jobs:
}
}' -f project=$PROJECT_ID -f issue=$ISSUE_ID > issue_data.json

echo 'ITEM_ID='$(jq '.data.addProjectNextItem.projectNextItem.id' issue_data.json) >> $GITHUB_ENV
echo 'ITEM_CREATION_DATE='$(jq '.data.addProjectNextItem.projectNextItem.content.createdAt' issue_data.json) >> $GITHUB_ENV
echo 'ITEM_ID='$(jq '.data.addProjectV2ItemById.item.id' issue_data.json) >> $GITHUB_ENV
echo 'ITEM_CREATION_DATE='$(jq '.data.addProjectV2ItemById.item.content.createdAt' issue_data.json | cut -c 2-11) >> $GITHUB_ENV

- name: Set fields
env:
Expand All @@ -75,15 +84,17 @@ jobs:
$project: ID!
$item: ID!
$date_field: ID!
$date_value: String!
$date_value: Date!
) {
set_creation_date: updateProjectNextItemField(input: {
set_creation_date: updateProjectV2ItemFieldValue(input: {
projectId: $project
itemId: $item
fieldId: $date_field
value: $date_value
value: {
date: $date_value
}
}) {
projectNextItem {
projectV2Item {
id
}
}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
- name: Get Version
id: get_version
run: |
echo ::set-output name=tag::${GITHUB_REF/refs\/tags\/}
echo ::set-output name=version::${GITHUB_REF/refs\/tags\/v}
echo "tag=${GITHUB_REF/refs\/tags\/}" >> $GITHUB_OUTPUT
echo "version=${GITHUB_REF/refs\/tags\/v}" >> $GITHUB_OUTPUT

- name: Create & Publish Release
uses: release-drafter/release-drafter@v5.12.1
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
branches: [master]
pull_request:
branches: [master]
paths:
- go.mod

jobs:
build:
Expand Down
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Makefile

all: deps test build
all: deps test build-modules build

.PHONY: deps test build image
.PHONY: deps test build-modules build image

# deps will clean out the vendor directory and use go mod for a fresh install
deps:
Expand All @@ -18,6 +18,10 @@ else
go test github.com/prebid/prebid-server/adapters/$(adapter) -bench=.
endif

# build-modules generates modules/builder.go file which provides a list of all available modules
build-modules:
go generate modules/modules.go

# build will ensure all of our tests pass and then build the go binary
build: test
go build -mod=vendor ./...
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build](https://img.shields.io/github/workflow/status/prebid/prebid-server/Validate/master?style=flat-square)](https://github.com/prebid/prebid-server/actions/workflows/validate.yml)
[![Build](https://img.shields.io/github/actions/workflow/status/prebid/prebid-server/validate.yml?branch=master&style=flat-square)](https://github.com/prebid/prebid-server/actions/workflows/validate.yml)
[![Go Report Card](https://goreportcard.com/badge/github.com/prebid/prebid-server?style=flat-square)](https://goreportcard.com/report/github.com/prebid/prebid-server)
![Go Version](https://img.shields.io/github/go-mod/go-version/prebid/prebid-server?style=flat-square)

Expand Down
95 changes: 66 additions & 29 deletions account/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
)

// GetAccount looks up the config.Account object referenced by the given accountID, with access rules applied
func GetAccount(ctx context.Context, cfg *config.Configuration, fetcher stored_requests.AccountFetcher, accountID string) (account *config.Account, errs []error) {
func GetAccount(ctx context.Context, cfg *config.Configuration, fetcher stored_requests.AccountFetcher, accountID string, me metrics.MetricsEngine) (account *config.Account, errs []error) {
// Check BlacklistedAcctMap until we have deprecated it
if _, found := cfg.BlacklistedAcctMap[accountID]; found {
return nil, []error{&errortypes.BlacklistedAcct{
Expand All @@ -28,7 +28,7 @@ func GetAccount(ctx context.Context, cfg *config.Configuration, fetcher stored_r
Message: fmt.Sprintf("Prebid-server has been configured to discard requests without a valid Account ID. Please reach out to the prebid server host."),
}}
}
if accountJSON, accErrs := fetcher.FetchAccount(ctx, accountID); len(accErrs) > 0 || accountJSON == nil {
if accountJSON, accErrs := fetcher.FetchAccount(ctx, cfg.AccountDefaultsJSON(), accountID); len(accErrs) > 0 || accountJSON == nil {
// accountID does not reference a valid account
for _, e := range accErrs {
if _, ok := e.(stored_requests.NotFoundError); !ok {
Expand All @@ -49,27 +49,40 @@ func GetAccount(ctx context.Context, cfg *config.Configuration, fetcher stored_r
} else {
// accountID resolved to a valid account, merge with AccountDefaults for a complete config
account = &config.Account{}
completeJSON, err := jsonpatch.MergePatch(cfg.AccountDefaultsJSON(), accountJSON)
if err == nil {
err = json.Unmarshal(completeJSON, account)
err := json.Unmarshal(accountJSON, account)

// this logic exists for backwards compatibility. If the initial unmarshal fails above, we attempt to
// resolve it by converting the GDPR enforce purpose fields and then attempting an unmarshal again before
// declaring a malformed account error.
// unmarshal fetched account to determine if it is well-formed
var deprecatedPurposeFields []string
if _, ok := err.(*json.UnmarshalTypeError); ok {
// attempt to convert deprecated GDPR enforce purpose fields to resolve issue
accountJSON, err, deprecatedPurposeFields = ConvertGDPREnforcePurposeFields(accountJSON)
// unmarshal again to check if unmarshal error still exists after GDPR field conversion
err = json.Unmarshal(accountJSON, account)

// this logic exists for backwards compatibility. If the initial unmarshal fails above, we attempt to
// resolve it by converting the GDPR enforce purpose fields and then attempting an unmarshal again before
// declaring a malformed account error.
// unmarshal fetched account to determine if it is well-formed
if _, ok := err.(*json.UnmarshalTypeError); ok {
// attempt to convert deprecated GDPR enforce purpose fields to resolve issue
completeJSON, err = ConvertGDPREnforcePurposeFields(completeJSON)
// unmarshal again to check if unmarshal error still exists after GDPR field conversion
err = json.Unmarshal(completeJSON, account)

if _, ok := err.(*json.UnmarshalTypeError); ok {
return nil, []error{&errortypes.MalformedAcct{
Message: fmt.Sprintf("The prebid-server account config for account id \"%s\" is malformed. Please reach out to the prebid server host.", accountID),
}}
}
return nil, []error{&errortypes.MalformedAcct{
Message: fmt.Sprintf("The prebid-server account config for account id \"%s\" is malformed. Please reach out to the prebid server host.", accountID),
}}
}
}
usingGDPRChannelEnabled := useGDPRChannelEnabled(account)
usingCCPAChannelEnabled := useCCPAChannelEnabled(account)

if usingGDPRChannelEnabled {
me.RecordAccountGDPRChannelEnabledWarning(accountID)
}
if usingCCPAChannelEnabled {
me.RecordAccountCCPAChannelEnabledWarning(accountID)
}
for _, purposeName := range deprecatedPurposeFields {
me.RecordAccountGDPRPurposeWarning(accountID, purposeName)
}
if len(deprecatedPurposeFields) > 0 || usingGDPRChannelEnabled || usingCCPAChannelEnabled {
me.RecordAccountUpgradeStatus(accountID)
}

if err != nil {
errs = append(errs, err)
Expand All @@ -92,6 +105,13 @@ func GetAccount(ctx context.Context, cfg *config.Configuration, fetcher stored_r
return account, nil
}

// TCF2Enforcements maps enforcement algo string values to their integer representation and is
// used to limit string compares
var TCF2Enforcements = map[string]config.TCF2EnforcementAlgo{
config.TCF2EnforceAlgoBasic: config.TCF2BasicEnforcement,
config.TCF2EnforceAlgoFull: config.TCF2FullEnforcement,
}

// setDerivedConfig modifies an account object by setting fields derived from other fields set in the account configuration
func setDerivedConfig(account *config.Account) {
account.GDPR.PurposeConfigs = map[consentconstants.Purpose]*config.AccountGDPRPurpose{
Expand All @@ -107,9 +127,16 @@ func setDerivedConfig(account *config.Account) {
10: &account.GDPR.Purpose10,
}

// To look for a purpose's vendor exceptions in O(1) time, for each purpose we fill this hash table with bidders
// located in the VendorExceptions field of the GDPR.PurposeX struct
for _, pc := range account.GDPR.PurposeConfigs {
// To minimize the number of string compares per request, we set the integer representation
// of the enforcement algorithm on each purpose config
pc.EnforceAlgoID = config.TCF2UndefinedEnforcement
if algo, exists := TCF2Enforcements[pc.EnforceAlgo]; exists {
pc.EnforceAlgoID = algo
}

// To look for a purpose's vendor exceptions in O(1) time, for each purpose we fill this hash table with bidders
// located in the VendorExceptions field of the GDPR.PurposeX struct
if pc.VendorExceptions == nil {
continue
}
Expand Down Expand Up @@ -157,13 +184,13 @@ type PatchAccountGDPRPurpose struct {
// given the recent type change of gdpr.purpose{1-10}.enforce_purpose from a string to a bool. This function
// iterates over each GDPR purpose config and sets enforce_purpose and enforce_algo to the appropriate
// bool and string values respectively if enforce_purpose is a string and enforce_algo is not set
func ConvertGDPREnforcePurposeFields(config []byte) (newConfig []byte, err error) {
func ConvertGDPREnforcePurposeFields(config []byte) (newConfig []byte, err error, deprecatedPurposeFields []string) {
gdprJSON, _, _, err := jsonparser.Get(config, "gdpr")
if err != nil && err == jsonparser.KeyPathNotFoundError {
return config, nil
return config, nil, deprecatedPurposeFields
}
if err != nil {
return nil, err
return nil, err, deprecatedPurposeFields
}

newAccount := PatchAccount{
Expand All @@ -178,15 +205,17 @@ func ConvertGDPREnforcePurposeFields(config []byte) (newConfig []byte, err error
continue
}
if err != nil {
return nil, err
return nil, err, deprecatedPurposeFields
}
if purposeDataType != jsonparser.String {
continue
} else {
deprecatedPurposeFields = append(deprecatedPurposeFields, purposeName)
}

_, _, _, err = jsonparser.Get(gdprJSON, purposeName, "enforce_algo")
if err != nil && err != jsonparser.KeyPathNotFoundError {
return nil, err
return nil, err, deprecatedPurposeFields
}
if err == nil {
continue
Expand All @@ -205,13 +234,21 @@ func ConvertGDPREnforcePurposeFields(config []byte) (newConfig []byte, err error

patchConfig, err := json.Marshal(newAccount)
if err != nil {
return nil, err
return nil, err, deprecatedPurposeFields
}

newConfig, err = jsonpatch.MergePatch(config, patchConfig)
if err != nil {
return nil, err
return nil, err, deprecatedPurposeFields
}

return newConfig, nil
return newConfig, nil, deprecatedPurposeFields
}

func useGDPRChannelEnabled(account *config.Account) bool {
return account.GDPR.ChannelEnabled.IsSet() && !account.GDPR.IntegrationEnabled.IsSet()
}

func useCCPAChannelEnabled(account *config.Account) bool {
return account.CCPA.ChannelEnabled.IsSet() && !account.CCPA.IntegrationEnabled.IsSet()
}
Loading