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

[Backend] Out of the Box Privacy Notices #3401

Merged
merged 15 commits into from
Jun 5, 2023

Conversation

pattisdr
Copy link
Contributor

@pattisdr pattisdr commented May 30, 2023

Closes #2833

❗ Contains migration; check downrev before merge

Description Of Changes

Loads some out of the box privacy notices on startup. Also creates the "experiences" for these notices behind the scenes

Out of the box copy here

Relates to out of the box Experience Configs

Code Changes

  • Adds a yaml file with five out-of-the-box notices.
  • Adds a new PrivacyNoticeTemplate table
  • On startup, add any new templates or update existing templates from the data/privacy_notices/privacy_notice_templates.yml file into the PrivacyNoticeTemplates file
  • If there is not a PrivacyNotice for the given PrivacyNoticeTemplate, create one. If a Notice already exists, don't update it.
  • Note that if automatically-created notices would create a conflict with notices already created, we skip creating notices

screencapture-localhost-3000-consent-privacy-notices-2023-05-30-15_20_53 (1)

Steps to Confirm

  • Run nox -s dev -- shell
  • Verify in fides logs that you see a message like this: 2023-05-30 22:52:43.877 [INFO] (consent_util:load_default_notices_on_startup:462): Loading default privacy notice templates from /fides/data/privacy_notices/privacy_notice_templates.yml
  • Visit {{host}}/privacy-notice?systems_applicable=false&show_disabled=true to see the automatically created privacy_notices. If "origin" is not null, then that notice was created from a template.
  • Visit GET {{host}}/privacy-experience/? to see the automatically created experiences

Pre-Merge Checklist

…g the template, and then again when creating the notice from the template.

- Also no need to escape "origin" field
- Fix typos in template
- Assert experiences also created for notices on load
- Don't load default notices in test mode
@cypress
Copy link

cypress bot commented May 30, 2023

Passing run #2434 ↗︎

0 4 0 0 Flakiness 0
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.

Details:

Merge ad089b9 into 0438113...
Project: fides Commit: dc36f86623 ℹ️
Status: Passed Duration: 00:46 💡
Started: Jun 5, 2023 10:06 PM Ended: Jun 5, 2023 10:07 PM

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

@codecov
Copy link

codecov bot commented May 30, 2023

Codecov Report

Patch coverage: 93.47% and project coverage change: -0.02 ⚠️

Comparison is base (0438113) 87.14% compared to head (ad089b9) 87.13%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3401      +/-   ##
==========================================
- Coverage   87.14%   87.13%   -0.02%     
==========================================
  Files         312      312              
  Lines       18724    18787      +63     
  Branches     2379     2389      +10     
==========================================
+ Hits        16317    16370      +53     
- Misses       1984     1993       +9     
- Partials      423      424       +1     
Impacted Files Coverage Δ
src/fides/api/app_setup.py 71.92% <25.00%> (-5.75%) ⬇️
...s/api/api/v1/endpoints/privacy_notice_endpoints.py 100.00% <100.00%> (ø)
src/fides/api/db/base.py 100.00% <100.00%> (ø)
src/fides/api/models/privacy_notice.py 99.11% <100.00%> (+0.04%) ⬆️
src/fides/api/util/consent_util.py 99.42% <100.00%> (+0.64%) ⬆️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@pattisdr pattisdr changed the title [WIP] Out of the box Privacy Notices [Backend] Out of the box Privacy Notices Jun 4, 2023
src/fides/api/models/privacy_notice.py Outdated Show resolved Hide resolved
src/fides/api/models/privacy_notice.py Show resolved Hide resolved
src/fides/api/util/consent_util.py Show resolved Hide resolved
src/fides/api/util/consent_util.py Show resolved Hide resolved
src/fides/api/util/consent_util.py Show resolved Hide resolved
tests/fixtures/application_fixtures.py Show resolved Hide resolved
@pattisdr pattisdr marked this pull request as ready for review June 4, 2023 21:54
@pattisdr pattisdr changed the title [Backend] Out of the box Privacy Notices [Backend] Out of the Box Privacy Notices Jun 5, 2023
@pattisdr pattisdr requested a review from adamsachs June 5, 2023 13:07
@pattisdr
Copy link
Contributor Author

pattisdr commented Jun 5, 2023

Out of the box experience configs were just merged which conflicts in several locations. Getting this up-to-date now.

Conflicts:
CHANGELOG.md
src/fides/api/app_setup.py
src/fides/api/util/consent_util.py
tests/ops/util/test_consent_util.py
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.

nice work @pattisdr , this is pretty straightforward! special thanks for all your annotations with comments, it definitely helped reading through things.

just a few minor comments that you could look into, i don't think any of them are blockers. i think you're right that likely the riskiest/trickiest thing here is integrating your new use case into all that pretty nasty update logic -- as far as i can tell, you've done a nice job with that, and have kept things about as simple as they can be!

src/fides/api/models/privacy_notice.py Outdated Show resolved Hide resolved
src/fides/api/models/privacy_notice.py Show resolved Hide resolved
tests/ops/util/test_consent_util.py Show resolved Hide resolved
tests/ops/util/test_consent_util.py Outdated Show resolved Hide resolved
src/fides/api/util/consent_util.py Show resolved Hide resolved
src/fides/api/util/consent_util.py Show resolved Hide resolved
src/fides/api/util/consent_util.py Show resolved Hide resolved
src/fides/api/util/consent_util.py Outdated Show resolved Hide resolved
…r country codes for now.

- Add an alias for PrivacyNoticeTemplate + PrivacyNotice
- Relocate test now that method has moved
@pattisdr pattisdr merged commit 748193a into main Jun 5, 2023
@pattisdr pattisdr deleted the fides_2833_out_of_the_box_notices branch June 5, 2023 23:09
@pattisdr
Copy link
Contributor Author

pattisdr commented Jun 5, 2023

Preemptively merging @adamsachs so I can make the changes to #3465 tonight - happy to address any more followups there.

@adamsachs
Copy link
Contributor

Preemptively merging @adamsachs so I can make the changes to #3465 tonight - happy to address any more followups there.

yeah of course! didn't mean to suggest this should hold things up. thanks for confirming 👍

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.

Backend Out of the Box Privacy Notices
2 participants