Skip to content

add some access/credentials tests + emit events if unauthorized#879

Merged
giurgiur99 merged 42 commits intomainfrom
issue-840-accessTests
Apr 17, 2025
Merged

add some access/credentials tests + emit events if unauthorized#879
giurgiur99 merged 42 commits intomainfrom
issue-840-accessTests

Conversation

@paulo-ocean
Copy link
Copy Markdown
Contributor

Fixes #840

Changes proposed in this PR:

@paulo-ocean paulo-ocean self-assigned this Mar 12, 2025
@paulo-ocean paulo-ocean marked this pull request as ready for review March 14, 2025 16:48
@alexcos20
Copy link
Copy Markdown
Member

why do we need to emit events?

@paulo-ocean
Copy link
Copy Markdown
Contributor Author

paulo-ocean commented Mar 20, 2025

why do we need to emit events?

we don't necessarily need them for the functionality, but its important to properly test access related stuff... for the tests infrastructure basically... without this its impossible to know what happened if something went wrong..

consider the following:
i can try to publish an asset, but a lot of things could fail, either i'm not allowed to publish it... or i cannot validate it, or i cannot decrypt it. or some other generic error... we have now multiple roles and a lot of credentials configurations involved as well...

If i try to look for that asset, and something failed, its not there, its not indexed, but how do i know what happened?... Where was the issue?..

If we emit some AUTH related events, we can catch those (if we want) and properly test the access/credentials/roles changes.. we can at least distinguish if it was access related

Without it, we can't..

That was the main idea. Not necessary but useful

@giurgiur99 giurgiur99 self-requested a review as a code owner April 9, 2025 08:37
@giurgiur99
Copy link
Copy Markdown
Contributor

Should we keep the events mentioned here? I don't find them mandatory. @alexcos20

@mariacarmina
Copy link
Copy Markdown
Contributor

mariacarmina commented Apr 16, 2025

why do we need to emit events?

we don't necessarily need them for the functionality, but its important to properly test access related stuff... for the tests infrastructure basically... without this its impossible to know what happened if something went wrong..

consider the following: i can try to publish an asset, but a lot of things could fail, either i'm not allowed to publish it... or i cannot validate it, or i cannot decrypt it. or some other generic error... we have now multiple roles and a lot of credentials configurations involved as well...

If i try to look for that asset, and something failed, its not there, its not indexed, but how do i know what happened?... Where was the issue?..

If we emit some AUTH related events, we can catch those (if we want) and properly test the access/credentials/roles changes.. we can at least distinguish if it was access related

Without it, we can't..

That was the main idea. Not necessary but useful

Regarding this comment, I think maintaining events for authorisation checks is overengineering/overcomplicated, the error should be traceable via logs as we do for decryption errors, validation errors and so on. My suggestion is to not over complicate and remove them + tests update.

Copy link
Copy Markdown
Contributor

@giurgiur99 giurgiur99 left a comment

Choose a reason for hiding this comment

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

LGTM now

Copy link
Copy Markdown
Member

@alexcos20 alexcos20 left a comment

Choose a reason for hiding this comment

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

lgtm

@giurgiur99 giurgiur99 merged commit d41e57f into main Apr 17, 2025
13 checks passed
@giurgiur99 giurgiur99 deleted the issue-840-accessTests branch April 17, 2025 07:28
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.

Create tests for AccessLists new variables (ADMIN, PUBLISHER, VALIDATOR, DECRYPTOR) + refactor common code

5 participants