Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Fideslib models #700

Merged
merged 22 commits into from
Jul 5, 2022
Merged

Fideslib models #700

merged 22 commits into from
Jul 5, 2022

Conversation

sanders41
Copy link
Contributor

❗ Contains a migration

Purpose

Replace user related models and schemas from fidesops with those from fideslib.

Changes

  • Replace fidesops user models with fideslib
  • Replace fidesops user schemas with fideslib

Checklist

  • Update CHANGELOG.md file
    • Merge in main so the most recent CHANGELOG.md file is being appended to
    • Add description within the Unreleased section in an appropriate category. Add a new category from the list at the top of the file if the needed one isn't already there.
    • Add a link to this PR at the end of the description with the PR number as the text. example: #1
  • Applicable documentation updated (guides, quickstart, postman collections, tutorial, fidesdemo, database diagram.
  • If docs updated (select one):
    • documentation complete, or draft/outline provided (tag docs-team to complete/review on this branch)
    • documentation issue created (tag docs-team to complete issue separately)
  • Good unit test/integration test coverage
  • This PR contains a DB migration. If checked, the reviewer should confirm with the author that the down_revision correctly references the previous migration before merging
  • The Run Unsafe PR Checks label has been applied, and checks have passed, if this PR touches any external services

Ticket

Fixes #460

@sanders41 sanders41 added the run unsafe ci checks Triggers running of unsafe CI checks label Jun 23, 2022
@sanders41 sanders41 marked this pull request as ready for review July 5, 2022 15:07
@NevilleS
Copy link
Contributor

NevilleS commented Jul 5, 2022

Note that I added #792 as a follow-up ticket from this work. I'd like to get this important refactor merged in, even if it means we should temporarily disable the check-migrations check that is throwing a false positive

Copy link
Contributor

@eastandwestwind eastandwestwind left a comment

Choose a reason for hiding this comment

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

Great work on this @sanders41 . I especially appreciate the tidy-up work you've done along the way, like adding types, and removing unneeded [] using python's all().

I have a couple minor questions on approach, but the major thing I'd like answered is- Now that we have exceptions from fideslib AND fidesops, when should we use fideslib exceptions vs fidesops exceptions?

tests/conftest.py Show resolved Hide resolved
src/fidesops/util/oauth_util.py Show resolved Hide resolved
src/fidesops/tasks/storage.py Show resolved Hide resolved
JWE_PAYLOAD_CLIENT_ID = "client-id"
JWE_PAYLOAD_SCOPES = "scopes"
JWE_ISSUED_AT = "iat"
# JWE_PAYLOAD_CLIENT_ID = "client-id"
Copy link
Contributor

Choose a reason for hiding this comment

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

can we remove this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like I missed this one. I'll remove it.

src/fidesops/db/base_class.py Show resolved Hide resolved
src/fidesops/graph/data_type.py Show resolved Hide resolved
total_users = 25
for i in range(total_users):
body = {
"username": f"user{i}@example.com",
"password": str_to_b64_str("Password123!"),
Copy link
Contributor

Choose a reason for hiding this comment

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

str_to_b64_str was added recently by @TheAndrewJackson 's password hashing update. It would be great to keep these to properly replicate functionality in our testing. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was getting test failures when I had str_to_b64_str in the test. I'll see if I can figure out why.

Copy link
Contributor

Choose a reason for hiding this comment

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

Innnteresting. I'd prefer to follow-up with this, so we can merge this in sooner rather than later.

Copy link
Contributor

Choose a reason for hiding this comment

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

We need to add some of this str_to_b64_str logic to fideslib now, and then revert these tests back to expecting the password to be base64 encoded when they're passed in ethyca/fideslib#43

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks @pattisdr, I've added that bit of info to the associated ticket- #803

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah I created two tickets already for this, one for the fideslib side, one for the fidesops side

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll separate out the info in #803 if that's okay in favor of #809

Copy link
Contributor

Choose a reason for hiding this comment

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

this makes sense, since #809 is a regression. Thanks!

tests/graph/test_config.py Show resolved Hide resolved
@sanders41
Copy link
Contributor Author

For the exceptions question, the exceptions were already created when I started working on fideslib and the ones that were there looked like the ones that would apply to multiple libraries. If there are any exceptions left in fidesops that you think are generic and we should also move to fideslib we can do that.

@eastandwestwind
Copy link
Contributor

OK looks like we just need to push out an update to delete `src/fidesops/schemas/jwt.py.

I've created #803 to account for cleanup work.

@eastandwestwind eastandwestwind merged commit 3fe9dfa into main Jul 5, 2022
@eastandwestwind eastandwestwind deleted the fideslib-models branch July 5, 2022 18:36
sanders41 added a commit that referenced this pull request Sep 22, 2022
* WIP

* WIP

* WIP

* WIP

* Use available exceptions from fideslib

* Fix failing tests

* Fix policy tests

* Remove debugging code

* Fix failing tests

* Fix failing tests

* Fix failiing tests

* Run black and isort

* Make pylint in docker happy

* Clean up migrations

* Move downgrade point of table renames

* Remove Dockerfile temp workaround and fix pylint errors

* Fix failing tests

* Remove jwt.py

Co-authored-by: Paul Sanders <pau@ethyca.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
run unsafe ci checks Triggers running of unsafe CI checks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace User authentication models with fideslib equivalents
4 participants