You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "justinpark (via GitHub)" <gi...@apache.org> on 2023/11/08 02:24:54 UTC
[PR] fix(sqllab): invalid sanitization on comparison symbol [superset]
justinpark opened a new pull request, #25903:
URL: https://github.com/apache/superset/pull/25903
### SUMMARY
The current regular expression for HTML detection is inadequate, as it removes text containing comparison symbols. (i.e. `a <= 10 and b > 10`)
This commit updates the isProbablyHTML regex expression to fix the issue.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before:

After:

### TESTING INSTRUCTIONS
Go to SQL Lab and run `select 'a <= 10 and b > 10'`
Check the result table
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(sqllab): invalid sanitization on comparison symbol [superset]
Posted by "john-bodley (via GitHub)" <gi...@apache.org>.
john-bodley commented on code in PR #25903:
URL: https://github.com/apache/superset/pull/25903#discussion_r1385909645
##########
superset-frontend/packages/superset-ui-core/src/utils/html.tsx:
##########
@@ -28,7 +28,7 @@ export function sanitizeHtml(htmlString: string) {
}
export function isProbablyHTML(text: string) {
- return /<[^>]+>/.test(text);
+ return /<\/?[a-z][\s\S]*>/i.test(text);
Review Comment:
@justinpark is there merit in using a non-regex implementation, i.e., something like [this](https://stackoverflow.com/a/55680987)?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(sqllab): invalid sanitization on comparison symbol [superset]
Posted by "justinpark (via GitHub)" <gi...@apache.org>.
justinpark merged PR #25903:
URL: https://github.com/apache/superset/pull/25903
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(sqllab): invalid sanitization on comparison symbol [superset]
Posted by "justinpark (via GitHub)" <gi...@apache.org>.
justinpark commented on code in PR #25903:
URL: https://github.com/apache/superset/pull/25903#discussion_r1386950906
##########
superset-frontend/packages/superset-ui-core/src/utils/html.tsx:
##########
@@ -28,7 +28,7 @@ export function sanitizeHtml(htmlString: string) {
}
export function isProbablyHTML(text: string) {
- return /<[^>]+>/.test(text);
+ return /<\/?[a-z][\s\S]*>/i.test(text);
Review Comment:
that looks good.let me try with the alternative solution.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org