Description
Version
v1.0.0
Module
core
Describe with reproduction steps – What is the expected behavior?
Steps to reproduce:
1– Navigate to https://iabtcf.com/#/decode
2– Enter CQKjTcAQKjTcAEsAqBENBYFgAAAAAAAAAAwIAAAAAAAA.YAAAAAAAAA
3– Enter CQKjTcAQKjTcAEsAqBENBYFgAAAAAAAAAAwIAAAAAAAA.YAAAAAAAAAAA
Expected result:
Both (2) and (3) should decode.
Actual result:
(2) results in DecodingError: invalid bit length
More detail:
A Publisher TC segment requires:
– SegmentType: 3 bits,
– PubPurposesConsent: 24 bits,
– PubPurposesLITransparency: 24 bits,
– NumCustomPurposes: 6 bits,
– CustomPurposesConsent and CustomPurposesLITransparency: 1 bit each per NumCustomPurposes value.
Assuming NumCustomPurposes encodes a value of "0", that's a total of 57 bits.
With 6 bits per encoding character in base64(url), there are 10 encoding characters required to encode this.
With the SegmentType field having a value of "3", the base64 encoding of an "empty" Publisher TC segment is YAAAAAAAAA==
.
As per RFC 4648 section 5, with the implicitly known data length of the Publisher TC segment, the base64url encoding can remove the two padding =
characters, resulting in the correct base64url encoding YAAAAAAAAA
.
The IAB decoder should accept that correct encoding.