-
Notifications
You must be signed in to change notification settings - Fork 72
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
Refactor ctl
object endpoint generation
#3304
Refactor ctl
object endpoint generation
#3304
Conversation
ctl
object endpoint generation
…. Fixes the fundamental security bug
Passing run #2051 ↗︎
Details:
This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #3304 +/- ##
==========================================
- Coverage 87.06% 87.05% -0.02%
==========================================
Files 309 313 +4
Lines 18847 18917 +70
Branches 2467 2468 +1
==========================================
+ Hits 16410 16468 +58
- Misses 1996 2008 +12
Partials 441 441
☔ View full report in Codecov by Sentry. |
… single unified router for the ctl endpoints
…e database.system module
looks like the last major failure here is related to the trailing slashes issue, going to solve like we did before |
@daveqnet as this is tied to a security ticket, I'm looking for your verification here as well that it is patched up 🙂 |
PR approved from a security perspective, more info here: https://github.com/ethyca/security-issues/issues/16#issuecomment-1550096284 |
@ThomasLaPiana i'm sorry, wasn't able to get to this today - will look at it first thing my tomorrow! |
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.
thank you @ThomasLaPiana! this is a really nice refactor, IMO it makes this area of the codebase a lot more readable, maintainable and extendable, while still keeping things DRY.
no significant points to address as far as i can tell, i just had some minor nits. i did some smoke testing that the endpoints still work as expected, and paid specific attention to the system API and its use within the admin UI - everything looks good.
of course i'd also like to see if @pattisdr can poke any holes in it!
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.
Nice improvement here @ThomasLaPiana, making it easier to start adding one-off changes for specific ctl-resources, while still code-sharing where we can.
@adamsachs @pattisdr thank you both for the thorough review! I'm digging into the fixes and updates now |
Closes #3090
Note to reviewers
This PR is primarily an organizational change, so there is no "new" functionality to test. All tests should pass as they did before.
The only small feature change is the removal of the
resource_type
param that thectl
endpoints used. They are no longer needed given the new way that these generic endpoints are created.Code Changes
fides.common.utils
module to avoid circular dependencies more cleanlyroutes.system
intodatabase.system
to fix circular dependencyCTL_ROUTER
Steps to Confirm
openapi
docs still look goodPre-Merge Checklist
Relevant Follow-Up Issues CreatedCHANGELOG.md
Description Of Changes
On top of being difficult to parse/maintain, the for loop that generated the ctl-related object endpoints also had a security vulnerability.
This PR rewrites this loop as a group of discrete functions that are then composed to create each "generic" set of CRUD endpoints. This maintains the DRY aspect of the previous solution while also making it easier when we need to specifically modify a single endpoint.
Along the way, some other improvements became necessary as the slight code reorganization brought some dependency dangers to light. This included a new
fides.common.utils
file designed to be used across the application and specifically without any reliance onfides
itself. This also included refactoringroutes.system
and moving the database access layer intodatabase
instead of in the sameroutes
file, as this also caused a circular dependency