pub enum SafeMode {
Unsafe = 0,
Safe = 1,
Server = 2,
Secure = 3,
}Expand description
Safe mode to use when processing the document. This follows from what is described in https://docs.asciidoctor.org/asciidoctor/latest/safe-modes/ and is intended to provide similar functionality as Asciidoctor.
Variants§
Unsafe = 0
The UNSAFE safe mode level disables all security measures.
Safe = 1
The SAFE safe mode level prevents access to files which reside outside of the
parent directory of the source file. Include directives (include::[]) are
enabled, but paths to include files must be within the parent directory. This mode
allows assets (such as the stylesheet) to be embedded in the document.
Server = 2
The SERVER safe mode level disallows the document from setting attributes that
would affect conversion of the document. This level trims docfile to its relative
path and prevents the document from:
- setting source-highlighter, doctype, docinfo and backend
- seeing docdir (as it can reveal information about the host filesystem)
It allows icons and linkcss. No includes from a url are allowed unless the
allow-uri-read attribute is set.
Secure = 3
The SECURE safe mode level disallows the document from attempting to read files
from the file system and including their contents into the document. Additionally,
it:
- disables icons
- disables include directives (
include::[]) - data can not be retrieved from URIs
- prevents access to stylesheets and JavaScript files
- sets the backend to html5
- disables docinfo files
- disables data-uri
- disables interactive (opts=interactive) and inline (opts=inline) modes for SVGs
- disables docdir and docfile (as these can reveal information about the host filesystem)
- disables source highlighting
Note: GitHub processes AsciiDoc files using the SECURE mode.