-Dplantuml.include.path broken in 2019.11 when used with WAR file on jetty

0 votes
asked Oct 26, 2019 in Bug by bharat (160 points)

Hi

I have sequnce diagrams that use the !include directive extensively for maintaining consistency (skins, constants, hyperlinks)

In order to get better rendering speed, i run my own plantuml server using jetty on my mac and i pass the

-Dplantuml.include.path

argument in JAVA_OPTIONS in my .jettyrc. 

This works very well and i can switch between local rendering or server rendering without needing to change the content of my plantuml file.This broke after i updated to 2019.11 War file. So for now i have gone back to the 2019.10 version

So an example of use

!include constants.pu

(where constants.pu is a file in the folder specified by plantuml.includepath.)

This basically throws an error like below in 2019.11

Error found in diagram 0.3.1.1_-_Scheduling_-_Expedited_Scheduling
cannot include constants.pu (@ Diagram Line 1, File Line 2)
"!include constants.pu"
(Error)

Note that specifying a full url works in both 2019.10 and 2019.11 wars

e.g.

!include http://localhost:8080/include/constants.pu

But it was nicer to just specify the file directly and having a global constant deal with its actual location  as the location could be different depending on where it was deployed.

C

QUESTION 2:

Over and above - is there a way to specify include paths as URLs? i.e. as below

-Dplantuml.include.path=http://<server>:<port>/<folder>

That lends itself nicely to server deployments where i can point to the raw file in say github without needing to explicitly put the full url in every pu file in the project.

Best regards,

Bharat

commented Nov 1, 2019 by bharat (160 points)
OK I worked out that i can set an environment variable .e.g INCLUDE_PATH=http://<server>:<port>/<folder>/

and then i can use !include %getenv("INCLUDE_PATH)file to include it

on my local tomcat i can expose the include folder using the context path so this actually works better than include path

However it seems that %getenv is broken in 1.2019.11 - e.g. if i do %getenv("HOME") i was getting my home folder in 1.2019.10 but in 1.2019.11 it returns blank....

Any suggestions?
commented Nov 1, 2019 by bharat (160 points)
Interestingly if i take the 1.2019.10 war file and update it with the plantum.1.2019.11 jar - it still works, so i guess, so presumably the issue is somewhere else in the war file...

This gives me the latest plantuml jar, so will use this for the time being.
commented Nov 2, 2019 by bharat (160 points)

I have traced why this stopped working. This change was done on 26

https://github.com/plantuml/plantuml-server/commit/83138142c5f0f0b1111add203ebc33eda803dc47

as a resolution for this

https://github.com/plantuml/plantuml-server/issues/122

I get that this was disabled for security considerations - but there needs to be a compromise - if i am specifically plantuml.include.path then the server should allow inclusion of files only from that path and not elsewhere.

For now Setting ALLOW_PLANTUML_INCLUDE=true in my environment variables lets me work around this at the cost of security - i am running this on my local machine for my personal use so that is not a problem, but i obviously wouldn't run it on my local intranet.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:

[Antispam2 Feature: please please wait 1 or 2 minutes (this message will disappear) before pressing the button otherwise it will fail](--------)
To avoid this verification in future, please log in or register.
...