Skip to content

fix: don't restore revoked access from the gpg-id files - #15

Open
millaguie wants to merge 1 commit into
lyz-code:mainfrom
millaguie:fix/user-revocation
Open

fix: don't restore revoked access from the gpg-id files#15
millaguie wants to merge 1 commit into
lyz-code:mainfrom
millaguie:fix/user-revocation

Conversation

@millaguie

Copy link
Copy Markdown

When a user's access was revoked, the next reload imported the keys back from the gpg-id file, undoing the revocation. Now an already imported gpg-id file is not merged again, only warned about if it holds keys the access store doesn't know.

Also revoke users matching by key or email, not just by name, and sort the keys when writing the gpg-id files so the output is stable.

Checklist

  • Add test cases to all the changes you introduce
  • Update the documentation for the changes

When a user's access was revoked, the next reload imported the keys back
from the gpg-id file, undoing the revocation. Now an already imported
gpg-id file is not merged again, only warned about if it holds keys the
access store doesn't know.

Also revoke users matching by key or email, not just by name, and sort
the keys when writing the gpg-id files so the output is stable.

@lyz-code lyz-code left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

if i'm understanding well your reasoning, i think you are trying to solve by code a situation created by a bad operation.

if you revoke the keys of a user, the .gpg-id files should be updated, so you should not find yourself needing these changes.

in fact, the solution should be to revoke the user again.

if the above operations don't do what i just said, then the pr should go in that direction

assert user == result


def test_auth_loads_gpg_id_even_if_entry_exists(

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I like this behaviour, why would you want to remove it?

Given: an auth store with a key in the access property
Then: The missing keys are loaded
Given: an auth store with an already imported gpg-id file
When: the gpg-id file has keys that the access store doesn't have

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

the test you made below doesn't reflect this case

# therefore the access to the directory doesn't change as it's
# binded to the group
if isinstance(revoke, User):
# An access entry can also be the key or the email of the user.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

that's why we use self.get_identifier in line 466.

so we shouldn't need this block

"""Import the gpg-id files that are not yet in the access store.

Merging the keys of an already imported gpg-id file would undo any
revocation done on the access store, so they are only warned about.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

no they wouldn't as the revocation takes care of this

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.

2 participants