Skip to content

Conversation

@gomoripeti
Copy link
Contributor

Proposed Changes

Addresses #15103

lists:keymerge/3 was used to merge required options into user provided ssl options, which assumes the input lists are sorted. No matter if the intention was to preserve user provided options or overwrite them in case of conflict, without sorting, the outcome was unpredictable. It is also somewhat surprising to those who are used to the behaviour of proplists:get_value (like me) that the ssl app (at least since OTP 26) takes the last value not the first when same key with multiple values are provided.

This commit makes sure the input lists are ordered. Also changes the behaviour of the plugin that all keys used by the plugin overwrite user provided values (fail_if_no_peer_cert, partial_chain, verify, verify_fun)

Also if the user did not provide a cacerts or cacertfile option, an empty cacerts list is added, as ssl config validation requires it in case verify_peer is enabled.

Types of Changes

What types of changes does your code introduce to this project?
Put an x in the boxes that apply

  • Bug fix (non-breaking change which fixes issue #NNNN)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause an observable behavior change in existing systems)
  • Documentation improvements (corrections, new content, etc)
  • Cosmetic change (whitespace, formatting, etc)
  • Build system and/or CI

Checklist

Put an x in the boxes that apply.
You can also fill these out after creating the PR.
This is simply a reminder of what we are going to look for before merging your code.

Further Comments

`lists:keymerge/3` was used to merge required options into user
provided ssl options, which assumes the input lists are sorted. No
matter if the intention was to preserve user provided options or
overwrite them in case of conflict, without sorting, the outcome was
unpredictable. It is also somewhat surprising to those who are used to
the behaviour of `proplists:get_value` that the ssl app (at least
since OTP 26) takes the last value not the first when same key with
multiple values are provided.

This commit makes sure the input lists are ordered. Also changes the
behaviour of the plugin that all keys used by the plugin overwrite
user provided values (`fail_if_no_peer_cert`, `partial_chain`,
`verify`, `verify_fun`)

Also if the user did not provide a `cacerts` or `cacertfile` option,
an empty `cacerts` list is added, as ssl config validation requires
it in case `verify_peer` is enabled.
@lukebakken lukebakken self-assigned this Dec 11, 2025
@michaelklishin michaelklishin added this to the 4.3.0 milestone Dec 11, 2025
@michaelklishin michaelklishin merged commit 42046f8 into rabbitmq:main Dec 11, 2025
289 checks passed
michaelklishin added a commit that referenced this pull request Dec 12, 2025
Trust store: Overwrite conflicting ssl options and ensure cacerts set (backport #15116)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants