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
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions internal/jujuapi/access_control.go
Original file line number Diff line number Diff line change
Expand Up @@ -576,9 +576,6 @@ func (r *controllerRoot) ListRelationshipTuples(ctx context.Context, req apipara
if req.Tuple.TargetObject != "" {
key, err = r.parseTuple(ctx, req.Tuple)
if err != nil {
if errors.ErrorCode(err) == errors.CodeFailedToParseTupleKey {
return returnValue, errors.E(op, errors.CodeBadRequest, "failed to parse the tuple key")
}
return returnValue, errors.E(op, err)
}
}
Expand Down
2 changes: 1 addition & 1 deletion internal/jujuapi/controllerroot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.

}
if ut.IsLocal() {
return names.UserTag{}, errors.E(errors.CodeBadRequest, "unsupported local user")
Expand Down
4 changes: 2 additions & 2 deletions internal/jujuapi/jimm.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ func (r *controllerRoot) GrantAuditLogAccess(ctx context.Context, req apiparams.

ut, err := parseUserTag(req.UserTag)
if err != nil {
return errors.E(op, err, errors.CodeBadRequest, "invalid user tag")
return errors.E(op, err, errors.CodeBadRequest)
}

err = r.jimm.GrantAuditLogAccess(ctx, r.user, ut)
Expand All @@ -414,7 +414,7 @@ func (r *controllerRoot) RevokeAuditLogAccess(ctx context.Context, req apiparams

ut, err := parseUserTag(req.UserTag)
if err != nil {
return errors.E(op, err, errors.CodeBadRequest, "invalid user tag")
return errors.E(op, err, errors.CodeBadRequest)
}

err = r.jimm.RevokeAuditLogAccess(ctx, r.user, ut)
Expand Down
Loading