-
Notifications
You must be signed in to change notification settings - Fork 4.1k
CASSANDRA-21670 Remove Cassandra's requirement for the Java security manager #5139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
JeremiahDJordan
wants to merge
1
commit into
apache:trunk
Choose a base branch
from
JeremiahDJordan:CASSANDRA-21670-trunk
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,181
−73
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -588,6 +588,61 @@ include::cassandra:example$JAVA/udf_imports.java[] | |
|
|
||
| Please note, that these convenience imports are not available for script UDFs. | ||
|
|
||
| ==== UDF restrictions | ||
|
|
||
| UDFs run inside the Cassandra Java Virtual Machine (JVM). | ||
| Cassandra checks UDF bytecode. | ||
| It restricts the classes that a UDF can load. | ||
| These controls do not provide complete process isolation. | ||
| A UDF can consume processor time or heap memory. | ||
| Grant permission to create functions only to trusted roles. | ||
|
|
||
| Set the JVM system property `cassandra.udf.security_mechanism` before node startup. | ||
| The default value is `auto`. | ||
|
|
||
| [cols="1,3",options="header"] | ||
| |=== | ||
| |Value |Behavior | ||
| |`auto` |Cassandra uses the Java security manager based sandbox before Java Development Kit (JDK) 24. | ||
| It uses the bytecode sandbox on JDK 24 and later. | ||
| |`sandbox` |Cassandra uses the bytecode sandbox on every supported JDK. | ||
| It skips security manager and security policy installation. | ||
| |`securitymanager` |Cassandra requires the Java security manager based sandbox. | ||
| Startup fails if the runtime cannot install the security manager. | ||
| |=== | ||
|
|
||
| An invalid value causes a configuration error. | ||
| For example, add `-Dcassandra.udf.security_mechanism=sandbox` to the JVM options to select the sandbox. | ||
| Use a JDK version that Cassandra supports. | ||
|
|
||
| The bytecode sandbox rejects restricted calls when Cassandra creates a function. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This whole section feels like AI stuff. I can imagine the prompt "be concise as possible, no fluff" and this is the result :) |
||
| It blocks system property access and environment access. | ||
| It blocks process exit and native library loading. | ||
| It blocks changes to standard input and output. | ||
| It also blocks changes to the default process locale and time zone. | ||
| It blocks indirect property access through `Integer.getInteger`, `Long.getLong`, and `Boolean.getBoolean`. | ||
| The class loader blocks file access and process control. | ||
| It also blocks reflection and method handles. | ||
| The verifier rejects `ClassLoader` calls. | ||
| It also rejects calls through `Module` and `ModuleLayer`. | ||
| It rejects `Class.getModule`. | ||
| A function cannot declare additional classes. | ||
|
|
||
| UDF threads can execute calls to `System.nanoTime`, `System.currentTimeMillis`, and `System.arraycopy`. | ||
| Cassandra applies warning and failure timeouts when `user_defined_functions_threads_enabled=true`. | ||
| The `user_function_timeout_policy` setting controls the response to a failure timeout. | ||
|
|
||
| To permit restricted `System` access, use these settings: | ||
|
|
||
| . Set `allow_insecure_udfs=true` in `cassandra.yaml`. | ||
| . Set `user_defined_functions_threads_enabled=false` in `cassandra.yaml`. | ||
| . Set `allow_extra_insecure_udfs=true` in `cassandra.yaml`. | ||
|
|
||
| This configuration permits restricted `System` method calls and indirect property access. | ||
| With UDF threads enabled, the selected sandbox still enforces its restrictions. | ||
| The class loader restrictions and the base bytecode checks still apply. | ||
| Cassandra applies execution timeouts only when UDF threads are enabled. | ||
|
|
||
| [[create-function-statement]] | ||
| === CREATE FUNCTION statement | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change this in cassandra_latest.yaml too