Skip to content

CMP Validator 2.3 panel crashes: TypeError reading '1' when validating a spec-correct unregistered CMP stub #219

Open

Description

@kirapwn

CMP Validator 2.3 crashes with TypeError: Cannot read properties of undefined (reading '1') when validating a page whose CMP is a spec-correct unregistered stub

Environment: CMP Validator 2.3 (Chrome extension, CRX ffhhjklgcfabkpholngojpkijlafjooc), page serves a spec-correct IAB TCF stub (no registered CMP yet — site under development).

Our stub provides (verified in-page and with the official @iabtcf/core decoder):

  • __tcfapi function + static __tcfapiLocator iframe
  • ping: {cmpId: 0, gvlVersion: 3, tcfPolicyVersion: 5, cmpStatus: 'loaded', ...} (ping gvlVersion matches a real GVL archive)
  • getTCData: full TCF v2.2 shape — flat fields, plus purpose {consents{id:bool 1..24}, legitimateInterests{…}}, vendor {consents, legitimateInterests}, vendors {consents, legitimateInterests, disclosed} (id-keyed maps), publisher, purposeRestrictions, publisherCC, addtlConsent
  • TC string: decodes cleanly with @iabtcf/core TCString.decode (vendorListVersion 179 = current, policyVersion 5, 56–59 chars, vendor range encoding for GVL 755 tested)

Crash (uncaught, in the validator panel render):

TypeError: Cannot read properties of undefined (reading '1')
    at index.c163c4e5.js:136:32645
    at Array.map (<anonymous>)
    at h (index.c163c4e5.js:136:32139)
    at pk (index.c163c4e5.js:136:33128)

Analysis from the 2.3 bundle: the crashing h is the section renderer — E = R ? Object.values(R) : null; E.map(R => …) where R = d === "specialFeatures" ? r.vendorList[d] : r.vendorList[d + "s"] (r.vendorList = the fetched GVL). For section ids like purposeConsents/vendorConsents, d + "s" produces keys (purposeConsentss, vendorConsentss) that do not exist in the GVL JSON — R is undefined and E becomes null, which is guarded. The reading '1' crash occurs inside the map callback for a section where R IS truthy — likely iterating GVL.purposes/GVL.vendors entries and reading numeric-keyed fields ([1]) that are absent for the validator's internal test data path (cmpId 1234 / gvlVersion 224 appear in the panel in this state).

Additional observation: the panel state (cmpId 1234, gvlVersion 224) does not match the page's actual CMP data (cmpId 0, gvlVersion 179) — suggesting the validator substitutes its own reference data for unregistered CMPs, and its compliance-check render then crashes on that substitute's incomplete v2.2 shape.

Expected: the panel renders all sections (checks can legitimately fail/pass) instead of throwing.

Happy to provide: full tcData JSON, the TC string, page URL for reproduction (www-test.gazette.cofinity.io — test env, reachable publicly).

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions