Fix: Disallow reading settings from share containing apostrophe#2397
Conversation
WalkthroughAdds filtering to exclude shares with apostrophes in their names across NFS, SMB, and Share Edit pages. In SMB, introduces a client-side checkPublicSelection function to toggle a public-security warning on load and on selection change. No public APIs changed. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant DOM as DOM
participant SMBPage as SecuritySMB.page
participant UI as Warning Banner
User->>DOM: Load SMB Security page
DOM->>SMBPage: DOMContentLoaded
SMBPage->>SMBPage: checkPublicSelection(shareSecurity)
alt Security = Public
SMBPage->>UI: Show warning
else Security ≠ Public
SMBPage->>UI: Hide warning
end
User->>SMBPage: Change shareSecurity
SMBPage->>SMBPage: checkPublicSelection(shareSecurity)
alt Security = Public
SMBPage->>UI: Show warning
else
SMBPage->>UI: Hide warning
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests
Comment |
🔧 PR Test Plugin AvailableA test plugin has been generated for this PR that includes the modified files. Version: 📥 Installation Instructions:Install via Unraid Web UI:
Alternative: Direct Download
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
emhttp/plugins/dynamix/SecuritySMB.page (1)
384-403: checkPublicSelection: add a small null-guard for robustness (optional).If the selector ever fails (edge templates), avoid a potential NPE.
Apply this minimal diff:
document.addEventListener("DOMContentLoaded", function() { - let smbSecuritySelect = document.querySelector('[name="shareSecurity"]'); - checkPublicSelection(smbSecuritySelect); + const smbSecuritySelect = document.querySelector('[name="shareSecurity"]'); + if (smbSecuritySelect) checkPublicSelection(smbSecuritySelect); });
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
emhttp/plugins/dynamix/SecurityNFS.page(2 hunks)emhttp/plugins/dynamix/SecuritySMB.page(6 hunks)emhttp/plugins/dynamix/ShareEdit.page(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: Squidly271
PR: unraid/webgui#0
File: :0-0
Timestamp: 2025-05-31T05:10:13.120Z
Learning: Squidly271 prefers not to receive CodeRabbit reviews or feedback while PRs are in draft status. Only provide reviews after PRs are moved out of draft.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (3)
emhttp/plugins/dynamix/ShareEdit.page (1)
329-331: Apostrophe-filter in clone lists looks correct; strict=== falseavoids 0-index trap. Confirm scope (write targets) is intended.This filter feeds both the “Read settings from” and “Write settings to” lists. If the goal was only to block reading from apostrophe-named shares, hiding them from write targets is a broader behavior change. Intentional?
emhttp/plugins/dynamix/SecurityNFS.page (1)
34-35: Consistent apostrophe-filter in NFS read/write lists — LGTM.Filtering via
strpos($list['name'],"'") === falseis safe and does what we want.If the original requirement is only “disallow reading,” confirm that excluding apostrophe-named shares from write targets is also desired.
Also applies to: 51-52
emhttp/plugins/dynamix/SecuritySMB.page (1)
37-38: Apostrophe-filter applied across SMB read/write and user-access lists — LGTM.Matches NFS and ShareEdit behavior. As with other pages, please confirm the broader scope (blocking write targets too) is intentional.
Also applies to: 54-55, 157-158, 174-175, 220-221, 237-238
🧹 PR Test Plugin Cleaned UpThe test plugin and associated files for this PR have been removed from the preview environment. 🤖 This comment is automatically generated when a PR is closed. |
Summary by CodeRabbit
New Features
Bug Fixes