chore: bump reva to latest stable-2.52

This commit is contained in:
André Duffeck committed 2026-11-17 09:20:51 +01:00
1 parent 93114465ae
commit 97715249d7
7 files changed
+29 -11

No files matched your search

@@ -207,7 +207,7 @@ func (tp *Tree) DownloadRevision(ctx context.Context, ref *provider.Reference, r
// verify revision key format
kp := strings.SplitN(revisionKey, node.RevisionIDDelimiter, 2)
if len(kp) != 2 {
if len(kp) != 2 || !node.IsValidID(revisionKey) {
log.Error().Str("revisionKey", revisionKey).Msg("malformed revisionKey")
return nil, nil, errtypes.NotFound(revisionKey)
}
@@ -376,6 +376,11 @@ func LockAndReadNode(ctx context.Context, lu PathLookup, spaceID, nodeID, intern
ctx, span := tracer.Start(ctx, "LockAndReadNode")
defer span.End()
// validate before the lock file is created from the ids
if !IsValidID(spaceID) || !IsValidID(nodeID) {
return nil, nil, errtypes.NotFound(nodeID)
}
_, subspan := tracer.Start(ctx, "MetadataBackend.Lock")
bn := NewBaseNode(spaceID, nodeID, lu)
unlock, err := lu.MetadataBackend().Lock(bn)
@@ -401,6 +406,14 @@ func LockAndReadNode(ctx context.Context, lu PathLookup, spaceID, nodeID, intern
}, nil
}
// IsValidID returns false for ids that cannot be turned into a path below the
// space root: ids containing a path separator, a NUL byte or "..". Ids are
// opaque but come from the client, e.g. as the parent of a new file, and the
// revision suffix after RevisionIDDelimiter is appended to the node path as is.
func IsValidID(id string) bool {
return !strings.ContainsAny(id, "/\x00") && !strings.Contains(id, "..")
}
// ReadNode creates a new instance from an id and checks if it exists
func ReadNode(ctx context.Context, lu PathLookup, spaceID, nodeID, internalPath string, canListDisabledSpace bool, spaceRoot *Node, skipParentCheck bool) (*Node, error) {
return readNode(ctx, lu, spaceID, nodeID, internalPath, canListDisabledSpace, spaceRoot, skipParentCheck, false)
@@ -414,6 +427,13 @@ func readNode(ctx context.Context, lu PathLookup, spaceID, nodeID, internalPath
defer span.End()
var err error
// the ids become path segments below the space root, a separator in them
// would make the path leave the node directory while the permissions are
// checked on the node named before the revision delimiter
if !IsValidID(spaceID) || !IsValidID(nodeID) {
return nil, errtypes.NotFound(nodeID)
}
if spaceRoot == nil {
// read space root
spaceRoot = &Node{
@@ -62,7 +62,7 @@ func (fs *Decomposedfs) RestoreRevision(ctx context.Context, ref *provider.Refer
// verify revision key format
kp := strings.SplitN(revisionKey, node.RevisionIDDelimiter, 2)
if len(kp) != 2 {
if len(kp) != 2 || !node.IsValidID(revisionKey) {
log.Error().Str("revisionKey", revisionKey).Msg("malformed revisionKey")
return nil, errtypes.NotFound(revisionKey)
}
@@ -176,7 +176,7 @@ func (fs *Decomposedfs) DeleteRevision(ctx context.Context, ref *provider.Refere
// sidecars and its own blob. It is a no-op if the revision does not exist.
func (fs *Decomposedfs) deleteRevisionFile(ctx context.Context, n *node.Node, revisionKey string) error {
kp := strings.SplitN(revisionKey, node.RevisionIDDelimiter, 2)
if len(kp) != 2 {
if len(kp) != 2 || !node.IsValidID(revisionKey) {
return errtypes.NotFound(revisionKey)
}
@@ -199,7 +199,7 @@ func (fs *Decomposedfs) getRevisionNode(ctx context.Context, ref *provider.Refer
// verify revision key format
kp := strings.SplitN(revisionKey, node.RevisionIDDelimiter, 2)
if len(kp) != 2 {
if len(kp) != 2 || !node.IsValidID(revisionKey) {
log.Error().Str("revisionKey", revisionKey).Msg("malformed revisionKey")
return nil, errtypes.NotFound(revisionKey)
}
@@ -207,7 +207,7 @@ func (tp *Tree) DownloadRevision(ctx context.Context, ref *provider.Reference, r
// verify revision key format
kp := strings.SplitN(revisionKey, node.RevisionIDDelimiter, 2)
if len(kp) != 2 {
if len(kp) != 2 || !node.IsValidID(revisionKey) {
log.Error().Str("revisionKey", revisionKey).Msg("malformed revisionKey")
return nil, nil, errtypes.NotFound(revisionKey)
}