Skip to content

Commit

Permalink
Merge pull request #263 from lordofthejars/issue-260
Browse files Browse the repository at this point in the history
resolves #263 Documents how safe mode works
  • Loading branch information
lordofthejars committed Dec 30, 2014
2 parents df764b5 + 2c3d9a9 commit 44474f3
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions README.adoc
Expand Up @@ -303,6 +303,32 @@ StringBuffer htmlBuffer = writer.getBuffer();
System.out.println(htmlBuffer.toString());
----

==== Safe mode and file system access
Asciidoctor provides security levels that control the read and write access of attributes, the include directive, macros, and scripts while a document is processing. Each level includes the restrictions enabled in the prior security level.

When Asciidoctor (and AsciidoctorJ) is used as _API_, it uses `SECURE` safe mode by default.
This mode is the most restrictive one and in summary it disallows the document from attempting to read files from the file system and including their contents into the document.

We recommend you to set `SAFE` safe mode when rendering AsciiDoc documents using AsciidoctorJ to have almost all Asciidoctor features such as _icons_, _include directive_ or retrieving content from _URIs_ enabled.

Safe mode is set as option when a document is rendered.
For example:

[source, java]
----
import static org.asciidoctor.OptionsBuilder.options;
Map<String, Object> options = options().safe(SafeMode.SAFE)
.asMap();
String outfile = asciidoctor.convertFile(new File("sample.adoc"), options);
----

We are going to explain in more detail options in <<conversion-options, next section>>.


You can read more about safe modes in http://asciidoctor.org/docs/user-manual/#running-asciidoctor-securely

=== Conversion options

Asciidoctor supports numerous options, such as:
Expand Down

0 comments on commit 44474f3

Please sign in to comment.