[PR #5662] [MERGED] Workspace deletion protection #5516

Closed
opened 2026-06-05 15:21:36 -04:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Mintplex-Labs/anything-llm/pull/5662
Author: @shatfield4
Created: 5/19/2026
Status: Merged
Merged: 5/20/2026
Merged by: @timothycarambat

Base: masterHead: feat/workspace-deletion-protection


📝 Commits (6)

  • 87d58da add WORKSPACE_DELETION_PROTECTION env flag to disable workspace deletion from UI and APIs
  • d0dfe58 Merge branch 'master' into feat/workspace-deletion-protection
  • 2c9784d minor nits
  • f6fe294 Merge branch 'master' into feat/workspace-deletion-protection
  • 50559fe patch test for phrase
  • d7fa6eb Merge branch 'feat/workspace-deletion-protection' of github.com:Mintplex-Labs/anything-llm into feat/workspace-deletion-protection

📊 Changes

13 files changed (+125 additions, -18 deletions)

View changed files

📝 docker/.env.example (+3 -0)
📝 frontend/src/pages/Admin/Workspaces/WorkspaceRow/index.jsx (+15 -9)
📝 frontend/src/pages/Admin/Workspaces/index.jsx (+9 -2)
📝 frontend/src/pages/WorkspaceSettings/GeneralAppearance/DeleteWorkspace/index.jsx (+3 -1)
📝 frontend/src/pages/WorkspaceSettings/GeneralAppearance/index.jsx (+2 -2)
📝 frontend/src/pages/WorkspaceSettings/index.jsx (+7 -1)
📝 server/.env.example (+3 -0)
server/__tests__/utils/middleware/workspaceDeletionProtection.test.js (+43 -0)
📝 server/endpoints/admin.js (+8 -1)
📝 server/endpoints/api/workspace/index.js (+4 -1)
📝 server/endpoints/workspaces.js (+8 -1)
📝 server/models/systemSettings.js (+2 -0)
server/utils/middleware/workspaceDeletionProtection.js (+18 -0)

📄 Description

Pull Request Type

  • feat (New feature)
  • 🐛 fix (Bug fix)
  • ♻️ refactor (Code refactoring without changing behavior)
  • 💄 style (UI style changes)
  • 🔨 chore (Build, CI, maintenance)
  • 📝 docs (Documentation updates)

Relevant Issues

resolves #5604

Description

  • Adds WORKSPACE_DELETION_PROTECTION env flag when present (any value), workspace deletion is disabled across the UI and API.
  • New workspaceDeletionProtection middleware blocks the server-side delete endpoints (/workspace/:slug, /admin/workspace/:id, /v1/workspace/:slug) with a 403.
  • Hides the delete affordances in the admin workspaces table, workspace row, and workspace settings (general appearance + settings page) when the flag is set, exposed via SystemSettings public settings.
  • Adds unit tests for the middleware.

Visuals (if applicable)

Additional Information

Developer Validations

  • I ran yarn lint from the root of the repo & committed changes
  • Relevant documentation has been updated (if applicable)
  • I have tested my code functionality
  • Docker build succeeds locally

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Mintplex-Labs/anything-llm/pull/5662 **Author:** [@shatfield4](https://github.com/shatfield4) **Created:** 5/19/2026 **Status:** ✅ Merged **Merged:** 5/20/2026 **Merged by:** [@timothycarambat](https://github.com/timothycarambat) **Base:** `master` ← **Head:** `feat/workspace-deletion-protection` --- ### 📝 Commits (6) - [`87d58da`](https://github.com/Mintplex-Labs/anything-llm/commit/87d58daec2dac26bdd95988de4276c0ed58c1e6e) add WORKSPACE_DELETION_PROTECTION env flag to disable workspace deletion from UI and APIs - [`d0dfe58`](https://github.com/Mintplex-Labs/anything-llm/commit/d0dfe58f53503ab2ab74c225098991bdbc5a7d2f) Merge branch 'master' into feat/workspace-deletion-protection - [`2c9784d`](https://github.com/Mintplex-Labs/anything-llm/commit/2c9784ddfb801e0f1e88b411cebcec2efc0b41ce) minor nits - [`f6fe294`](https://github.com/Mintplex-Labs/anything-llm/commit/f6fe2949a96860de6cbcf11052f401343234176d) Merge branch 'master' into feat/workspace-deletion-protection - [`50559fe`](https://github.com/Mintplex-Labs/anything-llm/commit/50559fec43b05a0fe4743b88fb12f6cdef1b5d6d) patch test for phrase - [`d7fa6eb`](https://github.com/Mintplex-Labs/anything-llm/commit/d7fa6eb109eb47e8e94de24eb2fe65c222b880ea) Merge branch 'feat/workspace-deletion-protection' of github.com:Mintplex-Labs/anything-llm into feat/workspace-deletion-protection ### 📊 Changes **13 files changed** (+125 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `docker/.env.example` (+3 -0) 📝 `frontend/src/pages/Admin/Workspaces/WorkspaceRow/index.jsx` (+15 -9) 📝 `frontend/src/pages/Admin/Workspaces/index.jsx` (+9 -2) 📝 `frontend/src/pages/WorkspaceSettings/GeneralAppearance/DeleteWorkspace/index.jsx` (+3 -1) 📝 `frontend/src/pages/WorkspaceSettings/GeneralAppearance/index.jsx` (+2 -2) 📝 `frontend/src/pages/WorkspaceSettings/index.jsx` (+7 -1) 📝 `server/.env.example` (+3 -0) ➕ `server/__tests__/utils/middleware/workspaceDeletionProtection.test.js` (+43 -0) 📝 `server/endpoints/admin.js` (+8 -1) 📝 `server/endpoints/api/workspace/index.js` (+4 -1) 📝 `server/endpoints/workspaces.js` (+8 -1) 📝 `server/models/systemSettings.js` (+2 -0) ➕ `server/utils/middleware/workspaceDeletionProtection.js` (+18 -0) </details> ### 📄 Description ### Pull Request Type <!-- For change type, change [ ] to [x]. --> - [x] ✨ feat (New feature) - [ ] 🐛 fix (Bug fix) - [ ] ♻️ refactor (Code refactoring without changing behavior) - [ ] 💄 style (UI style changes) - [ ] 🔨 chore (Build, CI, maintenance) - [ ] 📝 docs (Documentation updates) ### Relevant Issues <!-- Use "resolves #xxx" to auto resolve on merge. Otherwise, please use "connect #xxx" --> resolves #5604 ### Description <!-- Describe the changes in this PR that are impactful to the repo. What problem does it solve? --> - Adds `WORKSPACE_DELETION_PROTECTION` env flag when present (any value), workspace deletion is disabled across the UI and API. - New `workspaceDeletionProtection` middleware blocks the server-side delete endpoints (`/workspace/:slug`, `/admin/workspace/:id`, `/v1/workspace/:slug`) with a 403. - Hides the delete affordances in the admin workspaces table, workspace row, and workspace settings (general appearance + settings page) when the flag is set, exposed via `SystemSettings` public settings. - Adds unit tests for the middleware. ### Visuals (if applicable) <!-- Add screenshots or screen recordings to demonstrate the changes, especially for UI updates. --> ### Additional Information <!-- Add any other context about the Pull Request here that was not captured above. --> - Docs PR: https://github.com/Mintplex-Labs/anythingllm-docs/pull/250 ### Developer Validations <!-- All of the applicable items should be checked. --> - [x] I ran `yarn lint` from the root of the repo & committed changes - [x] Relevant documentation has been updated (if applicable) - [x] I have tested my code functionality - [x] Docker build succeeds locally --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-06-05 15:21:36 -04:00
yindo closed this issue 2026-06-05 15:21:36 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#5516