marp-team / marp-cli

A CLI interface for Marp and Marpit based converters
MIT License
1.85k stars 105 forks source link

Local file access is a container not working despite using `--allow-local-file` #506

Closed spkane closed 1 year ago

spkane commented 1 year ago

I have used this tool for a long time with the following command, and it appears as if it has started blocking the local file access, despite what should be a proper setup.

$ docker container run --rm -v ${PWD}:/home/marp/app/ marpteam/marp-cli:latest target.md --theme-set spkane.css --pdf --allow-local-file
[  INFO ] Converting 1 markdown...
[  WARN ] Insecure local file accessing is enabled for conversion from
          target.md.
[  WARN ] Marp CLI has detected accessing to local files. They are blocked by
          security reason. Instead we recommend using assets uploaded to online.
          (Or you can use --allow-local-files option if you are understood of
          security risk)
[  INFO ] target.md => target.pdf

it warns that Insecure local file accessing is enabled and then warns that this is being blocked anyhow and that I should use --allow-local-file, which I already am.

I am on macOS, using Docker Desktop.

Everything used also exists in the local file system.

$ ls ./target.md ./spkane.css ./images/
./spkane.css ./target.md

./images/:
chalkboard-16by9.jpg              skane-2018-side-black-cropped.jpg
graph.png                         techlabs-dark.png

Any help would be much appreciated.

I have tried to go back a few revisions, and I still see the error, which confuses me since this worked a while ago.

spkane commented 1 year ago

For the moment, I have used Homebrew to install the marp CLI and that seems to be working fine, so it is likely something specific to the Linux container.

spkane commented 1 year ago

This also appears to only be impacting the PDF and PPTX renders. The HTML render appears to work fine, and only displayed the first warning, but not the second one.

yhatt commented 1 year ago

I could not reproduce that in my macOS 13.2.1 with Docker Desktop 4.16.2. Could you share a minimum and concrete set of Markdown/resources and the Docker command to reproduce the error?

spkane commented 1 year ago
Client:
 Cloud integration: v1.0.29
 Version:           20.10.22
 API version:       1.41
 Go version:        go1.18.9
 Git commit:        3a2c30b
 Built:             Thu Dec 15 22:28:41 2022
 OS/Arch:           darwin/amd64
 Context:           default
 Experimental:      true

Server: Docker Desktop 4.16.2 (95914)
 Engine:
  Version:          20.10.22
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.18.9
  Git commit:       42c8b31
  Built:            Thu Dec 15 22:26:14 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.14
  GitCommit:        9ba4b250366a5ddde94bb7c9d1def331423aa323
 runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

and running a command like this:

$ docker container run --rm -v /Users/spkane/Dropbox/class-materials:/home/marp/app/ marpteam/marp-cli:latest target.md --theme-set spkane.css --pdf --allow-local-files

But oddly, I can not reproduce this anymore either. The second warning is no longer showing up and everything seems to be working fine.

Maybe a reboot fixed something, but that seems a bit strange. I also rebuilt the CSS as I had made a few improvements, but I also doubt that this was the underlying issue.

I'll go ahead and close this for now, but may re-open it if I see it again.