Script sandbox environment

  • Release version: Yokohama
  • Updated May 5, 2026
  • 2 minutes to read
  • Summarize
    Summarized using AI
    This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.

    Summary of Script sandbox environment

    The script sandbox environment in ServiceNow Yokohama release is a restricted execution context designed to safely run untrusted, client-generated scripts on the server. When a script is sent to the server, a server-side evaluator determines if it is trusted. Trusted scripts run in the full JavaScript engine, while untrusted scripts run within the sandbox environment to limit potential risks.

    Show full answer Show less

    This sandbox applies only to untrusted scripts sent by clients and does not affect script includes or client-side scripts. Untrusted scripts typically originate from filter or query parameters in URLs or system APIs such as AJAXEvaluate.

    Sandbox Restrictions

    • Only business rules marked as Client callable and script includes marked as Sandbox enabled can be invoked.
    • Direct database modifications (insert, update, delete) are disallowed; for example, calls like current.update() are ignored.
    • Certain APIs, especially those related to direct database access, are restricted.
    • Starting with the Xanadu release, script includes must be Sandbox enabled (previously Client callable) to be accessible within the sandbox.

    Script Sandbox Evaluators

    Since Yokohama Patch 13, two evaluators enforce sandbox restrictions with different security levels:

    • Guarded script evaluator: Enhances security by allowing only a restricted domain-specific scripting language with limited JavaScript features. It fully enforces guest transactions and handles untrusted scripts without a guarded-script exemption.
    • Script sandbox evaluator: Supports more JavaScript features but restricts certain APIs to prevent unsafe operations. It evaluates untrusted scripts that have a guarded-script exemption or during specific detection phases.
    Characteristic Guarded script evaluator Script sandbox evaluator
    Purpose Provides enhanced script security with a restricted scripting language. Prevents execution of unsafe untrusted scripts by limiting available APIs.
    JavaScript support Single simple expressions or function calls with limited APIs. Supports most JavaScript features except certain APIs and methods.
    When it runs Untrusted scripts without guarded-script exemption. Untrusted scripts with guarded-script exemption or during detection phases for authenticated users.
    Script includes Run outside the sandbox in application scope, not applicable. Run outside the sandbox in application scope, not applicable.

    Practical Implications for ServiceNow Customers

    This sandbox environment ensures that untrusted client-generated scripts cannot perform harmful operations on your instance by enforcing strict API and scripting restrictions. Understanding the two evaluators helps you anticipate which scripts will be allowed or blocked and under what conditions.

    When developing or troubleshooting scripts that originate from clients, ensure appropriate markings (Client callable, Sandbox enabled) are applied to business rules and script includes to allow their use within the sandbox. Also, avoid database write operations from within sandboxed scripts, as these are ignored.

    These measures collectively enhance your instance’s security by preventing unauthorized or unsafe script execution on the server.

    The script sandbox environment is a restricted execution context in which untrusted, client-generated scripts run on the server using one of two evaluators: the guarded script evaluator or the script sandbox evaluator.

    Script sandbox environment overview

    When a script is sent to the server, a server-side script evaluator determines whether the script is trusted. Trusted scripts run in the JavaScript engine. Untrusted scripts run in the restricted sandbox environment instead.

    Note:
    The sandbox does not apply to script includes, which run in the application scope outside of the sandbox, or to client-side scripts.
    Untrusted scripts are client-generated and sent to the server for evaluation in the following ways:
    • Filter or query parameters: Filter and query parameters in URLs can send scripts to the server with HTTP requests, such as when a logged-out user follows a link containing a javascript: filter parameter.
    • System APIs: The AJAXEvaluate API call allows the client to run arbitrary scripts on the server and receive a response.
    Within the sandbox, the following restrictions apply to scripts:
    • Only business rules marked Client callable can be called.
    • Only script includes marked Sandbox enabled can be called.
    • Certain API calls, mostly limited to ones dealing with direct database access, aren’t allowed.
    • Data can’t be inserted, updated, or deleted from within the sandbox. For example, any calls to current.update() are ignored.
    Note:
    Beginning with the Xanadu release, script includes marked as Glide AJAX enabled (previously named Client callable) aren’t accessible within the sandbox. Only those marked Sandbox enabled are available within the sandbox. When upgrading to the Yokohama release from the Washington DC release or earlier, any script includes marked as Client callable are also marked as Sandbox enabled.

    Script sandbox evaluators

    Beginning with the Yokohama Patch 13 release, the sandbox uses two evaluators to enforce different levels of restrictions:

    • Guarded script evaluator: Enhances instance security by supporting only a restricted scripting language and rejecting untrusted scripts that are incompatible. Guest transactions are fully enforced immediately. Scripts sent by authenticated users are evaluated differently depending on the instance type.
    • Script sandbox evaluator: Helps prevent executing untrusted scripts on an instance by limiting the APIs available to scripts.
    Table 1. Comparison of the guarded script evaluator and script sandbox evaluator
    Characteristic Guarded script evaluator Script sandbox evaluator
    Purpose Provides enhanced security for scripts that run in the sandbox. Uses a domain-specific language (DSL) that permits only a small set of JavaScript features. Supports additional JavaScript but restricts certain APIs for scripts.
    JavaScript support Only a single simple expression or function call and only certain APIs. Features supported by the JavaScript engine except for certain API and method restrictions.
    When it runs Evaluates untrusted scripts that haven't been granted a guarded-script exemption. Evaluates untrusted scripts under the following conditions:
    • A script has been granted a guarded-script exemption (manually or automatically).
    • When guarded script is in Phase 1: Detection, and a script is sent to the server by an authenticated user.
    Script includes Not applicable: script includes run outside the sandbox in the application scope Not applicable: script includes run outside the sandbox in the application scope

    For details about each evaluator, including JavaScript restrictions, see the following topics and the Server-Side Sandbox Runtime Replacement [KB2944435] article on the Now Support Knowledge Base.