pub enum SafeMode {
Unsafe = 0,
Safe = 1,
Server = 10,
Secure = 20,
}Expand description
Describes the safe mode under which a document is parsed and rendered.
Safe modes provide a security model that controls how much a document is
allowed to reach outside of itself. They mirror the safe modes defined by
Ruby Asciidoctor, and the discriminant values are chosen so that the
modes compare in order of increasing safety (Unsafe < Safe < Server <
Secure). Features that could expose the host environment (for example,
embedding the contents of a file directly in the output) are only enabled
when the safe mode is below a threshold.
The default safe mode is SafeMode::Secure, matching the most
conservative setting. A client may relax it via
Parser::with_safe_mode.
Variants§
Unsafe = 0
A safe mode level that disables any of the security features enforced by Asciidoctor (Ruby or otherwise). This mode is intended for use when the document is entirely trusted.
Safe = 1
A safe mode level that closely parallels Unsafe,
except it prevents access to files which reside outside of the
parent directory of the source file.
Server = 10
A safe mode level that disallows the document from attempting to read files from the file system and including their contents into the document. It also disables certain macros that pose a security risk.
This is the most fitting safe mode for server deployments (hence the name).
Secure = 20
A safe mode level that disallows the document from attempting to read files from the file system and including their contents into the document, and it prevents access to file system paths.
This mode allows the AsciiDoc document to be processed in a shared, server-side environment, such as a wiki, where the document should not be able to embed the contents of arbitrary files.
This is the default safe mode.