Skip to content

iOS: SecurityScopedAncestorUrl not passed to child items #19570

@dmirmilshteyn

Description

@dmirmilshteyn

Describe the bug

When using IStorageFolder::GetFolderAsync and IStorageFolder::GetFileAsync, the returned storage items don't pass in the SecurityScopedAncestorUrl. It then defaults to the child item path, which is incorrect. This prevents accessing child items from folders outside the app sandbox.

All other operations pass in the SecurityScopedAncestorUrl when accessing child items.

IOSStorageFolder.cs:

    public Task<IStorageFolder?> GetFolderAsync(string name)
    {
        var url = GetItem(name, true);
        return Task.FromResult<IStorageFolder?>(url is null ? null : new IOSStorageFolder(url));
    }

    public Task<IStorageFile?> GetFileAsync(string name)
    {
        var url = GetItem(name, false);
        return Task.FromResult<IStorageFile?>(url is null ? null : new IOSStorageFile(url));
    }

To Reproduce

  • Use a directory picker to access a folder outside the app sandbox.
  • Programatically access a child directory or file of the selected folder.
  • Attempt to read/write to that child directory or file. It should fail.

Expected behavior

No response

Avalonia version

11.3.4

OS

iOS

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions