Skip to content

Include vendors disclosed segment in TC string for __tcfapi#7266

Merged
gilluminate merged 2 commits intomainfrom
gill/ENG-2460/vendorsdisclosed-section-missing
Jan 28, 2026
Merged

Include vendors disclosed segment in TC string for __tcfapi#7266
gilluminate merged 2 commits intomainfrom
gill/ENG-2460/vendorsdisclosed-section-missing

Conversation

@gilluminate
Copy link
Copy Markdown
Contributor

@gilluminate gilluminate commented Jan 28, 2026

Ticket ENG-2460

Description Of Changes

Fixed the TC string passed to the CMP API so that it includes the full TC string (including the vendors disclosed segment) instead of only the first segment. Previously extractTCStringForCmpApi stripped the string at the first ., which removed the disclosed vendors portion. Integrations using __tcfapi(\"getTCData\", ...) now receive a tcString that matches the TC portion of Fides.fides_string and includes the disclosed vendors segment.

Code Changes

  • Updated extractTCStringForCmpApi in tcf/events.ts to use decodeFidesString and return the full tc value instead of splitting and taking only the first segment
  • Added Cypress test to assert that TC string from __tcfapi getTCData matches the TC portion of Fides.fides_string and that both include the disclosed vendors segment (.)

Steps to Confirm

  1. Load a TCF experience and opt in to all (eg. /fides-js-demo.html?geolocation=eea)
  2. In the browser console, paste the following and validate that both strings are identical
__tcfapi("getTCData", 2, (tcData) => {
  console.log("Checking TC string for disclosed vendors (v2.3)...");
  console.log("from fides_string:", window.Fides.fides_string.split(",")[0]);
  console.log("from __tcfapi str:", tcData.tcString);
  console.log("strings are identical:", window.Fides.fides_string.split(",")[0] === tcData.tcString);
}) 

Pre-Merge Checklist

  • Issue requirements met
  • All CI pipelines succeeded
  • CHANGELOG.md updated
    • Add a db-migration This indicates that a change includes a database migration label to the entry if your change includes a DB migration
    • Add a high-risk This issue suggests changes that have a high-probability of breaking existing code label to the entry if your change includes a high-risk change (i.e. potential for performance impact or unexpected regression) that should be flagged
    • Updates unreleased work already in Changelog, no new entry necessary
  • UX feedback:
    • All UX related changes have been reviewed by a designer
    • No UX review needed
  • Followup issues:
    • Followup issues created
    • No followup issues
  • Database migrations:
    • Ensure that your downrev is up to date with the latest revision on main
    • Ensure that your downgrade() migration is correct and works
      • If a downgrade migration is not possible for this change, please call this out in the PR description!
    • No migrations
  • Documentation:
    • Documentation complete, PR opened in fidesdocs
    • Documentation issue created in fidesdocs
    • If there are any new client scopes created as part of the pull request, remember to update public-facing documentation that references our scope registry
    • No documentation updates required

@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Jan 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Review Updated (UTC)
fides-plus-nightly Ignored Ignored Preview Jan 28, 2026 9:29pm
fides-privacy-center Ignored Ignored Jan 28, 2026 9:29pm

Request Review

@gilluminate gilluminate force-pushed the gill/ENG-2460/vendorsdisclosed-section-missing branch from 3ea5c81 to 62835bf Compare January 28, 2026 21:29
@gilluminate gilluminate marked this pull request as ready for review January 28, 2026 21:39
@gilluminate gilluminate requested a review from a team as a code owner January 28, 2026 21:39
@gilluminate gilluminate requested review from speaker-ender and removed request for a team January 28, 2026 21:39
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Jan 28, 2026

Greptile Overview

Greptile Summary

This PR fixes a bug in the TC string extraction logic for the __tcfapi CMP API. Previously, extractTCStringForCmpApi was manually splitting the TC string at the first . character, which incorrectly removed the vendors disclosed segment introduced in TCF 2.3. The fix refactors the function to use the existing decodeFidesString utility, which properly parses the full Fides string format and returns the complete TC string including all segments (core string + vendors disclosed).

Key changes:

  • Replaced manual string splitting logic with decodeFidesString utility
  • Updated function documentation to remove outdated comments about stripping segments
  • Added Cypress test to verify TC string from __tcfapi matches the TC portion of Fides.fides_string and includes the disclosed vendors segment (indicated by .)

The change ensures integrations using __tcfapi("getTCData", ...) receive a complete TC string that matches what's stored in the Fides cookie, maintaining consistency across the consent management system.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is well-contained, fixes a clear bug by using existing utility functions instead of manual string manipulation, and includes comprehensive test coverage to verify the fix works correctly
  • No files require special attention

Important Files Changed

Filename Overview
clients/fides-js/src/lib/tcf/events.ts Updated extractTCStringForCmpApi to return full TC string including vendors disclosed segment by using decodeFidesString instead of manual string splitting
clients/privacy-center/cypress/e2e/fides-js/consent-banner-tcf.cy.ts Added test to verify TC string from __tcfapi getTCData matches Fides.fides_string and includes disclosed vendors segment

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

Copy link
Copy Markdown
Contributor

@speaker-ender speaker-ender left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally and looks good!

@gilluminate gilluminate added this pull request to the merge queue Jan 28, 2026
Merged via the queue into main with commit fbbb1d3 Jan 28, 2026
42 checks passed
@gilluminate gilluminate deleted the gill/ENG-2460/vendorsdisclosed-section-missing branch January 28, 2026 22:42
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.

2 participants