You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enable restricted parsing to disable `!script` and other dangerous methods to be executed during parsing
By default, Kroki will parse Structurizr diagrams in "restricted mode" unless `KROKI_STRUCTURIZR_SAFE_MODE` (or `KROKI_SAFE_MODE`) is set to `unsafe`.
Copy file name to clipboardExpand all lines: docs/modules/setup/pages/configuration.adoc
+11-1
Original file line number
Diff line number
Diff line change
@@ -59,13 +59,15 @@ By default, Kroki is running in `SECURE` mode.
59
59
====
60
60
Some diagram libraries allow referencing external entities by URL or accessing resources from the filesystem.
61
61
62
-
For example PlantUML allows the `!import` directive to pull fragments from the filesystem or a remote URL or the standard library.
62
+
For example, PlantUML allows the `!import` directive to pull fragments from the filesystem or a remote URL or the standard library.
63
63
64
64
It is the responsibility of the upstream codebases to ensure that they can be safely used without risk.
65
65
Because Kroki does not perform code review of these services, our default setting is to be paranoid and block imports unless known safe.
66
66
We encourage anyone running their own Kroki server to review the services security settings and select the security mode appropriate for their use case.
67
67
====
68
68
69
+
=== PlantUML
70
+
69
71
While running in `SECURE` mode, Kroki will prevent PlantUML from including files using the `!include` or `!includeurl` directive.
70
72
71
73
If you want to enable this feature, you can set the safe mode using the environment variable `KROKI_SAFE_MODE`:
@@ -82,6 +84,14 @@ KROKI_PLANTUML_INCLUDE_WHITELIST:: The name of a file that consists of a list of
82
84
KROKI_PLANTUML_INCLUDE_WHITELIST_0, KROKI_PLANTUML_INCLUDE_WHITELIST_1, ... KROKI_PLANTUML_INCLUDE_WHITELIST___N__:: One regex to add to the include whitelist per environment variable. Search will stop at the first empty or undefined integer number.
83
85
KROKI_PLANTUML_ALLOW_INCLUDE:: Either `false` (default) or `true`. Determines if PlantUML will fetch `!include` directives that reference external URLs. For example, PlantUML allows the !import directive to pull fragments from the filesystem or a remote URL or the standard library.
84
86
87
+
=== Structurizr
88
+
89
+
Structurizr's restricted mode is activated unless Kroki is running in `UNSAFE` mode:
90
+
91
+
> Run this parser in restricted mode (this stops `!include`, `!docs`, `!adrs` from working).
92
+
93
+
If you want to enable this feature, you can set the safe mode using the global environment variable `KROKI_SAFE_MODE` or the specific environment variable `KROKI_STRUCTURIZR_SAFE_MODE` (i.e., the safe mode will only apply to Structurizr).
.hasMessageStartingWith("Unable to parse the Structurizr DSL. !docs is not available when the parser is running in restricted mode at line 5: !docs src/test/resources/docs");
138
+
} else {
139
+
logger.info("/usr/bin/dot not found, skipping test.");
.hasMessageStartingWith("Unable to parse the Structurizr DSL. Error running inline script, caused by java.lang.RuntimeException: Could not load a scripting engine for extension \"kts\" at line 5");
0 commit comments