Has there been any consideration to automatically allowlisting all public methods defined in an app’s
<velocity-context-item>
modules?
This seems sensible - let me get back to you on this.
If it’s not possible to allowlist automatically, does Atlassian already have any tool that reads a .class and outputs the method signatures in a compatible format?
Unfortunately not as we do not want to encourage the blind allowlisting of every method in a class. Currently, the logging will provide the methods needing allowlisting in a compatible format.
By enabling the system property, then running some acceptance tests and otherwise using your plugin, all necessary methods should be logged in a compatible format. You can then filter and dedupe your log lines to retrieve a list of currently invoked methods.
Now that the velocity method allowlist is enabled is it time for Confluence’s base classes like ActionSupport to annotate their accessor methods (e.g., getActionErrors, etc.)? If we use those inherited methods in our velocity templates should we add them to our velocity-allowlist?
All getters on Action classes should be allowlisted automatically (including #getActionErrors()
). If you find there are methods defined in Confluence that should be allowlisted and are not currently so, please feel free to call them out and I will have them evaluated for addition.
I feel like I probably shouldn’t put inherited methods like that into my velocity-allowlist because I’d expect the base class to annotate them as velocity property accessors, but I don’t see annotations on them (@ParameterSafe or @StrutsParameter).
The OGNL allowlist (and its annotations) are entirely independent to the newly introduced Velocity allowlist. The OGNL allowlist primarily concerns request parameter injection and has no impact on which methods can be invoked from Velocity templates.
The Velocity allowlist does not currently have an accompanying annotation, and allowlisting must be done through the velocity-allowlist
descriptor.
I tracked this down and I found that most Velocity logging is now turned off at the system level.
Thank you @scott.dudley for calling this out. This was indeed an oversight and will be rectified in the next EAP.