8000 feat: Rbac more coderd endpoints, unit test to confirm by Emyrk · Pull Request #1406 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

feat: Rbac more coderd endpoints, unit test to confirm #1406

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

Closed
wants to merge 13 commits into from
Prev Previous commit
Next Next commit
Do not leak if an organization name exists
  • Loading branch information
Emyrk committed May 13, 2022
commit 4b6c9b069d6cbe56fe21436af8f73af125ad0372
6 changes: 4 additions & 2 deletions coderd/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,10 @@ func (api *api) organizationByUserAndName(rw http.ResponseWriter, r *http.Reques
organizationName := chi.URLParam(r, "organizationname")
organization, err := api.Database.GetOrganizationByName(r.Context(), organizationName)
if errors.Is(err, sql.ErrNoRows) {
httpapi.Write(rw, http.StatusNotFound, httpapi.Response{
Message: fmt.Sprintf("no organization found by name %q", organizationName),
// Return unauthorized rather than a 404 to not leak if the organization
// exists.
httpapi.Write(rw, http.StatusUnauthorized, httpapi.Response{
Message: "unauthorized",
})
return
}
Expand Down
0