Disable feature toggle when featureMap attribute has external storage#1696
Disable feature toggle when featureMap attribute has external storage#1696ethanzhouyc wants to merge 7 commits into
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses an issue where ZAP's UI could get out of sync with the database when attempting to toggle features for clusters whose Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request correctly implements the logic to disable feature toggling when the featureMap attribute has external storage, with well-contained changes and effective unit tests. However, it introduces a Cross-Site Scripting (XSS) vulnerability by concatenating untrusted user input into a warning message that is rendered as HTML in the frontend. This critical security issue must be addressed by sanitizing the input or disabling HTML rendering for these notifications. Additionally, there are minor suggestions to improve code style by using template literals for string construction, enhancing readability and maintainability.
|
@brdandu pointed out that if user toggles a feature with external attributes conforming to it, in this case, ZAP cannot handle updating the value of the attributes, and we should throw a warning. Addressed this issue in the latest ocmmits |
| // Check 0: if the featureMap attribute storage is external, ZAP cannot modify it | ||
| if (featureMapStorageOption === dbEnum.storageOption.external) { | ||
| result.warningMessage.push( | ||
| warningPrefix + |
There was a problem hiding this comment.
Could you give a user use case on when this would show up in the notifications pane?
There was a problem hiding this comment.
Toggling a feature with external attributes conforming to it, would trigger the warning.
Here is the real example I use:
- create endpoint on Extended Color Light
- go to color control cluster
- enable currentHue attribute, change storage from RAM to External, and then disable it
- toggle the HS feature
As currentHue has mandatory conformance on HS, this would trigger the warning:
⚠️ Check Feature Compliance on endpoint: 1, cluster: Color Control, attribute CurrentHue, required by feature: Hue And Saturation (HS), has external storage and ZAP does not have control over it.
There was a problem hiding this comment.
What about existing applications which have this problem?
cae1b85 to
355dcf0
Compare
… remove security issue
355dcf0 to
ed3e4da
Compare
…om both attribute and feature toggle if switch away from External
When the featureMap attribute of a cluster has External storage, ZAP has no control over its value. Toggling the feature will cause mismatch between UI and database.
To solve this, this PR: