Skip to main content
disable_udf_security is an immutable FE setting. Its default, true, preserves existing behavior for upgrades. To enable the controls below, set disable_udf_security=false and enable_udf=true in every FE’s fe.conf, then restart the FEs. Upgrade all FEs and BEs before enabling it.

Publishers and callers

  • Only users with an active built-in root or db_admin role can create, replace, drop, or change UDF column approvals. A matching user name alone grants no privilege.
  • In secure mode, EXECUTE AS also requires an active built-in root or db_admin role. Possessing IMPERSONATE, including through user_admin, does not delegate a UDF administrator identity.
  • Executing FE scripts and changing another UDF administrator’s authentication information require the same administrator role. The authentication check includes owned and inherited roles, even when they are not activated by default.
  • UDF management privileges cannot be delegated. Only these administrators may grant or revoke function privileges. USAGE cannot be granted with WITH GRANT OPTION.
  • Granting, revoking or dropping a role that carries UDF privileges, including inherited privileges, also requires one of these administrators. The same rule applies to assigning such a role when creating a user or changing a role mapping.
  • Callers, including administrators, need an explicit USAGE grant on the individual function signature. Built-in or wildcard grants do not authorize a newly registered function. Ordinary data access privileges are still required.
  • Each external UDF also needs administrator-approved input columns. Approval belongs to the function version, independently of callers. Replacing a function allocates a new function ID and requires fresh grants and column approvals.
  • Restoring functions from a backup requires the same administrator role and clears restored column approvals. Dropping or recovering a database containing functions also requires this role.
  • Prepared executions revalidate registered SQL-function identities and explicit USAGE before expanding their bodies. Queries using registered SQL functions are excluded from the SQL result cache in secure mode.
  • Identity trust sources are administrator-controlled in secure mode: creating, altering or dropping group providers and security integrations, and dynamically changing authentication, group-provider or verification-key-cache settings (including group-name matching) requires an active root or db_admin role. This applies before any administrator-group mapping exists and includes Enterprise integration-specific role mappings. Switching an account between native and external authentication plugins requires the same role; native users can still change their own native password.

Register a local package

Copy the JAR or Python ZIP to the receiving FE’s $STARROCKS_HOME/lib/udf/upload directory. Protect this directory from untrusted writes. Packages outside it, external download URLs, inline Python and remote service_url workers are not accepted in secure mode. Java and local Python packages retain their existing function interfaces.
Replace the example installation path, class, database, table, columns and user with actual values. For Python, use "type"="Python", a ZIP file and its module/function symbol. For global functions, use ALTER GLOBAL FUNCTION and the global function grant syntax. allowed_columns replaces the complete list; an empty string revokes every column approval. Its entries are qualified database.table.column or catalog.database.table.column names. The registry stores the resolved table and column identifiers. Aliases, derived expressions, CTEs and set-operation inputs are checked against source columns. Literal-only calls need USAGE but no column approval. This control limits UDF inputs; it is not an operating-system sandbox or a restriction on networking inside the UDF. Inline JDBC native_query output has no stable source-column identity and cannot be passed to an external UDF in secure mode. Queries that do not pass these values to a UDF remain supported.

Package identity and availability

  • The FE snapshots the uploaded bytes under $STARROCKS_HOME/lib/udf/packages, computes SHA-256, and registers a locator containing the storage FE host, HTTP port and content identifier. Metadata journals and images retain this locator across leader changes.
  • BE preparation uses the locator in the plan to contact the storage FE, even when another FE generated the plan. Internal downloads require the cluster identity. Redirects are not followed.
  • Secure BE files live under $STARROCKS_HOME/lib/udf/secure. Every preparation checks the requested digest against the in-memory cache identity and verifies disk bytes before loading or reusing a context. Verification failures reject the invocation.
  • Secure Python calls use dedicated local workers. They do not reuse a worker across function clients, so another package cannot overwrite the call’s imported modules or dependencies. This adds worker startup overhead.
  • The storage FE and its package files must remain available for cache misses. Recording its address does not replicate files or provide storage-node failover. Back up and retain packages needed by registered functions and running queries.
  • Existing functions registered in legacy mode must be reinstalled from the upload directory and explicitly authorized. This mode does not silently trust an old URL or an old MD5-only cache.