Behaviour SwRS-MDOKFSTUDIO-TRUST-002
A preview with restricted reads reads includes and resources from the folder of its document only, and no home folder or dot-directory
When a preview has restricted reads (no workspace folder, or Restricted Mode; editing is not affected), the extension SHALL refuse every include and resource whose path lies below a dot-segment, and SHALL read includes and resources other than images from the folder of the document only, and none of them when that folder is the home folder of the user, a folder that contains it or a file-system root, showing the reason as a diagnostic.
Part of StRS-MDOKFSTUDIO-TRUST-004, outside the paths drawn on its map.
Scenarios 5
The situations the tests check; open one to read it.
nominalPreview with restricted reads in an ordinary folder
Givena preview with restricted reads of a document in a folder that is not the home folder
Whenthe document includes a file next to it, or loads an image next to it
Thenthe include and the image are served as before
refusalNon-image resource and include outside the document folder
Giventhe same preview with restricted reads
Whena file that is not an image, or an include, lies in the workspace folder outside the folder of the document
Thenit is refused with the code resource-outside-root, as before
refusalDot-directory
Givena preview with restricted reads in any folder
Whenan include or a resource names a path with a segment that starts with a dot below the folder of the document (.ssh/id_rsa, .agents/rule.md), or a symbolic link that leads to such a path
Thenit is refused with the code hidden-path and the diagnostic "A preview with restricted reads does not read paths inside dot-directories such as .ssh or .config."
refusalBroad folder
Givena preview with restricted reads whose document is in the home folder, in a folder that contains it (such as /Users) or in a file-system or drive root
Whenan include or a resource that is not an image is requested, even a plain file next to the document
Thenit is refused with the code restricted-root and the diagnostic that names the home folder
boundaryTrusted workspace
Givena preview of a trusted workspace folder
Whena document includes a file inside a dot-directory such as .agents
Thenthe file is included (the dot-segment rule applies to previews with restricted reads only)