Conversation
b45667d to
6e529bf
Compare
|
Hey @maghuro Thanks for the PR. While I can probably agree that the bracket notation is cleaner, after reviewing the code a bit closer, I don't think this is actually fixing any issue in MerlinAU.
Those setting names are controlled by MerlinAU and use valid JavaScript identifier syntax, so the existing dot-notation expression works for the properties we actually create and support. I also couldn't identify a realistic path where an attacker-controlled property name reaches this code and causes the current So while: delete shared_custom_settings[prop];Might be arguably cleaner looking, this looks mostly like a code-style/refactoring change rather than a bug fix or security fix. I'd prefer not to change working code purely for cleanup though. Unless there's a error/failure/edge case that the current MerlinAU code cannot handle around it. The project is so mature at this point changing things just to change them is generally "unnecessary" itself ;) Thanks again for taking the time to look through the code though! |
Summary
Remove an unnecessary use of eval from the WebUI custom-settings cleanup.
Problem
LoadCustomSettings() iterates over the properties of shared_custom_settings and removes old MerlinAU entries using dynamically generated JavaScript:
The property name is already available directly as prop, so dynamic code evaluation is unnecessary.
Using eval here also makes property handling less robust because dot notation requires the generated property name to be valid JavaScript identifier syntax.
Fix
Use normal bracket property access:
This deletes exactly the property currently being processed by the loop without constructing or evaluating JavaScript source code.
Behavior
The existing filtering logic remains unchanged.
Properties are removed when:
Version properties continue to be preserved.
Benefits
Scope
This PR changes only one statement in LoadCustomSettings().
No settings loading, saving, filtering, version handling, or firmware-update behavior is otherwise changed.