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

Remove password from credentials object #4661

Merged
merged 6 commits into from
Mar 6, 2024
Merged

Conversation

tariqajyusuf
Copy link
Contributor

Fixes issue introduced in #2153

Description Of Changes

fides user login stores the plaintext password to the ~/.fides-credentials file. This removes the password since it's not actively used anywhere.

Code Changes

  • Remove password from the credentials object.

Steps to Confirm

  • Use fides user login and login with credentials.
  • Open ~/.fides-credentials and ensure password is not stored

Pre-Merge Checklist

Copy link

vercel bot commented Mar 5, 2024

@tariqajyusuf is attempting to deploy a commit to the Ethyca Team on Vercel.

A member of the Team first needs to authorize it.

@daveqnet
Copy link
Contributor

daveqnet commented Mar 5, 2024

Tested successfully on this PR branch:

fidesuser@a6c53654f2e8:/fides$ fides user login -u root_user -p Testpassword1!
2024-03-05 16:39:51.642 | DEBUG    |  - Logger configuration options in use | {'api_config': '{"destination": "", "colorize": false, "level": "DEBUG", "serialization": "", "log_pii": true}'}
> Loaded config from: /fides/src/fides/data/sample_project/fides.toml
Logged in as user: root_user
Credentials file written to: /home/fidesuser/.fides_credentials
fidesuser@a6c53654f2e8:/fides$ cat /home/fidesuser/.fides_credentials
username = "root_user"
user_id = "fidesadmin"
access_token = "eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIn0..pwTMoiV7EhamS1a5L4_1fQ.VTtFQmo9UMrpgZ4IUfnkTJr_6mKCMQMhBfPIadi1L6fqAaicDtmR6Mn3XFAAp3v6IVrv35wV4hETRK5QPAu6KobLsmH8svLwi-TGHJ0WDS_ahq-qajJyfEeDc6So-ikERhxb9lRhKAAxsNVHhs4jm9LHE0u82kgQ-Au5GgTlkvG4qa83mY2QCheH7_-ROGa7tqcu0H31UlvDYoe_d0ruoVVqetxANZDKU8A_lG7wh5PvDEaDGbQiSt2LY7Zx8aS5rYV9ku8pkV6Ha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ayHcQb8M34_MNbVsbAXnl-_ELL1SWdO57CQ.YyqYM-elsz7TkNjfrH3Alg"
fidesuser@a6c53654f2e8:/fides$ fides user permissions
2024-03-05 16:40:15.644 | DEBUG    |  - Logger configuration options in use | {'api_config': '{"destination": "", "colorize": false, "level": "DEBUG", "serialization": "", "log_pii": true}'}
> Loaded config from: /fides/src/fides/data/sample_project/fides.toml
Roles:
	owner
Associated scopes:
	cli-objects:create
	cli-objects:delete
	cli-objects:read
	cli-objects:update
	client:create
	client:delete
	client:read
	client:update
	config:read
	config:update
	connection:authorize
	connection:create_or_update
	connection:delete
	connection:instantiate
	connection:read
	connection_type:read
	connector_template:register
	consent:read
	consent_settings:read
	consent_settings:update
	ctl_dataset:create
	ctl_dataset:delete
	ctl_dataset:read
	ctl_dataset:update
	ctl_policy:create
	ctl_policy:delete
	ctl_policy:read
	ctl_policy:update
	current-privacy-preference:read
	data_category:create
	data_category:delete
	data_category:read
	data_category:update
	data_subject:create
	data_subject:delete
	data_subject:read
	data_subject:update
	data_use:create
	data_use:delete
	data_use:read
	data_use:update
	database:reset
	dataset:create_or_update
	dataset:delete
	dataset:read
	encryption:exec
	evaluation:create
	evaluation:delete
	evaluation:read
	evaluation:update
	fides_taxonomy:update
	generate:exec
	masking:exec
	masking:read
	messaging-template:update
	messaging:create_or_update
	messaging:delete
	messaging:read
	organization:create
	organization:delete
	organization:read
	organization:update
	policy:create_or_update
	policy:delete
	policy:read
	privacy-experience:create
	privacy-experience:read
	privacy-experience:update
	privacy-notice:create
	privacy-notice:read
	privacy-notice:update
	privacy-preference-history:read
	privacy-request-notifications:create_or_update
	privacy-request-notifications:read
	privacy-request:create
	privacy-request:delete
	privacy-request:read
	privacy-request:resume
	privacy-request:review
	privacy-request:transfer
	privacy-request:upload_data
	privacy-request:view_data
	rule:create_or_update
	rule:delete
	rule:read
	saas_config:create_or_update
	saas_config:delete
	saas_config:read
	scope:read
	storage:create_or_update
	storage:delete
	storage:read
	system:create
	system:delete
	system:read
	system:update
	system_manager:delete
	system_manager:read
	system_manager:update
	taxonomy:create
	taxonomy:delete
	taxonomy:update
	user-permission:assign_owners
	user-permission:create
	user-permission:read
	user-permission:update
	user:create
	user:delete
	user:password-reset
	user:read
	user:update
	validate:exec
	webhook:create_or_update
	webhook:delete
	webhook:read
