Skip to content

Commit

Permalink
eosfs: update getUser to check uid and gid
Browse files Browse the repository at this point in the history
Update getUser to verify that uid and gid are not zero to avoid
granting access to users by mistake.
  • Loading branch information
sudo-sturbia committed Mar 19, 2021
1 parent addfc1b commit 0cb5c88
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/storage/utils/eosfs/eosfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,12 @@ func getUser(ctx context.Context) (*userpb.User, error) {
err := errors.Wrap(errtypes.UserRequired(""), "eos: error getting user from ctx")
return nil, err
}
if u.UidNumber == 0 {
return nil, errors.New("eos: invalid user id")
}
if u.GidNumber == 0 {
return nil, errors.New("eos: invalid group id")
}
return u, nil
}

Expand Down

0 comments on commit 0cb5c88

Please sign in to comment.