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 Domains page with ability to add/remove "organization" domains, view "administrator" domains set via security settings, and improve various UX bugs and copy #4584

Merged
merged 31 commits into from
Feb 1, 2024

Conversation

adamsachs
Copy link
Contributor

@adamsachs adamsachs commented Jan 31, 2024

Addresses a number of issues:

  • closes PROD-1419, i.e. addresses bug identified in this comment. for tracking purposes, this limitation had been called out in original PR description, but we hadn't done due diligence to ensure that the limitation was acceptable -- turns out, it wasn't!
  • closes PROD-1404 by updating copy, navigation, and various labels/messages to "Domains"
  • closes PROD-1468 by improving the FE validation tests and descriptive error message

Description Of Changes

BE updates (@adamsachs)

in previous uses of the config proxy, we haven't had a requirement to merge (or reconcile) both API-set and config-set (i.e. via .toml or env var) values for a given app config property. the requirement here, i.e. to overcome the limitation mentioned above, requires this type of resolution.

rather than try to special-case the logic too heavily on the security.cors_origins config property and its uses, i've built what i hope is a relatively generic mechanism for config resolution into the underlying config proxy. in order to leverage the merge functionality, though, a developer must specifically annotate a given config proxy property as a merge_property with a class decorator. this is probably a bit easier to see in action, in the code diff, than it is to explain in words 😅

FE updates (@NevilleS)

image image
image image

This PR overhauls the "CORS Configuration" page and rebrands it as "Domains" with a number of improvements:

  • updated to use the improved config API (see above!) to get/set CORS origins from the UI that are merged into any config-set values on the server
  • query the config API to retrieve any config-set values (both security.cors_origins and security.cors_origin_regex) and display them as read-only values in the UI
  • improve the FE validations to catch common gotchas for origins: require HTTP(s) URLs, don't allow wildcards, don't allow paths
  • update the copy to be a bit friendlier, with some tooltips for more details
  • add Cypress E2E tests to ensure the FE behaviour is tested

Code Changes

BE updates

  • provide generic merge_values behavior for the config proxy's property resolution, for merge_properties that are specifically annotated to have their values merged
    • only Iterable property values can be merged. it'd be presumptuous to try and merge non-iterable elements in a generic way, so better not pretend or intend to support it at all!
  • apply the merge_values logic to the security.cors_origins config property by specifying it in the merge_properties of the SecuritySettingsProxy constructor

FE updates

  • Update nav-config and tests with revised labels for Domain pages
  • Update Redux reducers to fetch both api_set=true and api_set=false config for CORS security settings
  • Add additional Yum validations for isValidURL, containsNoWildcard, containsNoPath and use in form
  • Render the BE "config-set" values for security.cors_origins and security.cors_origin_regex as read-only input fields on the Domains page
  • Add Cypress tests to cover basic view/edit/remove/validate cases

Steps to Confirm

Pre-Merge Checklist

@adamsachs adamsachs self-assigned this Jan 31, 2024
Copy link

vercel bot commented Jan 31, 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 Feb 1, 2024 11:37pm

Copy link
Contributor Author

@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 light context:

src/fides/api/models/application_config.py Show resolved Hide resolved
src/fides/api/models/application_config.py Outdated Show resolved Hide resolved
src/fides/config/config_proxy.py Outdated Show resolved Hide resolved
@adamsachs adamsachs marked this pull request as ready for review January 31, 2024 21:00
@adamsachs adamsachs requested review from NevilleS and galvana January 31, 2024 21:00
Copy link

cypress bot commented Jan 31, 2024

Passing run #6166 ↗︎

0 4 0 0 Flakiness 0

Details:

Merge 4373cba into 67a515a...
Project: fides Commit: d1fc94a893 ℹ️
Status: Passed Duration: 00:33 💡
Started: Feb 1, 2024 11:45 PM Ended: Feb 1, 2024 11:45 PM

Review all test suite changes for PR #4584 ↗︎

Copy link

codecov bot commented Jan 31, 2024