Systems Under Management:
fidesuser@a6c53654f2e8:/fides$ fides user --help
2024-03-05 16:40:25.860 | DEBUG    |  - Logger configuration options in use | {'api_config': '{"destination": "", "colorize": false, "level": "DEBUG", "serialization": "", "log_pii": true}'}
> Loaded config from: /fides/src/fides/data/sample_project/fides.toml
                                                                                                                                                                                                                  
 Usage: fides user [OPTIONS] COMMAND [ARGS]...                                                                                                                                                                    
                                                                                                                                                                                                                  
 Click command group for interacting with user-related functionality.                                                                                                                                             
                                                                                                                                                                                                                  
╭─ Options ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --help  -h    Show this message and exit.                                                                                                                                                                      │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ create       Use the credentials file to create a new user. Gives full permissions to the new user.                                                                                                            │
│ login        Authenticate with the webserver and generate a user access token. Then store those credentials in a credentials file.                                                                             │
│ permissions  List the directly-assigned scopes and roles available to the current user.                                                                                                                        │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

fidesuser@a6c53654f2e8:/fides$ fides user create dave Testpassword1!
2024-03-05 16:40:42.637 | DEBUG    |  - Logger configuration options in use | {'api_config': '{"destination": "", "colorize": false, "level": "DEBUG", "serialization": "", "log_pii": true}'}
> Loaded config from: /fides/src/fides/data/sample_project/fides.toml
User: 'dave' created and assigned permissions: ['owner']
fidesuser@a6c53654f2e8:/fides$ fides user login -u dave -p Testpassword1!
2024-03-05 16:40:54.639 | DEBUG    |  - Logger configuration options in use | {'api_config': '{"destination": "", "colorize": false, "level": "DEBUG", "serialization": "", "log_pii": true}'}
> Loaded config from: /fides/src/fides/data/sample_project/fides.toml
Logged in as user: dave
Credentials file written to: /home/fidesuser/.fides_credentials
fidesuser@a6c53654f2e8:/fides$ cat /home/fidesuser/.fides_credentials
username = "dave"
user_id = "fid_6e833147-242e-4d91-a4a7-6ef9a4124b95"
access_token = "eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIn0..7glBmHCmCSymYHsW2SXFBw.CavsiBPZCUaDJVE-9-pcDsLomQuuNAmXd8ssP9PNviMHRgvffiQvHxhI5TQnG_TuxeQen_bHYTBKxj5bCGw_QgJjPrw10MK6Ojo9r7LhP5YC47bFbnvhuO_R3aYX8OQOrTgDT9Wf-18LtRRE3xhq-LaE1Ve-sUTjBIS_j22R2bcZXjd5xuk0.J30wsDYE6h7YBAx3qfQHZA"
fidesuser@a6c53654f2e8:/fides$ fides user permissions
2024-03-05 16:41:18.614 | DEBUG    |  - Logger configuration options in use | {'api_config': '{"destination": "", "colorize": false, "level": "DEBUG", "serialization": "", "log_pii": true}'}
> Loaded config from: /fides/src/fides/data/sample_project/fides.toml
Roles:
	owner
Associated scopes:
	cli-objects:create
	cli-objects:delete
	cli-objects:read
	cli-objects:update
	client:create
	client:delete
	client:read
	client:update
	config:read
	config:update
	connection:authorize
	connection:create_or_update
	connection:delete
	connection:instantiate
	connection:read
	connection_type:read
	connector_template:register
	consent:read
	consent_settings:read
	consent_settings:update
	ctl_dataset:create
	ctl_dataset:delete
	ctl_dataset:read
	ctl_dataset:update
	ctl_policy:create
	ctl_policy:delete
	ctl_policy:read
	ctl_policy:update
	current-privacy-preference:read
	data_category:create
	data_category:delete
	data_category:read
	data_category:update
	data_subject:create
	data_subject:delete
	data_subject:read
	data_subject:update
	data_use:create
	data_use:delete
	data_use:read
	data_use:update
	database:reset
	dataset:create_or_update
	dataset:delete
	dataset:read
	encryption:exec
	evaluation:create
	evaluation:delete
	evaluation:read
	evaluation:update
	fides_taxonomy:update
	generate:exec
	masking:exec
	masking:read
	messaging-template:update
	messaging:create_or_update
	messaging:delete
	messaging:read
	organization:create
	organization:delete
	organization:read
	organization:update
	policy:create_or_update
	policy:delete
	policy:read
	privacy-experience:create
	privacy-experience:read
	privacy-experience:update
	privacy-notice:create
	privacy-notice:read
	privacy-notice:update
	privacy-preference-history:read
	privacy-request-notifications:create_or_update
	privacy-request-notifications:read
	privacy-request:create
	privacy-request:delete
	privacy-request:read
	privacy-request:resume
	privacy-request:review
	privacy-request:transfer
	privacy-request:upload_data
	privacy-request:view_data
	rule:create_or_update
	rule:delete
	rule:read
	saas_config:create_or_update
	saas_config:delete
	saas_config:read
	scope:read
	storage:create_or_update
	storage:delete
	storage:read
	system:create
	system:delete
	system:read
	system:update
	system_manager:delete
	system_manager:read
	system_manager:update
	taxonomy:create
	taxonomy:delete
	taxonomy:update
	user-permission:assign_owners
	user-permission:create
	user-permission:read
	user-permission:update
	user:create
	user:delete
	user:password-reset
	user:read
	user:update
	validate:exec
	webhook:create_or_update
	webhook:delete
	webhook:read
Systems Under Management:

@daveqnet
Copy link
Contributor

daveqnet commented Mar 5, 2024

There are some CI test failures, however, as the tests expect the password to be present e.g. https://github.com/ethyca/fides/blob/main/tests/ctl/core/test_user.py

=================================== FAILURES ===================================
____________________ TestCredentials.test_valid_credentials ____________________

self = <tests.ctl.core.test_user.TestCredentials object at 0x7fd79cda9190>

    def test_valid_credentials(self):
        credentials = Credentials(
            username="test",
            ***,
            user_id="some_id",
            access_token="some_token",
        )
        assert credentials.username == "test"
>       assert credentials.password == "password"
E       AttributeError: 'Credentials' object has no attribute 'password'

tests/ctl/core/test_user.py:28: AttributeError
=========================== short test summary info ============================

@adamsachs
Copy link
Contributor

@tariqajyusuf thank you for the updates here!

to clear up the CI failure, i think you can just remove the password references in that test file. namely, removing L23 and L28 of tests/ctl/core/test_user.py.

let me know if you have any difficulties doing this or if you don't think it's the right approach! i can also make the changes for you if you'd prefer, just a bit lazy at the moment to check out your fork 😆 but happy to do it if that's better!

@tariqajyusuf
Copy link
Contributor Author

No worries, fixed @adamsachs @daveqnet

Copy link

codecov bot commented Mar 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.67%. Comparing base (1c2bed4) to head (a91c7c6).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4661      +/-   ##
==========================================
- Coverage   86.67%   86.67%   -0.01%     
==========================================
  Files         336      336              
  Lines       20090    20089       -1     
  Branches     2581     2581              
==========================================
- Hits        17414    17413       -1     
  Misses       2203     2203              
  Partials      473      473              

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

@daveqnet
Copy link
Contributor

daveqnet commented Mar 5, 2024

Much appreciated @tariqajyusuf! Just one final request: can you add the following in the top Unreleased section of CHANGELOG.md link in the repo root please?

### Changed
- Modify `fides user login` to not store plaintext password in `~/.fides-credentials` [#4661](https://github.com/ethyca/fides/pull/4661)

I'd do it myself, but I'd have to request permissions on your fork or raise a separate PR - thanks!

@tariqajyusuf
Copy link
Contributor Author

Done!

CHANGELOG.md Outdated
@@ -30,6 +30,7 @@ The types of changes are:

### Changed
- Update when GPP API reports signal status: ready [#4635](https://github.com/ethyca/fides/pull/4635)
- Modify `fides user login` to not store plaintext password in `~/.fides-credentials` [#4661](https://github.com/ethyca/fides/pull/4661)
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry Tariq, I should have been clearer, this changelog entry should go up further in the [Unreleased] section, not here in the [2.31.0] section.

Because of the timing, this particular change will be included in a later release than 2.31.0.

@tariqajyusuf
Copy link
Contributor Author

Whoops that's my bad, was caught multitasking and put it in the wrong section

Copy link
Contributor

@daveqnet daveqnet left a comment

Choose a reason for hiding this comment

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

Approved, with thanks!

@daveqnet daveqnet merged commit f48a227 into ethyca:main Mar 6, 2024
39 of 40 checks passed
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.

3 participants