Behaviour SwRS-MDOKFSTUDIO-DIAG-084
The JAR pipeline runs java or plantuml once per diagram on stdin, at most 2 at once
When useJar is true in a trusted workspace, the extension SHALL render each PlantUML diagram by starting its own process in the workspace folder, at most 2 at once, and return the pictures in document order, running java with the arguments -jar, the resolved JAR path, -pipe and -tsvg when jarPath is not empty and the plantuml command with -pipe and -tsvg otherwise, each process under the PlantUML security profile ALLOWLIST with the workspace folder as its allowlist path and an image size limit of 4096, writing the diagram text to its standard input and taking as the picture the output from the first svg start tag to the last svg end tag. Before any process starts, the extension SHALL refuse a diagram with an include directive whose file (or whose nested include) leaves the workspace folder, by parent segments, an absolute path, a sibling folder sharing the folder-name prefix or a symbolic link, or is computed by a function or variable, and show a message instead of the picture.
Step 2 of path 1 in StRS-MDOKFSTUDIO-DIAG-007: from “The JAR pipeline is selected” to “The JAR has drawn the diagrams of the render”.
Scenarios 8
The situations the tests check; open one to read it.
nominalJAR configured
its environment sets PLANTUML_SECURITY_PROFILE to ALLOWLIST, PLANTUML_LIMIT_SIZE to 4096 and PLANTUML_ALLOWLIST_PATH to the workspace folder
nominalPATH command
its environment carries the same three PlantUML variables
boundaryReading and resolving jarPath
| Input | Outcome |
|---|---|
| jarPath of two spaces, a path and a tab | the result is the path without the padding |
| jarPath holding only spaces | the setting reads as empty and the plantuml command is used instead |
| jarPath holding a number (not a string) | the result is the empty string |
| Relative jarPath tools/plantuml.jar with a workspace folder | java is given the JAR path inside the workspace folder |
| Absolute jarPath | java is given that path unchanged |
refusalCommand missing
nominalText on standard input, workspace folder as working directory
nominalThe picture is the SVG span of the output
refusalInclude leaves the workspace folder
includes inside the folder, URLs and standard-library names are passed to the process unchanged
boundaryOne process per diagram, at most 2 at once
| Input | Outcome |
|---|---|
| three PlantUML diagrams in one page | three processes in all, never more than 2 at once; the third starts when one of the first two finishes |
| five diagrams in one page | never more than 2 processes run together and all 5 are rendered |
| diagrams that finish in another order than the page order | the pictures come back in document order |
| a document without PlantUML diagrams | no process starts and the result is empty |
Implemented in 3
Tested by 5
Known limits (2)
- The JAR and PATH pipeline asks for no dark variant, so its picture is the same in the light and dark preview.
- The renderer has an executablePath option that no setting feeds; only visual fixtures pass it, so users cannot change the command name.