feat: [OCISDEV-720] fix public link (#12332)
This commit is contained in:
1 parent
029baed3c0
commit
d7a7cd9033
8 files changed
+25
-8
No files matched your search
@@ -0,0 +1,8 @@
|
||||
Security: Fix signing-key to public share guests
|
||||
|
||||
The /ocs/v[12].php/cloud/user/signing-key endpoint was reachable through a
|
||||
public share session.
|
||||
The endpoint `public-token` is no longer allowed by the public-share resource scope in reva.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/12332
|
||||
https://github.com/owncloud/reva/pull/608
|
||||
@@ -64,7 +64,7 @@ require (
|
||||
github.com/open-policy-agent/opa v1.12.3
|
||||
github.com/orcaman/concurrent-map v1.0.0
|
||||
github.com/owncloud/libre-graph-api-go v1.0.5-0.20260216101009-eeac018af245
|
||||
github.com/owncloud/reva/v2 v2.0.0-20260521084623-a3fad40c3868
|
||||
github.com/owncloud/reva/v2 v2.0.0-20260521135517-5cf6fa2c7dbf
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/pkg/xattr v0.4.12
|
||||
github.com/prometheus/client_golang v1.23.2
|
||||
|
||||
@@ -737,8 +737,8 @@ github.com/orcaman/concurrent-map v1.0.0 h1:I/2A2XPCb4IuQWcQhBhSwGfiuybl/J0ev9HD
|
||||
github.com/orcaman/concurrent-map v1.0.0/go.mod h1:Lu3tH6HLW3feq74c2GC+jIMS/K2CFcDWnWD9XkenwhI=
|
||||
github.com/owncloud/libre-graph-api-go v1.0.5-0.20260216101009-eeac018af245 h1:JRidLTAKhnvyLMRtVtSF4lhBa0NSAOs6fof+d6JnKII=
|
||||
github.com/owncloud/libre-graph-api-go v1.0.5-0.20260216101009-eeac018af245/go.mod h1:z61VMGAJRtR1nbgXWiNoCkxUXP1B3Je9rMuJbnGd+Og=
|
||||
github.com/owncloud/reva/v2 v2.0.0-20260521084623-a3fad40c3868 h1:O27SKPxuJrzsrG6ulB55WSb0dGdTukGtBLWLNgGN7vQ=
|
||||
github.com/owncloud/reva/v2 v2.0.0-20260521084623-a3fad40c3868/go.mod h1:oHjvB9PhfF8QqiNGz7Hd4AVvR7CSPx3CLVRxUzmjK0w=
|
||||
github.com/owncloud/reva/v2 v2.0.0-20260521135517-5cf6fa2c7dbf h1:VSRW0jZVcDrmwCwEoXZAIPQi3Agnes9uiNTdWGKjzKg=
|
||||
github.com/owncloud/reva/v2 v2.0.0-20260521135517-5cf6fa2c7dbf/go.mod h1:oHjvB9PhfF8QqiNGz7Hd4AVvR7CSPx3CLVRxUzmjK0w=
|
||||
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw=
|
||||
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0=
|
||||
github.com/pablodz/inotifywaitgo v0.0.9 h1:njquRbBU7fuwIe5rEvtaniVBjwWzcpdUVptSgzFqZsw=
|
||||
|
||||
@@ -6,9 +6,11 @@ import (
|
||||
"errors"
|
||||
"net/http"
|
||||
|
||||
cs3user "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
|
||||
"github.com/owncloud/ocis/v2/services/ocs/pkg/service/v0/data"
|
||||
"github.com/owncloud/ocis/v2/services/ocs/pkg/service/v0/response"
|
||||
revactx "github.com/owncloud/reva/v2/pkg/ctx"
|
||||
"github.com/owncloud/reva/v2/pkg/utils"
|
||||
"go-micro.dev/v4/store"
|
||||
)
|
||||
|
||||
@@ -23,6 +25,13 @@ func (o Ocs) GetSigningKey(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
// Refuse to disclose the signing key to public-share guests; the key belongs to
|
||||
// the share owner and would let the caller forge signed URLs as that user.
|
||||
if u.GetId().GetType() == cs3user.UserType_USER_TYPE_GUEST || utils.ExistsInOpaque(u.GetOpaque(), "public-share-role") {
|
||||
o.mustRender(w, r, response.ErrRender(data.MetaUnauthorized.StatusCode, "unauthorized"))
|
||||
return
|
||||
}
|
||||
|
||||
// use the user's UUID
|
||||
userID := u.Id.OpaqueId
|
||||
|
||||
|
||||
@@ -32,8 +32,6 @@ var (
|
||||
"/ocs/v2.php/apps/files_sharing/api/v1/tokeninfo/unprotected",
|
||||
"/ocs/v1.php/cloud/capabilities",
|
||||
"/ocs/v2.php/cloud/capabilities",
|
||||
"/ocs/v1.php/cloud/user/signing-key",
|
||||
"/ocs/v2.php/cloud/user/signing-key",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -35,6 +35,10 @@ var _ = Describe("authentication helpers", func() {
|
||||
Entry("token info path", "/ocs/v1.php/apps/files_sharing/api/v1/tokeninfo/unprotected", true),
|
||||
Entry("token info path", "/ocs/v2.php/apps/files_sharing/api/v1/tokeninfo/unprotected", true),
|
||||
Entry("capabilities", "/ocs/v1.php/cloud/capabilities", true),
|
||||
// The signing-key endpoint must NOT be a public path; otherwise a public-share
|
||||
// guest could fetch the share owner's signing key and forge signed URLs.
|
||||
Entry("signing-key v1 must not be public", "/ocs/v1.php/cloud/user/signing-key", false),
|
||||
Entry("signing-key v2 must not be public", "/ocs/v2.php/cloud/user/signing-key", false),
|
||||
)
|
||||
})
|
||||
|
||||
|
||||
-2
@@ -135,8 +135,6 @@ func checkResourcePath(path string) bool {
|
||||
"/archiver",
|
||||
"/ocs/v2.php/cloud/capabilities",
|
||||
"/ocs/v1.php/cloud/capabilities",
|
||||
"/ocs/v1.php/cloud/user/signing-key",
|
||||
"/ocs/v2.php/cloud/user/signing-key",
|
||||
"/ocs/v2.php/apps/notifications/api/v1/notifications/sse",
|
||||
}
|
||||
for _, p := range paths {
|
||||
|
||||
Vendored
+1
-1
@@ -1319,7 +1319,7 @@ github.com/orcaman/concurrent-map
|
||||
# github.com/owncloud/libre-graph-api-go v1.0.5-0.20260216101009-eeac018af245
|
||||
## explicit; go 1.18
|
||||
github.com/owncloud/libre-graph-api-go
|
||||
# github.com/owncloud/reva/v2 v2.0.0-20260521084623-a3fad40c3868
|
||||
# github.com/owncloud/reva/v2 v2.0.0-20260521135517-5cf6fa2c7dbf
|
||||
## explicit; go 1.25.7
|
||||
github.com/owncloud/reva/v2/cmd/revad/internal/grace
|
||||
github.com/owncloud/reva/v2/cmd/revad/runtime
|
||||
|
||||
Reference in new issue
Block a user