Skip to content

Conversation

@lukebakken
Copy link
Collaborator

As mentioned in discussion #14426, the way that cacerts is handled by cuttlefish schemas simply will not work if set.

If cacerts were set to a string value containing one X509 certificate, it would eventually result in a crash because the cacerts ssl option must be of this type:

{cacerts, CACerts :: [public_key:der_encoded()] | [public_key:combined_cert()]}

Neither of those are strings, of course. The certs would have to be decoded via public_key:pem_decode/1 then the resulting term matched to get the actual DER-encoded data.

This PR removes all use of cacerts in cuttlefish schemas. In addition, it filters out cacerts and certs_keys from being JSON-encoded by an HTTP API call to /api/overview. It is technically possible to set cacerts via advanced.config, so, if set, it would crash this API call, as would certs_keys.

@lukebakken lukebakken self-assigned this Oct 1, 2025
As mentioned in discussion rabbitmq#14426, the way that `cacerts` is handled by
cuttlefish schemas simply will not work if set.

If `cacerts` were set to a string value containing one X509 certificate,
it would eventually result in a crash because the `cacerts` ssl option
must be of [this type](https://www.erlang.org/doc/apps/ssl/ssl.html#t:client_option_cert/0):

```
{cacerts, CACerts :: [public_key:der_encoded()] | [public_key:combined_cert()]}
```

Neither of those are strings, of course.

This PR removes all use of `cacerts` in cuttlefish schemas. In addition,
it filters out `cacerts` and `certs_keys` from being JSON-encoded by an
HTTP API call to `/api/overview`. It _is_ technically possible to set
`cacerts` via `advanced.config`, so, if set, it would crash this API
call, as would `certs_keys`.
@lukebakken lukebakken force-pushed the lukebakken/nuke-cacerts branch from 477cbfd to ce86fb9 Compare October 1, 2025 15:14
@michaelklishin michaelklishin added this to the 4.3.0 milestone Oct 2, 2025
@michaelklishin michaelklishin added backport-v4.2.x breaking-change Includes changes that are potentially breaking compared to prior versions labels Oct 2, 2025
Copy link
Collaborator

@michaelklishin michaelklishin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bug fix that will be a breaking change for a very small percentage of our users but the upcoming 4.2.0 release is a good moment to ship it.

@michaelklishin michaelklishin merged commit 4373543 into rabbitmq:main Oct 2, 2025
286 of 288 checks passed
@lukebakken
Copy link
Collaborator Author

will be a breaking change for a very small percentage of our users

I'm pretty sure the percentage is 0%! 😄

michaelklishin added a commit that referenced this pull request Oct 2, 2025
Remove all usage of `cacerts` from configuration schemas (backport #14655)
@michaelklishin
Copy link
Collaborator

@lukebakken every time I think "well, surely no one does THAT" we discover someone who does, and someone who's bet their farm on such an obscure feature 😭

lukebakken added a commit to amazon-mq/upstream-to-rabbitmq-server that referenced this pull request Oct 9, 2025
Follow-up to rabbitmq#14655

The code to format `cacerts` and `certs_keys` needs to check if the
incoming value is a list or map, and skip it if not. This is the same
pattern as used in a later function head:

```
format_socket_opts([Head = {Name, Value} | Tail], Acc) when is_list(Value) ->
```

It ensures that the code won't be called again on an already-formatted
value.
lukebakken added a commit to amazon-mq/upstream-to-rabbitmq-server that referenced this pull request Oct 9, 2025
Follow-up to rabbitmq#14655

The code to format `cacerts` and `certs_keys` needs to check if the
incoming value is a list or map, and skip it if not. This is the same
pattern as used in a later function head:

```
format_socket_opts([Head = {Name, Value} | Tail], Acc) when is_list(Value) ->
```

It ensures that the code won't be called again on an already-formatted
value.
lukebakken added a commit to amazon-mq/upstream-to-rabbitmq-server that referenced this pull request Oct 9, 2025
Follow-up to rabbitmq#14655

The code to format `cacerts` and `certs_keys` needs to check if the
incoming value is a list or map, and skip it if not. This is the same
pattern as used in a later function head:

```
format_socket_opts([Head = {Name, Value} | Tail], Acc) when is_list(Value) ->
```

It ensures that the code won't be called again on an already-formatted
value.
lukebakken added a commit to amazon-mq/upstream-to-rabbitmq-server that referenced this pull request Oct 9, 2025
Follow-up to rabbitmq#14655

The code to format `cacerts` and `certs_keys` needs to check if the
incoming value is a list or map, and skip it if not. This is the same
pattern as used in a later function head:

```
format_socket_opts([Head = {Name, Value} | Tail], Acc) when is_list(Value) ->
```

It ensures that the code won't be called again on an already-formatted
value.
lukebakken added a commit to amazon-mq/upstream-to-rabbitmq-server that referenced this pull request Oct 9, 2025
Follow-up to rabbitmq#14655

The code to format `cacerts` and `certs_keys` needs to check if the
incoming value is a list or map, and skip it if not. This is the same
pattern as used in a later function head:

```
format_socket_opts([Head = {Name, Value} | Tail], Acc) when is_list(Value) ->
```

It ensures that the code won't be called again on an already-formatted
value.
lukebakken added a commit to amazon-mq/upstream-to-rabbitmq-server that referenced this pull request Oct 9, 2025
Follow-up to rabbitmq#14655

The code to format `cacerts` and `certs_keys` needs to check if the
incoming value is a list or map, and skip it if not. This is the same
pattern as used in a later function head:

```
format_socket_opts([Head = {Name, Value} | Tail], Acc) when is_list(Value) ->
```

It ensures that the code won't be called again on an already-formatted
value.
lukebakken added a commit to amazon-mq/upstream-to-rabbitmq-server that referenced this pull request Oct 9, 2025
Follow-up to rabbitmq#14655

The code to format `cacerts` and `certs_keys` needs to check if the
incoming value is a list or map, and skip it if not. This is the same
pattern as used in a later function head:

```
format_socket_opts([Head = {Name, Value} | Tail], Acc) when is_list(Value) ->
```

It ensures that the code won't be called again on an already-formatted
value.
lukebakken added a commit to amazon-mq/upstream-to-rabbitmq-server that referenced this pull request Oct 9, 2025
Follow-up to rabbitmq#14655

The code to format `cacerts` and `certs_keys` needs to check if the
incoming value is a list or map, and skip it if not. This is the same
pattern as used in a later function head:

```
format_socket_opts([Head = {Name, Value} | Tail], Acc) when is_list(Value) ->
```

It ensures that the code won't be called again on an already-formatted
value.
lukebakken added a commit to amazon-mq/upstream-to-rabbitmq-server that referenced this pull request Oct 9, 2025
Follow-up to rabbitmq#14655

The code to format `cacerts` and `certs_keys` needs to check if the
incoming value is a list or map, and skip it if not. This is the same
pattern as used in a later function head:

```
format_socket_opts([Head = {Name, Value} | Tail], Acc) when is_list(Value) ->
```

It ensures that the code won't be called again on an already-formatted
value.
mergify bot pushed a commit that referenced this pull request Oct 14, 2025
Follow-up to #14655

The code to format `cacerts` and `certs_keys` needs to check if the
incoming value is a list or map, and skip it if not. This is the same
pattern as used in a later function head:

```
format_socket_opts([Head = {Name, Value} | Tail], Acc) when is_list(Value) ->
```

It ensures that the code won't be called again on an already-formatted
value.

(cherry picked from commit 275f0a4)
@lukebakken lukebakken deleted the lukebakken/nuke-cacerts branch October 24, 2025 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-v4.2.x breaking-change Includes changes that are potentially breaking compared to prior versions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants