-
Notifications
You must be signed in to change notification settings - Fork 970
feat: Allow dangerous html based on config variable #1459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Allow dangerous html based on config variable #1459
Conversation
683ef32
to
61ecb76
Compare
…d on configuration variable Signed-off-by: MrwanBaghdad <[email protected]>
61ecb76
to
b6e3c8a
Compare
Do we even need to use |
That makes sense to me! |
3edbd64
to
9c04ef2
Compare
9c04ef2
to
b6e3c8a
Compare
…g_variable Signed-off-by: Ozan Dogrultan <[email protected]>
Signed-off-by: Ozan Dogrultan <[email protected]>
@Golodhros @dorianj Can you please take a look at this again? I've implemented the suggestion of including |
export function isProgrammaticDescAllowDangerousHtml(): boolean { | ||
return AppConfig.programmaticDescriptionAllowDangerousHtml; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need a basic tests for this
/** | ||
* Returns whether dangerous html should be allowed in programmatic descriptions | ||
*/ | ||
export function isProgrammaticDescAllowDangerousHtml(): boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a mouthful of name. It is tricky, but I think 'hasHTMLDescription' would work better. Same for the config object field.
@@ -232,7 +233,15 @@ export class TableDetail extends React.Component< | |||
|
|||
return descriptions.map((d) => ( | |||
<EditableSection key={`prog_desc:${d.source}`} title={d.source} readOnly> | |||
<EditableText maxLength={999999} value={d.text} editable={false} /> | |||
<div className="editable-text"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure what are we doing here.
You modified to allow for the 'allowDangerousHtml' prop, why using ReactMarkdown here directly?
Signed-off-by: Ozan Dogrultan <[email protected]>
Signed-off-by: Ozan Dogrultan <[email protected]>
@Golodhros I have changed the approach slightly; instead of checking a frontend config variable, now only programmatic descriptions always allow dangerous html. This would allow the usage of tags like |
Signed-off-by: Ozan Dogrultan <[email protected]>
We talked about this before @dorianj, what do you think about this change? |
@dorianj @Golodhros Any updates on this pull request? It is a small change which would help our team (and potentially teams which require similar functionality) a lot and would be great to see it merged. |
@dorianj @Golodhros Just bumping this up, our team is still looking forward to seeing this PR getting merged! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* For table page's programmatic descriptions, allow dangerous html based on configuration variable Signed-off-by: MrwanBaghdad <[email protected]> * feat: PR review Signed-off-by: Ozan Dogrultan <[email protected]> * feat: Always allowDangerousHtml in programmatic descriptions Signed-off-by: Ozan Dogrultan <[email protected]> * feat: Remove unused imports Signed-off-by: Ozan Dogrultan <[email protected]> * feat: Remove unrelated changes Signed-off-by: Ozan Dogrultan <[email protected]> Co-authored-by: Ozan Dogrultan <[email protected]>
* For table page's programmatic descriptions, allow dangerous html based on configuration variable Signed-off-by: MrwanBaghdad <[email protected]> * feat: PR review Signed-off-by: Ozan Dogrultan <[email protected]> * feat: Always allowDangerousHtml in programmatic descriptions Signed-off-by: Ozan Dogrultan <[email protected]> * feat: Remove unused imports Signed-off-by: Ozan Dogrultan <[email protected]> * feat: Remove unrelated changes Signed-off-by: Ozan Dogrultan <[email protected]> Co-authored-by: Ozan Dogrultan <[email protected]>
Summary of Changes
Added configuration variable to allow rendering of dangerous HTML in the programmatic description for table detail pages
Tests
Documentation
The use case is that we'd like to enable embedding in the programmatic descriptions. As the programmatic descriptions are populated by an ingestion pipeline that can validate its safety and is not editable by any web user; a requirement missing in the table description were editing may be allowed and it won't be safe to enable such functionality of rendering dangerous HTML
CheckList
Make sure you have checked all steps below to ensure a timely review.