Codecov Report

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

Comparison is base (65af596) 78.06% compared to head (54a0cba) 86.80%.
Report is 2 commits behind head on main.

Files Patch % Lines
src/fides/api/models/application_config.py 73.33% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4584      +/-   ##
==========================================
+ Coverage   78.06%   86.80%   +8.74%     
==========================================
  Files         330      330              
  Lines       19839    19858      +19     
  Branches     2545     2550       +5     
==========================================
+ Hits        15487    17238    +1751     
+ Misses       3888     2152    -1736     
- Partials      464      468       +4     

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

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.

I think this feels pretty good... a couple nitpicks in here that will feel entirely onerous I'm sure.

I'm going to pull this locally and try it out with the UI. Assuming I can do that successfully, I can run UAT pretty quickly and wrap this one up 👍

src/fides/api/models/application_config.py Outdated Show resolved Hide resolved
src/fides/config/config_proxy.py Outdated Show resolved Hide resolved
src/fides/config/config_proxy.py Outdated Show resolved Hide resolved
tests/ops/api/v1/endpoints/test_config_endpoints.py Outdated Show resolved Hide resolved
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, I did some manual UAT on this.

My setup was to point my fidesplus test environment at this fides branch, then run the test environment. Our default test environment pre-configures a couple CORS origins already by setting security.cors_origins with these:

      "http://localhost",
      "http://localhost:8080",
      "http://localhost:3000",
      "http://localhost:3001"

My test steps were:

  1. Confirm that http://localhost:3000 is still permitted by default
  2. Confirm that https://example.com is not permitted by default
  3. Use the Admin UI to add https://example.com as a domain, and confirm that both https://example.com and http://localhost:3000 are permitted
  4. Use the Admin UI to remove https://example.com, confirm it is no longer supported

This looks pretty good to me...

@NevilleS NevilleS changed the title merge api-set and config-set values in cors_origins property resolution Update "Domains" page with new copy, ability to edit "API-set" and "config-set" CORS origins separately, and fix some lingering bugs Feb 1, 2024
@NevilleS NevilleS changed the title Update "Domains" page with new copy, ability to edit "API-set" and "config-set" CORS origins separately, and fix some lingering bugs Update "Domains" page with ability to view "administrator" domains in the UI, edit "organization domains separately, and fix some UX bugs with validation Feb 1, 2024
@NevilleS NevilleS changed the title Update "Domains" page with ability to view "administrator" domains in the UI, edit "organization domains separately, and fix some UX bugs with validation Update "Domains" page with ability to add/remove "organization" domains, view "administrator" domains set via security settings, and improve various UX bugs and copy Feb 1, 2024
@NevilleS NevilleS changed the title Update "Domains" page with ability to add/remove "organization" domains, view "administrator" domains set via security settings, and improve various UX bugs and copy Update Domains page with ability to add/remove "organization" domains, view "administrator" domains set via security settings, and improve various UX bugs and copy Feb 1, 2024
Copy link
Contributor

@galvana galvana left a comment

Choose a reason for hiding this comment

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

Verified functionality locally 👍 I just made some small recommendations for the domain page layout

@NevilleS NevilleS requested a review from galvana February 1, 2024 23:31
@NevilleS
Copy link
Contributor

NevilleS commented Feb 1, 2024

Added an empty state:
image

Copy link
Contributor

@galvana galvana left a comment

Choose a reason for hiding this comment

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

Beautiful 🙌

@NevilleS NevilleS merged commit 79ea1b4 into main Feb 1, 2024
26 checks passed
@NevilleS NevilleS deleted the asachs/PROD-1419-bugfix branch February 1, 2024 23:46
galvana pushed a commit that referenced this pull request Feb 2, 2024
…, view "administrator" domains set via security settings, and improve various UX bugs and copy (#4584)

Co-authored-by: Kelsey Thomas <101993653+Kelsey-Ethyca@users.noreply.github.com>
Co-authored-by: Neville Samuell <neville@ethyca.com>
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.

5 participants