asciidoctor / brackets-asciidoc-preview

Live Preview of AsciiDoc for Adobe Brackets
MIT License
51 stars 16 forks source link

SecurityError: Jail is not an absolute path #22

Closed normanlorrain closed 9 years ago

normanlorrain commented 9 years ago

Might be missing something simple but I'm seeing this on Windows 7, current version of Brackets.

Asciidoctor plugin in showing this error:

SecurityError: Jail is not an absolute path: .....

(I've tried changing the path but nothing works)

nerk commented 9 years ago

Would you mind giving a little bit more information?

Does this mean the plugin is installed correctly (you can open the preview pane), but this message appears in the plugin's console? Does this happen only with a particular document? What path did you change?

There should not be a problem with Windows 7 in general. However, one coworker had some strange problem on his machine because of the partitioning of his harddrive or mapping of drive letters. Unfortunately, I can not remember what his problem was and we did not really bother to find out.

nerk commented 9 years ago

Could you please try to change the 'Safe mode' in the settings dialog from 'Safe' to 'Unsafe' and check if this makes a difference?

normanlorrain commented 9 years ago

Thanks for the quick reply.

The plugin seems installed correctly, The error shows up in the preview window:

image

I reset the Basedir and Images dir to the defaults.

NOTE: I can get it to work if I choose the Safe mode: Secure setting. Not sure what that refers to. It's possible I have an error in my markup. The asciidoc example renders fine in all modes.

This might be a clue... if I chose Safe mode: Unsafe, the preview shows TypeError: undefined is not a function

I think the issue is with the underlying Asciidoc processing of bad markup.

nerk commented 9 years ago

I assume it must have something to do with the paths of images or other assets you access or include from your document. If you are referring to images outside the root path of the document from which they are being referred, you might run into problems. Same is true for setting Imagesdir or Basedir in the settings dialog.

The 'Safe mode' controls to what extend referring to things outside of the source document root directory is allowed. You can read about it here: http://asciidoctor.org/docs/user-manual/#running-asciidoctor-securely

IMHO, the best structure for a document is to put everything into a common hierarchy. It would help if you could isolate the problem and post a small example document to reproduce the problem.

nerk commented 9 years ago

By coincidence, I had the same problem with a document of mine and figured it out. The problem is the

:data-uri:

attribute. Asciidoctor.js cannot handle that properly - no surprise. The brackets preview is going to disable that attribute in the next version. For now, you may want to unset it or use

ifdef::env-browser[]
:data-uri:
endif::[]
nerk commented 9 years ago

Of course, I meant

ifndef::env-browser[]
:data-uri:
endif::[]
mojavelinux commented 9 years ago

Correct, JavaScript cannot reliably access the file system to read binary image data right now, so it's best to ensure this is disabled for now. We can track improvements to data-uri support in Asciidoctor.js directly. There may be ways, but they need to be in place in that code first.