This repository has been archived by the owner on Nov 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Email Connector: Send Email with Erasure Instructions [#1158] #1246
Merged
eastandwestwind
merged 14 commits into
main
from
fidesops_1158_email_connector_email_send
Sep 7, 2022
Merged
Changes from 9 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
77a3d3d
Send an email for each email-based dataset at the end of privacy requ…
pattisdr e981ea4
Add more "checkpoints" to privacy request execution - these are locat…
pattisdr 1601293
Don't send an email if the connection config is read only or there ar…
pattisdr f539a01
Don't assume there's a collection when building "resume" details. A f…
pattisdr e1dc1fb
Add a first draft of docs for setting up an email connector.
pattisdr c09b4e7
Moves the email connector send method to the email connector file.
pattisdr c8afe55
Update mock location.
pattisdr b10f6de
Merge remote-tracking branch 'ethyca/main' into fidesops_1158_email_c…
pattisdr d9e169a
Bump downrev.
pattisdr 10ba182
update email connector guides
1e855d0
correct link, broken sentence
d70d71a
Create a new EmailRequestFulfillmentBodyParams type to be used once t…
pattisdr 9a20d02
Fix missed test.
pattisdr 02eb668
Merge remote-tracking branch 'ethyca/main' into fidesops_1158_email_c…
pattisdr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
# Setting up an Email Connector | ||
|
||
|
||
## What is the purpose of the Email Connector? | ||
|
||
The Email Connector is a ConnectionConfig type that emails a third party to ask them to complete | ||
a Privacy Request when their service cannot be accessed automatically. | ||
|
||
Fidesops will gather details about each collection described on the third party service as part of request execution and | ||
wait to send a single email to the service after all collections have been visited. Fidesops does not | ||
collect confirmation that the erasure was completed by the third party; the EmailConnector is only responsible | ||
for notifying them. | ||
|
||
Importantly, only *erasure* requests are supported at this time for EmailConnectors. | ||
|
||
|
||
## What pieces should be configured for an Email Connector? | ||
|
||
In short, you will need to create an `email` ConnectionConfig to store minor details about the third party service, and a DatasetConfig | ||
to describe the data contained in their datasource. You will also need to have configured a separate [EmailConfig](email_communications.md) which | ||
is used system-wide to carry out the actual email send. | ||
|
||
|
||
## Setting up the ConnectionConfig | ||
|
||
Create a ConnectionConfig object with | ||
|
||
```json title="<code>PATCH api/v1/connection</code>" | ||
[ | ||
{ | ||
"name": "Email Connection Config", | ||
"key": "third_party_email_connector", | ||
"connection_type": "email", | ||
"access": "write" | ||
} | ||
] | ||
``` | ||
EmailConnectors must be given "write" access in order to send an email. | ||
|
||
|
||
## Configuring who to notify | ||
|
||
Save a `to_email` on the ConnectionConfig secrets. This is the user that will be notified via email to complete | ||
an erasure. Only one `to_email` is supported at this time. | ||
|
||
Optionally, configure a `test_email` to which you have access, to verify that your setup is working. Provided your | ||
EmailConfig is set up properly, you should receive an email similar to the one sent to third-party services, containing | ||
dummy data. | ||
|
||
```json title="<code>PUT api/v1/connection/<email_connection_config_key>/secret</code>" | ||
{ | ||
"test_email": "[email protected]", | ||
"to_email": "[email protected] | ||
} | ||
``` | ||
|
||
## Configuring the dataset | ||
|
||
Describe the collections and fields on a third party source with a [DatasetConfig](datasets.md), the same way you'd describe attributes | ||
on a database. If you do not know the exact data structure of a third party, you might configure a single collection | ||
with the fields you'd like masked. | ||
|
||
As with all collections that support erasures, a primary key must be specified on each collection. | ||
|
||
|
||
```json title="<code>PUT api/v1/connection/<email_connection_config_key>/dataset" | ||
[ | ||
{ | ||
"fides_key": "email_dataset", | ||
"name": "Dataset not accessible automatically", | ||
"description": "Third party data - will email to request erasure", | ||
"collections": [ | ||
{ | ||
"name": "daycare_customer", | ||
"fields": [ | ||
{ | ||
"name": "id", | ||
"data_categories": [ | ||
"system.operations" | ||
], | ||
"fidesops_meta": { | ||
"primary_key": true | ||
} | ||
}, | ||
{ | ||
"name": "child_health_concerns", | ||
"data_categories": [ | ||
"user.biometric_health" | ||
] | ||
}, | ||
{ | ||
"name": "user_email", | ||
"data_categories": [ | ||
"user.contact.email" | ||
], | ||
"fidesops_meta": { | ||
"identity": "email" | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
SUBJECT_IDENTITY_VERIFICATION_TEMPLATE = "subject_identity_verification.html" | ||
EMAIL_ERASURE_REQUEST_FULFILLMENT = "erasure_request_email_fulfillment.html" |
30 changes: 30 additions & 0 deletions
30
src/fidesops/ops/email_templates/templates/erasure_request_email_fulfillment.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Erasure request</title> | ||
</head> | ||
<body> | ||
<main> | ||
<p>Please locate and erase the associated records from the following collections:</p> | ||
{% for collection, action_required in dataset_collection_action_required.items() -%} | ||
<p><b>{{ collection }}</b></p> | ||
{% for action in action_required.action_needed -%} | ||
<p>Locate the relevant records with:</p> | ||
<ul> | ||
{% for field, values in action.locators.items() -%} | ||
<li> Field: <i>{{ field }}</i>, Values: {{ values|join(', ') }} </li> | ||
{%- endfor %} | ||
</ul> | ||
{% if action.update -%} | ||
<p>Erase the following fields:</p> | ||
<ul> | ||
{% for field_name, masking_strategy in action.update.items() -%} | ||
<li><i>{{field_name}}</i></li> | ||
{%- endfor %} | ||
</ul> | ||
{%- endif %} | ||
{%- endfor %} {%- endfor %} | ||
</main> | ||
</body> | ||
</html> |
32 changes: 32 additions & 0 deletions
32
src/fidesops/ops/migrations/versions/912d801f06c0_audit_log_email_send.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"""audit log email send | ||
|
||
Revision ID: 912d801f06c0 | ||
Revises: bde646a6f51e | ||
Create Date: 2022-09-01 16:23:10.905356 | ||
|
||
""" | ||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "912d801f06c0" | ||
down_revision = "bde646a6f51e" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
op.execute("alter type auditlogaction add value 'email_sent'") | ||
|
||
|
||
def downgrade(): | ||
op.execute("delete from auditlog where action in ('email_sent')") | ||
op.execute("alter type auditlogaction rename to auditlogaction_old") | ||
op.execute("create type auditlogaction as enum('approved', 'denied', 'finished')") | ||
op.execute( | ||
( | ||
"alter table auditlog alter column action type auditlogaction using " | ||
"action::text::auditlogaction" | ||
) | ||
) | ||
op.execute("drop type auditlogaction_old") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just adding a new check here now that I've generally removed the requirement that a collection is saved on a
CheckpointActionRequired
but this is one place where it's needed.(To be clear, this shouldn't ever be hit though)