Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TCF legitimate interest fields #4037

Merged
merged 9 commits into from
Sep 11, 2023

Conversation

allisonking
Copy link
Contributor

@allisonking allisonking commented Sep 6, 2023

Closes #4036

Description Of Changes

This PR sets the legitimate interest fields we had not set before. There are legitimate interest fields for purposes and for vendors.

For purposes, we already know whether they are Consent or Legitimate interest, so we can assign accordingly. We also have to make sure that we never assign to legitimate interest to purposes 1, 3, 4, 5, 6.

Vendors are a little trickier. At first I had some logic to parse through the purposes attached to each vendor and set accordingly. However, the library we use appears to also do some validation here, since the GVL we pass it does list if a vendor has consent or legitimate interest purposes. For example, from the GVL:

{
    "1": {
      "id": 1,
      "name": "Exponential Interactive, Inc d/b/a VDX.tv",
      "purposes": [1, 2, 3, 4, 7, 8, 9, 10],
      "legIntPurposes": [],
      "flexiblePurposes": [7, 8, 9, 10],
      "specialPurposes": [1, 2],
      "features": [1, 2, 3],
      "specialFeatures": [],
      "policyUrl": "https://vdx.tv/privacy/",
      "cookieMaxAgeSeconds": 7776000,
      "usesCookies": true,
      "cookieRefresh": true,
      "usesNonCookieAccess": false,
      "deviceStorageDisclosureUrl": "https://vdxtv.expo.workers.dev"
    }
}

So even if I try to set tcModel.vendorLegitimateInterests.set(1), the library doesn't propagate it because it knows that vendor doesn't have any legIntPurposes`!

This becomes tricky with our data map as a source of truth, since somebody could feasibly set a system that disagrees with the GVL (for instance, if they set Exponential Interactive to have legitimate purposes) and then the library we use rejects it. It does seem like the GVL would be more accurate in this case, though I'm not sure about that. I did add a check to make sure we didn't set any legints that we shouldn't be

Code Changes

  • Add logic to set purpose and vendor legitimate interests
    • Cypress tests for this
  • Fixed logic for rendering the banner which wasn't quite right (it wouldn't pop up if there was a new preference to save to)
    • Cypress test for this

Steps to Confirm

For purposes

  • In the admin-ui, add a system with consent data uses and legitimate interest data uses. Refer to this GVL to data use mapping for data uses : purposes.
    • You can set a forbidden one too, for instance if you set marketing.advertising.first_party.targeted to LegInt
  • Install the IAB's TCF validator chrome extension to easily see the values
  • Run fides and enable tcf via consent-settings
  • Run fides-js via the privacy center with TCF enabled environment var
  • When you save, you should see legitimate interests populate per how you added them to the system. However, if you added a legint on a data use that isn't allowed, then it won't populate.

For vendors

  • You'll need vendors that have GVL vendor IDs, instructions for that here. You should consult the GVL to check what consent/legints the vendors you are adding have.
  • If the vendor you add only has "consent" purposes, then when you opt in, you should only see a ✅ in the "Vendor (consents)" section
  • If the vendor you add only has "legitimate interest" purposes, then when you opt in, you should only see a ✅ in the "Vendor (legitimate interest)" section
  • If it has both, you should get a ✅ in both sections
  • Note that you'll get this regardless of the purposes in the data map, since the library uses the GVL as the source of truth!

Pre-Merge Checklist

  • All CI Pipelines Succeeded
  • Issue Requirements are Met
  • Update CHANGELOG.md

@allisonking allisonking changed the base branch from main to aking/3809/tcf-modal September 6, 2023 22:14
@cypress
Copy link

cypress bot commented Sep 7, 2023

Passing run #4002 ↗︎

0 4 0 0 Flakiness 0

Details:

Merge 4603405 into 09daa68...
Project: fides Commit: 49ecdece7d ℹ️
Status: Passed Duration: 01:36 💡
Started: Sep 8, 2023 7:44 PM Ended: Sep 8, 2023 7:45 PM

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings.

Comment on lines +373 to +375
cy.window().then((win) => {
win.__tcfapi("addEventListener", 2, cy.stub().as("TCFEvent"));
});
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@eastandwestwind I thought this pattern worked reasonably well for testing the CMP API stuff, might be able to reuse for #3999

Copy link
Contributor

Choose a reason for hiding this comment

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

oh awesome! I'm so glad to see this worked here, and it'll make my life so much easier 🌟

@allisonking allisonking marked this pull request as ready for review September 7, 2023 16:58
Copy link
Contributor

@eastandwestwind eastandwestwind left a comment

Choose a reason for hiding this comment

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

Couple small things, but overall looking great @allisonking !

clients/fides-js/src/lib/tcf.ts Show resolved Hide resolved
clients/fides-js/src/lib/consent-utils.ts Outdated Show resolved Hide resolved
clients/fides-js/src/lib/tcf.ts Show resolved Hide resolved
@allisonking allisonking merged commit 094325a into aking/3809/tcf-modal Sep 11, 2023
7 checks passed
@allisonking allisonking deleted the aking/4036/legint-fields branch September 11, 2023 15:57
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.

Fides.js needs to fill out legitimate interest purposes and vendors
2 participants