fix: return 403 when rebuilding workspace with require_active_version (#11114)

This commit is contained in:
Jon Ayers
2023-12-08 23:03:46 -06:00
committed by GitHub
parent 8488afa8df
commit 37f6b38d53
6 changed files with 7 additions and 6 deletions
+1 -1
View File
@@ -379,7 +379,7 @@ func (api *API) postWorkspaceBuilds(rw http.ResponseWriter, r *http.Request) {
if xerrors.As(err, &buildErr) {
var authErr dbauthz.NotAuthorizedError
if xerrors.As(err, &authErr) {
buildErr.Status = http.StatusUnauthorized
buildErr.Status = http.StatusForbidden
}
if buildErr.Status == http.StatusInternalServerError {
+1 -1
View File
@@ -353,7 +353,7 @@ func (b *Builder) buildTx(authFunc func(action rbac.Action, object rbac.Objecter
if err != nil {
code := http.StatusInternalServerError
if rbac.IsUnauthorizedError(err) {
code = http.StatusUnauthorized
code = http.StatusForbidden
}
return BuildError{code, "insert workspace build", err}
}