How to run shell commands and capture there output into a UML diagram.

0 votes
asked Oct 13, 2021 in Question / help by Curtis
I have a footer that generates info about the diagram, like the date and user who created the image. I would like to include the git SHA. I need some sort of built-in function, probably a preprocessor function, that lets me envoke system commands. I'm thinking something like the %date() command, only where I pass in the command and arguments I want to be executed and I get back the text from it being run in the shell. Something like

%sys_call("git rev-parse --short=10 HEAD")
commented Oct 13, 2021 by The-Lu (63,920 points)

Hello C. and PlantUML team,

Good request.
But this raises some security questions...

How to manage:

%sys_call("rm -f *")

See also PlantUML security works here:

Regards,
Th.

commented Oct 13, 2021 by anonymous
Hi Th.,

Good point, I agree that there could be security issues for folks that have PlantUML use cases where the user is not fully trusted. Looking at your link, I think there are security profiles that this command would fall under.

1 Answer

0 votes
answered Oct 14, 2021 by plantuml (294,960 points)

Another possible option for you would be that you generate some script that executes git rev-parse --short=10 HEAD and outputs the result into /tmp/foo

Then you can !include /tmp/foo from your diagram.

Having a %sys_call raises indeed a lot of concerns about security issue.

...