CASSANDRA-21146 Guardrail for client driver versions#4699
CASSANDRA-21146 Guardrail for client driver versions#4699smiklosovic wants to merge 1 commit intoapache:trunkfrom
Conversation
717609b to
4e3a9d4
Compare
There was a problem hiding this comment.
Pull request overview
Introduces a new guardrail to warn or reject native protocol connections based on configured minimum client driver versions.
Changes:
- Adds
ClientDriverVersionGuardrailand wires it into STARTUP processing to enforce driver version constraints. - Exposes warned/disallowed driver-version maps via Guardrails MBean + configuration plumbing.
- Adds unit and integration tests for version parsing/comparison and guardrail behavior.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
src/java/org/apache/cassandra/db/guardrails/ClientDriverVersionGuardrail.java |
Implements the guardrail logic for comparing driver versions against configured minimums. |
src/java/org/apache/cassandra/db/guardrails/Guardrails.java |
Registers the new guardrail and adds MBean getter/setter JSON serialization for the new config. |
src/java/org/apache/cassandra/transport/messages/StartupMessage.java |
Invokes the guardrail during client STARTUP when driver name/version are provided. |
src/java/org/apache/cassandra/db/guardrails/GuardrailsMBean.java |
Adds MBean methods for getting/setting minimum client driver versions (warn/fail). |
src/java/org/apache/cassandra/db/guardrails/GuardrailsConfig.java |
Extends guardrails config interface with minimum driver version maps. |
src/java/org/apache/cassandra/config/GuardrailsOptions.java |
Implements the new config getters and adds setters with logging for runtime updates. |
src/java/org/apache/cassandra/config/Config.java |
Adds YAML-backed config fields for warned/disallowed minimum driver versions. |
src/java/org/apache/cassandra/tools/nodetool/GuardrailsConfigCommand.java |
Excludes the new map-based configs from nodetool guardrails config handling. |
conf/cassandra.yaml |
Documents new YAML options for minimum client driver versions (warn/disallow). |
conf/cassandra_latest.yaml |
Mirrors the new YAML documentation in the “latest” config template. |
test/unit/org/apache/cassandra/db/guardrails/GuardrailClientDriverVersionTest.java |
Adds unit/integration tests for version comparisons and guardrail outcomes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/java/org/apache/cassandra/db/guardrails/ClientDriverVersionGuardrail.java
Outdated
Show resolved
Hide resolved
| String minimumVersion = getMinimumVersion(driverId, disallowed); | ||
| fail(String.format("Client driver %s is below required minimum version %s, connection rejected", | ||
| driverId, minimumVersion), state); |
There was a problem hiding this comment.
driverId originates from client-supplied STARTUP options and is interpolated directly into warning/failure messages that may be logged and/or surfaced to clients. To reduce log-forging and nuisance risks, consider sanitizing the string (e.g., strip \r/\n, enforce a reasonable max length) before embedding it into messages.
There was a problem hiding this comment.
this is not really necessary. We have basically three drivers. It is not like it is possible to inject big driver name. That driver name is statically set in the driver itself.
| warn(String.format("Client driver %s is below recommended minimum version %s", | ||
| driverId, minimumVersion)); |
There was a problem hiding this comment.
driverId originates from client-supplied STARTUP options and is interpolated directly into warning/failure messages that may be logged and/or surfaced to clients. To reduce log-forging and nuisance risks, consider sanitizing the string (e.g., strip \r/\n, enforce a reasonable max length) before embedding it into messages.
There was a problem hiding this comment.
not applicable imho, overkill in our situation
src/java/org/apache/cassandra/db/guardrails/ClientDriverVersionGuardrail.java
Outdated
Show resolved
Hide resolved
eb26940 to
59d739e
Compare
59d739e to
254e4ec
Compare
Thanks for sending a pull request! Here are some tips if you're new here:
Commit messages should follow the following format:
The Cassandra Jira