refactor(frontend): sanitize to support tool-specific profile types#548
Open
refactor(frontend): sanitize to support tool-specific profile types#548
Conversation
Deployment results
Logs #21729990104 |
This reverts commit 59be203.
622fa85 to
00738aa
Compare
sidvishnoi
reviewed
Feb 5, 2026
Comment on lines
48
to
60
| return { | ||
| ...convertToConfigLegacy('', widget), | ||
| versionName: sanitizeText(widget.$name, 'versionName'), | ||
| widgetTitleText: sanitizeText(widget.widgetTitleText, 'widgetTitleText'), | ||
| widgetDescriptionText: sanitizeHtmlField( | ||
| widget.widgetDescriptionText, | ||
| 'widgetDescriptionText', | ||
| ), | ||
| widgetButtonText: sanitizeText( | ||
| widget.widgetButtonText, | ||
| 'widgetButtonText', | ||
| ), | ||
| } |
Member
There was a problem hiding this comment.
Why not sanitize all fields? A malicious user can inject HTML to any other field as well, and in future, if we use it with incorrect assumption that it's clean, it can bite us.
Member
Author
There was a problem hiding this comment.
because zod validations should fail before reaching this point if malicious input is sent. we sanitize fields that pass the simple z.string() check with zod. so, in this PR strengthened zod validation for hex colors, $version, versionName and added some unit tests
Member
Author
There was a problem hiding this comment.
if too much, i can extract the extra zod validations in different PR, and unit tests definitely can be improved, but don't want to switch focus too much
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.
Part of #511
Context
Part of the ongoing effort to deprecate
ElementConfigTypein favor of typed tool profiles