Skip to content

Commit

Permalink
fix Graph delete request leaks existence of space owncloud#5031
Browse files Browse the repository at this point in the history
  • Loading branch information
2403905 committed May 8, 2023
1 parent 428e696 commit d69decd
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 7 deletions.
6 changes: 6 additions & 0 deletions changelog/unreleased/fix-leaks-existence.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Hide the existence of space when deleting/updating

The "code": "notAllowed" changed to "code": "itemNotFound"

https://github.com/owncloud/ocis/issues/5031
https://github.com/owncloud/ocis/pull/6220
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -321,3 +321,6 @@ require (
)

replace github.com/cs3org/go-cs3apis => github.com/c0rby/go-cs3apis v0.0.0-20230110100311-5b424f1baa35

// TODO The temporal replacement
replace github.com/cs3org/reva/v2 => github.com/2403905/reva/v2 v2.0.0-20230504205508-69238ad9d885
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,8 @@ contrib.go.opencensus.io/exporter/ocagent v0.4.12/go.mod h1:450APlNTSR6FrvC3CTRq
contrib.go.opencensus.io/exporter/prometheus v0.4.2 h1:sqfsYl5GIY/L570iT+l93ehxaWJs2/OwXtiWwew3oAg=
contrib.go.opencensus.io/exporter/prometheus v0.4.2/go.mod h1:dvEHbiKmgvbr5pjaF9fpw1KeYcjrnC1J8B+JKjsZyRQ=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/2403905/reva/v2 v2.0.0-20230504205508-69238ad9d885 h1:kXk+da30WxZIg87Uo86MLWUnCTgBDt0Qqj9/YFODvjk=
github.com/2403905/reva/v2 v2.0.0-20230504205508-69238ad9d885/go.mod h1:VxBmpOvIKlgKLPOsHun+fABopzX+3ZELPAp3N5bQMsM=
github.com/Azure/azure-pipeline-go v0.2.3/go.mod h1:x841ezTBIMG6O3lAcl8ATHnsOPVl2bqk7S3ta6S6u4k=
github.com/Azure/azure-sdk-for-go v32.4.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
github.com/Azure/azure-storage-blob-go v0.14.0/go.mod h1:SMqIBi+SuiQH32bvyjngEewEeXoPfKMgWlBDaYf6fck=
Expand Down
12 changes: 8 additions & 4 deletions services/graph/pkg/service/v0/drives.go
Original file line number Diff line number Diff line change
Expand Up @@ -468,19 +468,19 @@ func (g Graph) UpdateDrive(w http.ResponseWriter, r *http.Request) {
switch resp.Status.GetCode() {
case cs3rpc.Code_CODE_NOT_FOUND:
logger.Debug().Interface("id", rid).Msg("could not update drive: drive not found")
errorcode.ItemNotFound.Render(w, r, http.StatusNotFound, resp.GetStatus().GetMessage())
errorcode.ItemNotFound.Render(w, r, http.StatusNotFound, "drive not found")
return
case cs3rpc.Code_CODE_PERMISSION_DENIED:
logger.Debug().Interface("id", rid).Msg("could not update drive, permission denied")
errorcode.NotAllowed.Render(w, r, http.StatusForbidden, resp.GetStatus().GetMessage())
errorcode.ItemNotFound.Render(w, r, http.StatusNotFound, "drive not found")
return
case cs3rpc.Code_CODE_INVALID_ARGUMENT:
logger.Debug().Interface("id", rid).Msg("could not update drive, invalid argument")
errorcode.NotAllowed.Render(w, r, http.StatusBadRequest, resp.GetStatus().GetMessage())
return
default:
logger.Debug().Interface("id", rid).Str("grpc", resp.GetStatus().GetMessage()).Msg("could not update drive: grpc error")
errorcode.GeneralException.Render(w, r, http.StatusInternalServerError, resp.GetStatus().GetMessage())
errorcode.GeneralException.Render(w, r, http.StatusInternalServerError, "grpc error")
return
}
}
Expand Down Expand Up @@ -1054,7 +1054,11 @@ func (g Graph) DeleteDrive(w http.ResponseWriter, r *http.Request) {
return
case cs3rpc.Code_CODE_PERMISSION_DENIED:
logger.Debug().Interface("id", rid).Msg("could not delete drive: permission denied")
errorcode.NotAllowed.Render(w, r, http.StatusForbidden, "permission denied to delete drive")
errorcode.ItemNotFound.Render(w, r, http.StatusNotFound, "drive not found")
return
case cs3rpc.Code_CODE_NOT_FOUND:
logger.Debug().Interface("id", rid).Msg("could not delete drive: drive not found")
errorcode.ItemNotFound.Render(w, r, http.StatusNotFound, "drive not found")
return
// don't expose internal error codes to the outside world
default:
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/features/apiSpaces/changeSpaces.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@api
@api
Feature: Change data of space
As a user with space admin rights
I want to be able to change the meta-data of a created space (increase the quota, change name, etc.)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@api
@api
Feature: Disabling and deleting space
As a manager of space
I want to be able to disable the space first, then delete it.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@api
@api
Feature: Space management
As a user with space admin permission
I want to be able to manage all existing project spaces
Expand Down

0 comments on commit d69decd

Please sign in to comment.