Skip to content

4.1.0: Introduce a way to protect a virtual host from deletion (backport #13015) #13017

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

Merged
merged 7 commits into from
Jan 4, 2025

Conversation

mergify[bot]
Copy link

@mergify mergify bot commented Jan 4, 2025

Accidental "fat finger" virtual deletion accidents #12772 would be easier to avoid if there was a protection mechanism that would apply equally even to CLI tools and external applications that do not use confirmations for deletion operations.

This introduce the following changes:

  • Virtual host metadata now supports a new queue, 'protected_from_deletion', which, when set, will be considered by key virtual host deletion function(s)
  • DELETE /api/vhosts/{name} was adapted to handle such blocked deletion attempts to respond with a 412 Precondition Failed status
  • rabbitmqctl list_vhosts and rabbitmqctl delete_vhost were adapted accordingly
  • DELETE /api/vhosts/{name}/deletion/protection is a new endpoint that can be used to remove the protective seal (the metadata key)
  • POST /api/vhosts/{name}/deletion/protection marks the virtual host as protected

In the case of the HTTP API, all operations on
virtual host metadata require administrative
privileges.

Other considerations:

  • When a virtual host does not exist, the behavior remains the same: the original, protection-unaware code path is used to preserve backwards compatibility

Closes #12772.


This is an automatic backport of pull request #13015 done by [Mergify](https://mergify.com).

michaelklishin and others added 7 commits January 4, 2025 02:50
Accidental "fat finger" virtual deletion accidents
would be easier to avoid if there was a protection mechanism
that would apply equally even to CLI tools and external
applications that do not use confirmations for deletion
operations.

This introduce the following changes:

 * Virtual host metadata now supports a new queue,
   'protected_from_deletion', which, when set,
   will be considered by key virtual host deletion function(s)
 * DELETE /api/vhosts/{name} was adapted to handle
   such blocked deletion attempts to respond with
   a 412 Precondition Failed status
 * 'rabbitmqctl list_vhosts' and 'rabbitmqctl delete_vhost'
   were adapted accordingly
 * DELETE /api/vhosts/{name}/deletion/protection
   is a new endpoint that can be used to remove
   the protective seal (the metadata key)
 * POST /api/vhosts/{name}/deletion/protection
   marks the virtual host as protected

In the case of the HTTP API, all operations on
virtual host metadata require administrative
privileges from the target user.

Other considerations:

 * When a virtual host does not exist, the behavior
  remains the same: the original, protection-unaware
  code path is used to preserve backwards compatibility

References #12772.

(cherry picked from commit f62d46c)
(cherry picked from commit c95a95f)
(cherry picked from commit 6281dcb)
…itions exported over the HTTP API

(cherry picked from commit 315c247)
that features a deletion-protected virtual host.

(cherry picked from commit 1d88a9d)
(cherry picked from commit faa4f5a)
@michaelklishin michaelklishin added this to the 4.0.6 milestone Jan 4, 2025
@michaelklishin michaelklishin merged commit dff47f5 into v4.0.x Jan 4, 2025
273 checks passed
@michaelklishin michaelklishin deleted the mergify/bp/v4.0.x/pr-13015 branch January 4, 2025 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants