Updated on 2026-06-27 GMT+08:00

Configuring the FlinkServer UDF Sandbox

This section applies only to MRS 3.3.1 or later.

You can upload third-party JAR packages, such as UDFs and dependencies, on the Flink web UI based on job requirements, and invoke dependencies when verifying and running SQL jobs. To ensure that the uploaded JAR file is secure, Flink has enabled the sandbox function by default. You can refer to the steps in Disabling the FlinkServer Sandbox to modify the value of the parameter security.manager.enabled to disable the sandbox function.

Permission Introduction

A permission consists of the type (mandatory), name, and allowed operation.

  • Default permission
    • Property read permission: permission java.util.PropertyPermission "*", "read"
    • Socket permission, allowing connect and resolve to all ports: permission java.net.SocketPermission "*", "connect,resolve"
  • Standard permission
    Table 1 File permissions

    Type

    Name

    Allowed Operation

    Example

    java.io.FilePermission

    • Name of a specified file
    • -: all files in the directory and its subdirectories
    • *: all files in the directory
    • read
    • write
    • delete
    • execute
    • The following permission allows all files to be read, written, deleted, and executed:

      permission java.io.FilePermission "<< ALL FILES>>", "read,write,delete,execute";

    • The following permission allows the read of the user's home directory:

      permission java.io.FilePermission "${user.home}/-", "read";

    Table 2 Socket permissions

    Type

    Name

    Allowed Operation

    Example

    java.net.SocketPermission

    • Host name:Port
    • *: all addresses and ports
    • accept
    • listen
    • connect
    • resolve
    • The following permission allows all socket operations:

      permission java.net.SocketPermission ":1-", "accept,listen,connect,resolve";

    • The following permission allows the establishment of connections to and resolution of specific websites:

      permission java.net.SocketPermission ".abc.com:1-", "connect,resolve";

    Table 3 Property permissions

    Type

    Name

    Allowed Operation

    Example

    java.util.PropertyPermission

    JVM property name to be accessed

    • read
    • write

    The following permission allows standard read of Java properties:

    permission java.util.PropertyPermission "java.", "read";

    Table 4 Runtime permissions

    Type

    Name

    java.lang.RuntimePermission

    • accessDeclaredMembers: allows code to use reflection to access private or protected members in other classes.
    • createClassLoader: allows code to create a class loader instance.
    • createSecurityManager: allows code to create a security manager instance, which will allow programmatic implementations to control the sandbox. This is a high-risk operation. With this permission, the UDF can modify or disable the SecurityManager of a service.
    • exitVM: allows the code to shut down the entire VM.
    • getClassLoader: allows code to access the class loader to obtain a specific class.
    • setContextClassLoader: allows code to set the context class loader for a thread.
    • setFactory: allows code to create a socket factory.
    • setIO: allows code to redirect System.in and System.out or System.err input and output streams.
    • setSecurityManager: allows code to set the security manager.
    • stopThread: allows code to invoke the stop() method of the thread class.
    Table 5 Security permissions

    Type

    Name

    java.security.SecurityPermission

    • createAccessControlContext: allows you to create a context environment for an access controller.
    • getPolicy: allows the search of classes that can implement sandbox policies.
    • setPolicy: allows you to set a class that can implement the sandbox policy. This is a high-risk operation. With this permission, the UDF can modify the policy of a service.
    Table 6 Reflection permissions

    Type

    Name

    java.lang.reflect.ReflectPermission

    suppressAccessChecks: allows reflection to be used to check private variables of any class.

    Table 7 All permissions

    Type

    Name

    java.security.AllPermission

    None (permission to perform any operation)

Disabling the FlinkServer Sandbox

  1. Log in to FusionInsight Manager.
  2. Choose Cluster > Services > Flink and click Configurations and then All Configurations.
  3. Search for the security.manager.enabled parameter and set its value to false.
  4. Click Save.
  5. Click the Instances tab, select all FlinkServer instances, and choose More > Restart Instance to restart the FlinkServer instances as prompted.