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

Update fides.js to support multiple descriptions (banner, overlay) and render HTML descriptions #4542

Merged
merged 30 commits into from
Jan 2, 2024

Conversation

NevilleS
Copy link
Contributor

@NevilleS NevilleS commented Jan 2, 2024

‼️ contains migration, check downrev before merging! ‼️

Closes PROD-1528
Closes PROD-1338
...and adds support for HTML descriptions (unticketed)

Description Of Changes

As more & more customers are using our consent overlay, we're needing some more flexible options for configuring the major text elements of the banner & modal. This PR adds two major features:

  1. Support for separate titles/descriptions for the banner & modal, so you can configure these two UIs separately
  2. Support for HTML descriptions in the banner & modal, so you can include inline links which is a common need for legal text (to link out to more detailed policies)

Code Changes

  • Support separate descriptions in Privacy Experience Config API
  • Support separate descriptions in fidesjs consent banner & modal
  • Support separate titles in Privacy Experience Config API
  • Support separate titles in fidesjs consent banner & modal
  • Support HTML descriptions in fidesjs consent banner & modal
  • Add a new fidesjs option allowHTMLDescription to optionally allow HTML
  • Add a new privacy center ENV variable to set the allowHTMLDescription option
  • Add nh3 for HTML sanitization checks
  • Update Admin UI forms to support banner title & description
  • Fix Admin UI privacy experience form to not require privacy policy label & URL

Steps to Confirm

  • Configure banner title & description fields and test their changes in the Cookie House
  • Set FIDES_PRIVACY_CENTER__ALLOW_HTML_DESCRIPTION=true, then configure banner & modal description fields with HTML and test their changes in the Cookie House

Pre-Merge Checklist

Copy link

vercel bot commented Jan 2, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
fides-plus-nightly ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 2, 2024 10:51pm

Copy link

cypress bot commented Jan 2, 2024

Passing run #5827 ↗︎

0 4 0 0 Flakiness 0

Details:

Merge c68e36f into 54a6703...
Project: fides Commit: b0ba12e8a7 ℹ️
Status: Passed Duration: 00:35 💡
Started: Jan 2, 2024 10:58 PM Ended: Jan 2, 2024 10:59 PM

Review all test suite changes for PR #4542 ↗︎

Copy link
Contributor Author

@NevilleS NevilleS left a comment

Choose a reason for hiding this comment

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

Just some comments to help reviewers...

Copy link
Contributor

@adamsachs adamsachs left a comment

Choose a reason for hiding this comment

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

BE looks solid to me! i think you've got all the fundamental pieces you need, i know there's at least one TODO so i'll hold off on approving. i like the HtmlStr custom type and validator.

i'm still not the most familiar with the use cases, but just want to make sure - should we populate these fields at all in the default "out of the box" experience configs we define in src/fides/data/privacy_notices/privacy_experience_config_defaults.yml?

Copy link
Contributor

@allisonking allisonking left a comment

Choose a reason for hiding this comment

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

FE looks great! thanks for working on this!

@NevilleS
Copy link
Contributor Author

NevilleS commented Jan 2, 2024

@adamsachs

i'm still not the most familiar with the use cases, but just want to make sure - should we populate these fields at all in the default "out of the box" experience configs we define in src/fides/data/privacy_notices/privacy_experience_config_defaults.yml?

No, I don't think so. In general, the defaults that set the banner & modal descriptions/titles to be identical are reasonable, so I felt like we should leave our defaults unchanged and have these new fields as null.

@pattisdr
Copy link
Contributor

pattisdr commented Jan 2, 2024

i'm still not the most familiar with the use cases, but just want to make sure - should we populate these fields at all in the default "out of the box" experience configs we define in src/fides/data/privacy_notices/privacy_experience_config_defaults.yml?

In the UI, do we drop back to using the existing title/description if banner_title/banner_description don't exist? If not, then yes, we'll need to populate this template.

Further, current behavior of load_default_experience_configs_on_startup only adds new configs from the template if they don't exist, it doesn't update existing configs in the database. We can talk about how we want to handle these new fields here if needed.

EDIT: OK! looks like we're all good here then. We drop back to using title/description if banner title/description doesn't exist. No template updates needed.

Copy link
Contributor

@pattisdr pattisdr left a comment

Choose a reason for hiding this comment

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

looks good so far, backend is fairly straightforward since these new fields are allowed to be nullable - will look again when HtmlStr validation is in -

Copy link

codecov bot commented Jan 2, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (54a6703) 87.06% compared to head (c68e36f) 87.06%.

Files Patch % Lines
src/fides/api/custom_types.py 77.77% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4542      +/-   ##
==========================================
- Coverage   87.06%   87.06%   -0.01%     
==========================================
  Files         334      334              
  Lines       20539    20554      +15     
  Branches     2650     2651       +1     
==========================================
+ Hits        17883    17896      +13     
- Misses       2185     2186       +1     
- Partials      471      472       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor Author

@NevilleS NevilleS left a comment

Choose a reason for hiding this comment

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

A few more comments for @allisonking

Copy link
Contributor

@adamsachs adamsachs left a comment

Choose a reason for hiding this comment

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

some minor nits on the validation that i wouldn't consider blockers, generally looks good and i think you've plugged the validation into the right places! i'm not an HTML sanitization expert but the library you're using looks like a good standard, and i trust your judgement there 👍

src/fides/api/custom_types.py Outdated Show resolved Hide resolved
@NevilleS NevilleS changed the title Support multiple descriptions (banner, modal) and allow HTML descriptions when desired Update fides.js to support multiple descriptions (banner, overlay) and render HTML descriptions Jan 2, 2024
@NevilleS NevilleS marked this pull request as ready for review January 2, 2024 21:09
@NevilleS
Copy link
Contributor Author

NevilleS commented Jan 2, 2024

OK, I think I've got everything covered here. Switching to some final polish & UAT.

@NevilleS
Copy link
Contributor Author

NevilleS commented Jan 2, 2024

OK, @mfbrown and I did some UAT together on the Admin UI form. Here's the main before/after screenshots for that:

Before After
image image

Lots of copy edits in there that @mfbrown and I did together. It's still a bit clumsy and wordy, but we felt that it was best to be "clear" before trying to get clever with wording and didn't have great ideas 😄

UAT complete ✅

@NevilleS NevilleS merged commit 3019120 into main Jan 2, 2024
47 of 48 checks passed
@NevilleS NevilleS deleted the PROD-1528-ns-support-multiple-html-descriptions branch January 2, 2024 23:25
NevilleS added a commit that referenced this pull request Jan 2, 2024
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.

4 participants