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
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
- Log in to FusionInsight Manager.
- Choose Cluster > Services > Flink and click Configurations and then All Configurations.
- Search for the security.manager.enabled parameter and set its value to false.
- Click Save.
- Click the Instances tab, select all FlinkServer instances, and choose More > Restart Instance to restart the FlinkServer instances as prompted.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot