Velocity Allowlist plugin module

Supported from Confluence 9.0 and Jira 10.0.

Purpose of this Module Type

Velocity Allowlist plugin modules allow plugins to define methods allowed to be invoked from Velocity templates.

Configuration

The root element for the Velocity method allowlist module is velocity-allowlist. It allows the following attributes and child elements for configuration:

Attributes

Name*

Description

state

Indicate whether the plugin module should be disabled by default (value='disabled') or enabled by default (value='enabled').

Default: enabled.

i18n-name-key

The localisation key for the human-readable name of the plugin module.

key

The unique identifier of the plugin module. You refer to this key to use the resource from other contexts in your plugin, such as from the plugin Java code.

1
2
<velocity-allowlist
key="graph-macro-example-method-allowlist" />

In the example, graph-macro-example-method-allowlist is the key for this particular module declaration.

name

The human-readable name of the plugin module.

Used only in the plugin's administrative user interface.

*key attribute is required.

Elements

The tables summarises the elements. The sections below contain further information.

Name

Description

method

Defines a method that is allowed to be used in Velocity templates by the plugin

description

The description of the plugin module. The 'key' attribute can be specified to declare a localisation key for the value instead of text in the element body.

i.e. the description of the Velocity allowlist.

Method elements

Method should contain fully qualified names including the package, class, method name, and full-qualified type names of the parameters delimited by spaces, as shown below:

1
2
<method>com.example.ClassName#methodName(java.lang.String boolean)</method>

Example

Single allowlisted method

Here is an example atlassian-plugin.xml file containing a single Velocity allowlist:

1
2
<atlassian-plugin name="Hello World Plugin" key="example.plugin.helloworld" plugins-version="2">
    <plugin-info>
        <description>A basic Velocity allowlist module test</description>
        <vendor name="Atlassian Software Systems" url="http://www.atlassian.com"/>
        <version>1.0</version>
    </plugin-info>
    <velocity-allowlist key="velocity-allowlist" name="Velocity Allowlist">
        <description key="example.plugin.helloworld.velocity.allowlist">
            Velocity templates can use these Java methods
        </description>
        <method>com.example.ClassName#methodName(java.lang.String boolean)</method>
    </velocity-allowlist>
</atlassian-plugin>

Rate this page: