Behaviour SwRS-MDOKFSTUDIO-CORE-013
Includes are bounded by depth, budget, size and allowed roots
When a chain of includes reaches the 8th level, an include repeats a file already being included, a render has expanded 2000 includes or 10 Mi characters of included text, an included file is larger than 5 MiB or cannot be read, or an include points outside the allowed roots, uses an absolute path or a URL scheme, has an undecodable path, has a symlink that escapes its root or names a missing file, the extension SHALL leave that directive as an unresolved placeholder and, for a refused or missing file or an exhausted budget, list a warning naming the request without reading a refused file.
Another outcome at step 1 of path 1 in StRS-MDOKFSTUDIO-CORE-002, in the state “A trusted document holds an include directive”.
Part of StRS-MDOKFSTUDIO-CORE-003, outside the paths drawn on its map.
Part of StRS-MDOKFSTUDIO-TRUST-006, outside the paths drawn on its map.
Scenarios 8
The situations the tests check; open one to read it.
nominalStop include depth
refusalStop include cycles
boundaryLimit the include budget per render
| Input | Outcome |
|---|---|
| a document with 2001 include directives | 2000 are expanded, the rest are placeholders and one budget warning ("Include budget exhausted") is listed |
| 10 Mi characters of included text expanded | the remaining includes are placeholders and one budget warning is listed |
| a document within both limits | no budget warning is listed |
boundaryRefuse oversize and unreadable included files
| Input | Outcome |
|---|---|
| an included file of 5 MiB plus one byte | the directive stays a placeholder and the file is not expanded |
| an included file of exactly 5 MiB | the file is expanded |
| a file inside the roots that the process cannot read | the directive stays a placeholder and nothing of the file is shown |
refusalRefuse includes outside the allowed roots
| Input | Outcome |
|---|---|
| an include that the allowed-roots rule (SwRS-MDOKFSTUDIO-TRUST-025) refuses: `../../secret.md` outside the roots, an absolute path, an undecodable path, a symlink that escapes its root | the file is not read and a warning naming the request is listed |
| an include with an `https:` URL | the URL is not fetched and a warning is listed |
refusalWarn about a missing included file
boundaryThe warning ends when the file exists
boundaryA file is checked once per render
Implemented in 3
Tested by 9
- test/core/render/contentCaches.test.tsunit
- test/core/render/includeBudget.test.tsunit
- test/core/render/renderReq.coreRows.requirements.test.tsunit
- test/core/render/renderReq.renderingCore.requirements.test.tsunit
- test/integration/projectFeatures.test.tsintegration
- test/security/resource-policy.memory.test.tsunit
- test/security/resource-policy.test.tsunit
- test/security/trustReq.requirements.test.tsunit
- test/session/webview.priming.test.tsunit