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

Add Google Tag Manager and Privacy Center ENV vars to sample app, plus the ability to pass ENV vars to both privacy center and sample app during fides deploy via .env #2949

Merged
merged 14 commits into from
May 30, 2023

Conversation

nicolas-ethyca
Copy link
Contributor

@nicolas-ethyca nicolas-ethyca commented Mar 29, 2023

Closes #3347
Closes #29

Code Changes

  • Add Google Tag Manager script, configured via FIDES_SAMPLE_APP__GOOGLE_TAG_MANAGER_CONTAINER_ID
  • Configure Privacy Center URL via FIDES_SAMPLE_APP__PRIVACY_CENTER_URL
  • Pass .env values to fides-privacy-center and fides-sample-app images when running fides deploy
  • Add a README.md for fides-sample-app
  • Enable "Privacy Experiences" beta flag for local testing
  • Call Fides.gtm() to enable the Fides <> GTM integration

Steps to Confirm

  • Edit your .env file with FIDES_SAMPLE_APP__GOOGLE_TAG_MANAGER_CONTAINER_ID=GTM-MYGTMID
  • Run nox -s "fides_env(test)"
  • Open http://localhost:3000/
  • Check that GTM script is added (using the Developer Tools) and initialized with the GTM ID provided in the .env file

Pre-Merge Checklist

Description Of Changes

This adds an (optional) GTM container tag to the Cookie House sample app for testing, and then adds additional flexibility to the advanced usage of fides deploy by allowing the user to edit their local .env file and provide extra configuration for the various images.

This also adds a configurable option for FIDES_SAMPLE_APP__PRIVACY_CENTER_URL so that this isn't always hardcoded to http://localhost:3001 👍

@cypress
Copy link

cypress bot commented Mar 29, 2023

Passing run #2250 ↗︎

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 76bce79 into 7bef710...
Project: fides Commit: c4106f3584 ℹ️
Status: Passed Duration: 00:46 💡
Started: May 30, 2023 8:46 PM Ended: May 30, 2023 8:47 PM

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

@nicolas-ethyca nicolas-ethyca changed the title draft: feature/GoogleTagManager CookieHouse feature/GoogleTagManager CookieHouse Mar 30, 2023
@codecov
Copy link

codecov bot commented Mar 30, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (8d424d3) 87.13% compared to head (90188aa) 87.13%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2949   +/-   ##
=======================================
  Coverage   87.13%   87.13%           
=======================================
  Files         312      312           
  Lines       18659    18659           
  Branches     2377     2377           
=======================================
  Hits        16259    16259           
  Misses       1980     1980           
  Partials      420      420           

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

Copy link
Contributor

@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.

Overall this looks pretty reasonable! I know it's just a "sample app" but I do want to investigate the potential XSS possibility

Copy link
Contributor

@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.

Suggestion for XSS defense!

Copy link
Contributor

@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.

This looks good now, just add an entry to CHANGELOG and this should be ready to go. Thanks!

database: DATABASE_DB || "postgres_example",
host: host || DATABASE_HOST || "localhost",
port: Number(port || DATABASE_PORT || 5432),
user: user || DATABASE_USER || "postgres",

Check failure

Code scanning / CodeQL

Hard-coded credentials

The hard-coded value "postgres" is used as [user name](1).
host: host || DATABASE_HOST || "localhost",
port: Number(port || DATABASE_PORT || 5432),
user: user || DATABASE_USER || "postgres",
password: password || DATABASE_PASSWORD || "postgres",

Check failure

Code scanning / CodeQL

Hard-coded credentials

The hard-coded value "postgres" is used as [password](1).
@NevilleS NevilleS changed the title feature/GoogleTagManager CookieHouse Add Google Tag Manager and Privacy Center ENV vars to sample app, plus the ability to pass ENV vars to both privacy center and sample app during fides deploy via .env May 29, 2023
@NevilleS
Copy link
Contributor

Updated this branch to the latest main, and then added all the extra requirements to cover #3347 👍

To make those ENV vars easy to access when testing locally, this also passes the .env file from fides deploy --env-file along to the sample app & privacy center images.

Copy link
Contributor

@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.

To actually use this, we should also be calling Fides.gtm(), duh! 🙃

@nicolas-ethyca
Copy link
Contributor Author

Tested and working

image

Copy link
Contributor

@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.

OK, LGTM now!

Copy link
Contributor

@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.

OK, LGTM now!

@NevilleS NevilleS removed the request for review from mfbrown May 30, 2023 20:31
@NevilleS NevilleS merged commit 58bea87 into main May 30, 2023
@NevilleS NevilleS deleted the feature/GTMIntegration branch May 30, 2023 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants