Behaviour SwRS-MDOKFSTUDIO-DIAG-054
The host reads an include only next to the including file in allowed folders
When the built-in engine asks the host for an include file, the host SHALL read it only next to the including file inside the allowed folders and refuse every other request with a reason.
Another outcome at step 1 of path 1 in StRS-MDOKFSTUDIO-DIAG-009, in the state “A diagram includes a local file”.
Part of StRS-MDOKFSTUDIO-DIAG-007, outside the paths drawn on its map.
Scenarios 6
The situations the tests check; open one to read it.
nominalIncludes resolve next to the including file
The base folder follows from.
| Input | Outcome |
|---|---|
| Include request with from null (top-level include) | the name is resolved from the previewed document's folder; a from of null is accepted |
| Include request whose from is the absolute path of an included file in a sub folder (nested include) | the name is resolved from that sub folder |
boundaryTrust state and files that are served
The folders an include may read follow the trust of the workspace.
| Input | Outcome |
|---|---|
| Trusted workspace, include of a sibling folder inside the workspace | the file is served |
| Restricted Mode (untrusted workspace), the same include | refused with the reason that the file is outside the folders the preview reads (only the document's folder and below are read) |
| Include file of a few kilobytes | served |
| Symbolic link whose target stays inside the allowed folders | the file is served |
refusalNames that are never read
Givenan include request for C4/C4_Context in angle brackets, a URL, or a name that is only spaces
Whenthe host resolves it
Thenit is refused without reading the disk
refusalReasons by kind of name
| Input | Outcome |
|---|---|
| Library name in angle brackets (C4/C4_Context) | reason saying the built-in engine reads no URL and no standard library |
| URL | same reason: the name is not a local file, the built-in engine reads no URL and no standard library |
| Name that is empty after trimming (only spaces) | The include names no file. |
| Absolute path (leading slash, or on Windows a drive or UNC path such as C:\diagrams\a.puml) | PlantUML file followed by the name and must be a relative path to a local file |
refusalA forged relative from is refused
Givenan include request with from equal to a relative path
Whenthe host resolves it
Thenit is refused with the reason PlantUML file followed by the name and could not be read
refusalA missing file or a file the rules reject
| Input | Outcome |
|---|---|
| File that does not exist in the document's folder | refused with the reason PlantUML file not found followed by the name, and the candidate path is reported for watching |
| Path outside the allowed folders (the rule of SwRS-MDOKFSTUDIO-TRUST-025), including a symbolic link in the document's folder that points outside the workspace, judged by its real path | refused with the outside-folders reason and no path is reported for watching |
| Include file larger than 5 MiB | refused with the reason that the file is larger than the 5 MiB preview limit |
Implemented in 1
Tested by 1
Replaces
SwRS-MDOKFSTUDIO-DIAG-055A forged relative from is refused superseded superseded by SwRS-MDOKFSTUDIO-DIAG-054 Markdown file
SwRS-MDOKFSTUDIO-DIAG-056Includes resolve next to the including file superseded superseded by SwRS-MDOKFSTUDIO-DIAG-054 Markdown file
SwRS-MDOKFSTUDIO-DIAG-057The trust state sets the folders an include may read superseded superseded by SwRS-MDOKFSTUDIO-DIAG-054 Markdown file
SwRS-MDOKFSTUDIO-DIAG-058A missing include file is refused and watched superseded superseded by SwRS-MDOKFSTUDIO-DIAG-054 Markdown file
SwRS-MDOKFSTUDIO-DIAG-059An include file over 5 MiB is refused superseded superseded by SwRS-MDOKFSTUDIO-DIAG-054 Markdown file
SwRS-MDOKFSTUDIO-DIAG-060A symlink leaving the allowed folders is refused superseded superseded by SwRS-MDOKFSTUDIO-DIAG-054 Markdown file