Skip to content

Add TCF 2.3 Disclosed Vendors segment support (#40)#49

Open
ggierak wants to merge 1 commit intoprebid:masterfrom
guillrak:feature/tcf23-disclosed-vendors
Open

Add TCF 2.3 Disclosed Vendors segment support (#40)#49
ggierak wants to merge 1 commit intoprebid:masterfrom
guillrak:feature/tcf23-disclosed-vendors

Conversation

@ggierak
Copy link

@ggierak ggierak commented Feb 9, 2026

Summary

  • Add support for parsing the Disclosed Vendors segment (SegmentType=1) introduced in TCF 2.3
  • Expose two new methods on the VendorConsents interface: MaxDisclosedVendorID() and DisclosedVendor(id)
  • Maintain full backward compatibility with TCF 2.2 strings (methods return 0 / false when the segment is absent)

Details

TCF 2.3 makes the Disclosed Vendors segment mandatory in TC Strings:

[Core String].[Disclosed Vendors].[Publisher TC]

This segment records which vendors were disclosed to the user by the CMP. Previously, ParseString() discarded all segments after the first . separator. Now it decodes each additional segment, identifies its type via the first 3 bits, and parses Disclosed Vendors (type 1) using the same bitfield/range encoding as vendor consent.

Changes

File Change
api/consent.go Add MaxDisclosedVendorID() and DisclosedVendor(id) to VendorConsents interface
vendorconsent/tcf2/consent.go Parse additional segments in ParseString(), add parseDisclosedVendors() and parseSegmentRangeSection()
vendorconsent/tcf2/metadata.go Add disclosedVendors field and accessor methods with nil-safe handling
vendorconsent/tcf1/metadata.go Stub implementations returning zero-values
vendorconsent/tcf2/consent_test.go Tests for TCF 2.3 parsing, TCF 2.2 backward compat, and edge cases

Test plan

  • Parse TCF 2.3 string with range-encoded Disclosed Vendors (vendors 1-5, 100, 404)
  • Parse TCF 2.2 string without Disclosed Vendors segment (returns 0/false)
  • Edge cases: vendor ID 0 and beyond MaxDisclosedVendorID
  • Existing tests pass (go test ./...)

Parse the Disclosed Vendors segment (SegmentType=1) from TC Strings and
expose it via MaxDisclosedVendorID() and DisclosedVendor(id) on the
VendorConsents interface. Maintains backward compatibility with TCF 2.2
strings where the segment is absent.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@osazos
Copy link

osazos commented Feb 10, 2026

Hi @ggierak, thanks for working on this. There is already an open PR addressing the same issue (#48), and it’s currently under review and close to being ready (see onfocusio#1).
Would you mind joining the discussion there and contributing to that PR so we can avoid duplicating efforts?

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