Skip to content

Update default policy version for TCF EU to 5, added error reporting for TCF decoding - #7

Open
HeinzBaumann wants to merge 2 commits into
mainfrom
TCF_PolicyVersion_5
Open

Update default policy version for TCF EU to 5, added error reporting for TCF decoding#7
HeinzBaumann wants to merge 2 commits into
mainfrom
TCF_PolicyVersion_5

Conversation

@HeinzBaumann

Copy link
Copy Markdown
Collaborator

This PR addressed the following issues:

Update the default policy version for TCF to 5
On request from IAB EU I started with an error reporting for TCF decoder (this is work in progress still and more will be added in a future PR)

@HeinzBaumann
HeinzBaumann requested a review from iabmayank April 22, 2026 16:49
@HeinzBaumann HeinzBaumann changed the title Update default version for TCF EU to 5, added error reporting for TCF decoding Update default policy version for TCF EU to 5, added error reporting for TCF decoding Apr 22, 2026
@lamrowena

Copy link
Copy Markdown
Collaborator

@chuff could you review this?

@Tejasshack

Copy link
Copy Markdown
Collaborator

Hi @HeinzBaumann

PR 7

The overall direction looks correct: policy 5 as the default, GVL v3 for policy 5, and the initial decode validation for IsServiceSpecific / VendorsDisclosed all look fine.

There are a few issues that I think should be addressed:

  1. Issue: In decode.js around lines 58–61, when policyVersion === 5, the code checks the policy-5 radio but sets the policy-2 radio. This should select tcfeuv2-policy-version-5. Otherwise, decoding a policy-5 string can leave the UI on policy 2, and a re-encode can produce the wrong version.

  2. Policy 4 handling: Policy 4 has been removed from the UI and encode path, but decode only handles 2 and 5. An existing TCF 2.2 string with policy 4 therefore won't match either branch, and the UI can remain on 5. We should decide whether policy 4 is intentionally retired or whether it should still be handled for backward compatibility.

  3. Policy 2 mismatch: Encode still allows policy 2, but decode treats anything other than 5 as invalid. This means a policy-2 string generated by the site can fail its own decoder. We should either remove policy 2 from encode or treat it as a supported/legacy version during decode.

  4. VendorsDisclosed check: Checking VendorsDisclosed.length === 0 does not distinguish an empty vendor list from a missing segment. The validation should check whether the segment is present rather than whether it contains vendor IDs.

From my review, I think a few changes are needed, mainly around the Policy 5 radio bug and keeping the Policy 2/4 encode-decode behavior consistent.

@HeinzBaumann

Copy link
Copy Markdown
Collaborator Author

@Tejasshack I reviewed your comments:
Item 1: I fixed that.
Item 2: For TCF EU policy version 4 is no longer valid. So decoding will error with the policy version not being 5. Newly encoing will set that to 5 and create a valid tcstring. That is correct. No change needed there.
Item 3: Policy no is not valid for TCF EU but for TCF CA. If the UI is set to TCF CA policy version 2 is supported and it will work. For TCF EU it is not allowed. This follows the model of the current deploied encoder/decoder. We could enhance this if we want but will need a new issue logged for it.
Item 4: When the vendorDisclosedVendor section is missing we get an empty vendorDisclosedVendor object back from the API, which is equal to haveing the segement w/o anything populated. We look for the API object for this test. The way we check this is what we can do with what we get from the API. For now this is good enough IMO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants