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

BadRequest when exporting GDPR for other user #6123

Merged
merged 1 commit into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions changelog/unreleased/bad-request-on-gdpr-endpoint.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Enhancement: Return Bad Request when requesting GDPR export for another user

This is an enhancement, not security related as the requested uid is never used

https://github.com/owncloud/ocis/pull/6123
7 changes: 7 additions & 0 deletions services/graph/pkg/service/v0/personaldata.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/cs3org/reva/v2/pkg/events"
"github.com/cs3org/reva/v2/pkg/rhttp"
"github.com/cs3org/reva/v2/pkg/utils"
"github.com/go-chi/chi/v5"
ehmsg "github.com/owncloud/ocis/v2/protogen/gen/ocis/messages/eventhistory/v0"
ehsvc "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/eventhistory/v0"
)
Expand All @@ -42,6 +43,12 @@ type ExportPersonalDataRequest struct {
func (g Graph) ExportPersonalData(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
u := revactx.ContextMustGetUser(ctx)
if reqUserID := chi.URLParam(r, "userID"); reqUserID != u.GetId().GetOpaqueId() {
g.logger.Info().Msg("uid mismatch")
w.WriteHeader(http.StatusBadRequest)
_, _ = w.Write([]byte("personal data export for other users are not permitted"))
return
}
// Get location from request
loc := getLocation(r)

Expand Down