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

Css 4790/better error masking #1035

Merged
merged 5 commits into from
Aug 25, 2023
Merged

Css 4790/better error masking #1035

merged 5 commits into from
Aug 25, 2023

Conversation

mina1460
Copy link
Contributor

@mina1460 mina1460 commented Aug 24, 2023

Description

This allows better error messages to appear instead of being masked for list auth relations.
As per the recommendation of @alesstimec, it is a good idea to mask errors that shouldn't appear to the user, but CodeBadRequest usually means that the user did something wrong, so we need to give him better error messages.

I scanned all references to BadRequest errors, and fixed the only two that masked the errors from the users.

Fixes CSS-4790

Engineering checklist

Check only items that apply

  • Documentation updated
  • Covered by unit tests
  • Covered by integration tests

@mina1460 mina1460 changed the base branch from main to feature-rebac August 24, 2023 09:20
@mina1460 mina1460 requested review from kian99 and ale8k August 24, 2023 10:54
@@ -82,7 +82,7 @@ func (r *controllerRoot) masquerade(ctx context.Context, userTag string) (*openf
func parseUserTag(tag string) (names.UserTag, error) {
ut, err := names.ParseUserTag(tag)
if err != nil {
return names.UserTag{}, errors.E(errors.CodeBadRequest, err)
return names.UserTag{}, errors.E(errors.CodeBadRequest, err, "invalid user tag")
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious why is this one masking the error but the then in jimm.go when we calls parseUserTag we don't mask the error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

my bad, I forgot to remove it.

@mina1460 mina1460 requested a review from kian99 August 25, 2023 06:39
@mina1460 mina1460 merged commit b9bb883 into canonical:feature-rebac Aug 25, 2023
1 check 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.

2 participants