View on GitHub

LibXSLT-raku

LibXSLT - Interface to the GNOME libxslt library

[Raku LibXML Project] / [LibXSLT Module] / Security

NAME

LibXSLT::Security

DESCRIPTION

Provides an interface to the libxslt security framework by allowing callbacks to be defined that can restrict access to various resources (files or URLs) during a transformation.

The libxslt security framework allows callbacks to be defined for certain actions that a stylesheet may attempt during a transformation. It may be desirable to restrict some of these actions (for example, writing a new file using exsl:document). The actions that may be restricted are:

Using LibXSLT::Security

The interface for this module is similar to LibXML::InputCallback. After creating a new instance you may register callbacks for each of the security options listed above. Then you apply the security preferences to the LibXSLT or LibXSLT::Stylesheet object using security_callbacks().

my LibXSLT::Security $security .= new();
$security.register-callback( read-file  => &read-cb );
$security.register-callback( write-file => &write-cb );
$security.register-callback( create-dir => &create-cb );
$security.register-callback( read-net   => &read-net-cb );
$security.register-callback( write-net  => &write-net-cb );

$xslt.security-callbacks( $security );
 -OR-
$stylesheet.security-callbacks( $security );

The registered callback functions are called when access to a resource is requested. If the access should be allowed the callback should return True, if not it should return False. The callback functions should accept the following arguments:

If a particular option (except for create-dir) doesn’t have a registered callback, then the stylesheet will have full access for that action.

Interface