Fixed race condition causing gdprApplies to flip during TCF initialization #6895
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ticket ENG-1668
Description Of Changes
Fixed a race condition in FidesJS TCF initialization where
gdprAppliescould temporarily beundefined, causing the IAB CMP API to incorrectly report that GDPR does not apply. This could result in assets being served without proper consent checks for returning users with existing TCF cookies.The issue occurred because:
fidesTcfGdprApplieswas not guaranteed to have a default value during initializationundefinedasfalseCode Changes
fides-tcf.tsto ensurefidesTcfGdprAppliesdefaults totruefor TCF experiences during initialization, with proper override handlinglib/tcf/events.tsto use strict equality check (=== false) instead of falsy check, so only explicitlyfalsevalues setgdprApplies = falseSteps to Confirm
fides_tcf_gdpr_appliesgdprApplies = trueconsistentlyfides_tcf_gdpr_applies: falsestill works correctlyPre-Merge Checklist
CHANGELOG.mdupdatedmaindowngrade()migration is correct and works