DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:displayfile

This is an old revision of the document!


Display File Plugin

Compatible with DokuWiki

  • 2020-07-29 "Hogfather" yes
  • 2018-04-22 "Greebo" yes
  • 2017-02-19 "Frusterick Manners" yes
  • 2016-06-26 "Elenor Of Tsort" yes

plugin The Display File Plugin displays the content of a specified file on the local system using a displayfile element.

Last updated on
2021-01-25
Provides
Syntax
Repository
Source

Similar to showfile, source, src

Tagged with code, display, file, include, syntaxhighlight

Installation

Search and install the plugin using the Extension Manager or install directly using the latest download url, otherwise refer to Plugins on how to install plugins manually.

Usage

This plugin offers a single custom element, displayfile, that takes two arguments, lang and target. The element is self-closing and should not be used as an open/close pair.

Element <displayfile lang target />
< 100% - - 100% >
Argument Required Description
lang yes The language of the content file. This is used by Dokuwiki's built-in syntax highlighting GeSHi library. To disable syntax highlighting, specify a dask (-) character for the lang value. The supported lang values are the same as those provided by Dokuwiki's <code> and <file> markup and can be found on the Dokuwiki syntax page: Syntax Highlighting
target yes The specific part of a file path to the desired file on the local file system. This will be appended to the value of the plugin's root_path configuration option. The target value can be enclosed in single or double quotes (' or “). The target path part must be enclosed in quotes if it contains spaces.

Configuration Settings

The Display File Plugin has three settings that can be set in the Dokuwiki Configuration Manager:

  1. Root Path (root_path) - Specifies the root directory displayed file paths will evaluate relative to. The default value is an empty string, which effectively disables the plugin.
  2. Deny Extensions List (deny_extensions) - A space separated list of extensions that should disallowed by the displayfile element. The deny list supersedes the allow list. An empty list means no extension is explicitly disallowed. The default list includes sh.
  3. Allow Extension List (allow_extensions) - A space separated list of extensions that should allowed by the displayfile element. An empty list means any extension not in the deny list will be allowed. The default list includes txt, php, js, and css.

Future Plans

  • Fix any bugs that are reported.
  • Update as necessary for future Dokuwiki versions.
  • Replace root_path with deny_root_paths and allow_root_paths.

Security

Some level of threat is inherent in the very purpose of this plugin, displaying the contents of files from the local file system. To avoid path traversal attacks, the admin is provided with a configuration option for specifying the root directory path where displayable files are located. Validation is done to ensure that no files outside that root path are displayed and, further more, user-facing error messages have been generalized to remove the chance of ambient data probing. In addition, both allow and deny list configuration options exist to further control what files are and aren't displayable. Any security concerns or suggestions are welcome and should be raised on the Issue Tracker.

Bugs

Bugs should be reported through the Issue Tracker.

  • There are currently no know bugs.

Discussion

Discussion should be kept on the Plugin's Discussion Page.

plugin/displayfile.1611632070.txt.gz · Last modified: 2021-01-26 04:34 by jeckel

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki