fix(server): Persist auto increase storage disable on DB servers (backport #6691)#6695
Merged
Conversation
`configure_auto_add_storage` is always dispatched on the app server from the dashboard ($appServer), with the real target passed as the `server` argument. The enable branch routed to the right doc via `server`, but the disable branch hardcoded `self`, so disabling on a DB/replication server cleared the flag on the app server instead. The target server kept `auto_increase_storage = True` and the checkbox reverted on reload. Resolve the target doc once and use it in both branches. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> (cherry picked from commit 426eda0)
`configure_auto_add_storage` resolves the target via `frappe.get_doc` from
the attacker-controllable `server` argument, but the dashboard API only
team-checks `self` (the app server). The disable path writes via
`frappe.db.set_value`, which skips permission hooks, so any Press User could
flip `auto_increase_storage` off on another team's Database Server by passing
its name. (The enable path was already covered by `save()`'s write hook.)
Add an explicit `server_doc.check_permission("write")` after resolving the
target — guards both branches without giving up `set_value`'s cheap,
side-effect-free single-field write on the disable path.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
(cherry picked from commit 6fab297)
Contributor
|
Target branch is in the excluded branches list. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6695 +/- ##
===========================================
- Coverage 90.92% 50.51% -40.41%
===========================================
Files 117 994 +877
Lines 18085 83737 +65652
Branches 676 526 -150
===========================================
+ Hits 16443 42301 +25858
- Misses 1607 41404 +39797
+ Partials 35 32 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Collaborator
|
🎉 This PR is included in version 0.42.7 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
configure_auto_add_storageis always dispatched on the app server from the dashboard ($appServer), with the real target passed as theserverargument. The enable branch routed to the right doc viaserver, but the disable branch hardcodedself, so disabling on a DB/replication server cleared the flag on the app server instead. The target server keptauto_increase_storage = Trueand the checkbox reverted on reload.Resolve the target doc once and use it in both branches.
This is an automatic backport of pull request #6691 done by Mergify.