GatewayScript security
GatewayScript provides a unique set of considerations that affect programs and system security.
Program security is critical, especially when systems are connected to the Internet. The programming model has built-in security measures that help ensure strong protection from unauthorized use.
- Global object protection
- Scripts do not have direct access to the global object. Instead, scripts operate on a global proxy. It is impossible for one script to affect the execution of another or to modify the global state, causing the next transaction to run within an altered run time.
- Prevention of certain extensions or modifications
- The provided DataPower® modules use
Object.sealandObject.freezeto prevent unwanted extension or modification, where appropriate. The provided DataPower scripts are in a protected directory. The scripts can be run, but they cannot be read or written. - Protection of the GatewayScript built-in object
- The GatewayScript built-in object prototypes are frozen with
Object.freezeby default. This prevents unwanted modification of existing property attributes and values, addition of new properties, or removal of existing properties of the GatewayScript built-in objects. When you need to manipulate the built-in object prototypes, you must disable the object prototype freeze by configuring GatewayScript settings. - Protection of critical code
- The internal portions of GatewayScript programming process libraries on the DataPower Gateway. These libraries are protected from viewing in the debugger, which provides an extra layer of security.
- Protection of code against SSCA vulnerabilities
- By default, untrusted code mitigation is enabled to protect against Speculative Side-Channel Attacks (SSCA) vulnerabilities. You can disable this protection mechanism in the GatewayScript settings configuration.
- Use of strict mode
- Restricts ECMAScript syntax so that some silent errors are changed to throw errors, which helps with code optimization and prohibits questionable syntax.
- No eval() function and no compilation from strings. The
eval()function is disabled by default. - The eval() function is a JavaScript function, not a GatewayScript function. By not allowing the
eval() function or compiling from strings, GatewayScript prevents injection
attacks by preventing invocation of malicious scripts. However, some use cases require
eval() for dynamic evaluation. The eval() function can be
enabled in an isolated manner with the
var://service/gatewayscript/enable-evalvariable for a per-transaction enablement. This enablement does not affect other transaction, application domain, or system-wide function. - Limits to the urlopen() function
- To access local files, the urlopen() function allows access to only the
local: and
store:directories. - Protection of flexible location references
- The DataPower Gateway supports the use of
dot dot
(..) in a limited context to refer to the parent directory in a file path or a protocol URL. The..structure is allowed in only the GatewayScripttransform.xslt()anddp:gatewayscript()functions. In this context, only leading..are resolved. In../../c/../called.js, the..specification after (to the right of)c/is an error.