Skip to content
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

Bug 1975391: fix install operator description iframe #9929

Conversation

debsmita1
Copy link
Contributor

Fixes:
https://issues.redhat.com/browse/OCPBUGSM-31320

Solution description:

  • using the useResizeObserver hook to observe window resizes and passed the onLoad func to recalculate the dimensions of the iframe

GIF:
io-desc

@openshift-ci openshift-ci bot added bugzilla/severity-low Referenced Bugzilla bug's severity is low for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. labels Aug 30, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 30, 2021

@debsmita1: This pull request references Bugzilla bug 1975391, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.9.0) matches configured target release for branch (4.9.0)
  • bug is in the state NEW, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

No GitHub users were found matching the public email listed for the QA contact in Bugzilla (gamore@redhat.com), skipping review request.

In response to this:

Bug 1975391: fix install operator description iframe

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci openshift-ci bot added the component/core Related to console core functionality label Aug 30, 2021
@debsmita1
Copy link
Contributor Author

/kind bug

@openshift-ci openshift-ci bot added the kind/bug Categorizes issue or PR as related to a bug. label Aug 30, 2021
@debsmita1
Copy link
Contributor Author

/assign @christianvogt

@debsmita1 debsmita1 force-pushed the fix-Operator-description-iframe branch from d524433 to aebf3be Compare August 31, 2021 07:54
@openshift-ci openshift-ci bot added the component/helm Related to helm-plugin label Aug 31, 2021
@@ -202,6 +202,7 @@ const IFrameMarkdownView: React.FC<InnerSyncMarkdownProps> = ({
updateDimensions();
setLoaded(true);
}, [updateDimensions]);
useResizeObserver(onLoad);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
useResizeObserver(onLoad);
useResizeObserver(updateDimensions, frame);

@christianvogt
Copy link
Contributor

In general I don't see why we continue to use iframe markdown views instead of setting the inline option to render the markdown inline without the iframe.

But adding the resize observer is a less risky change at this time and a good update for the iframe variant.

@rohitkrai03
Copy link
Contributor

/retest

Copy link
Contributor

@rohitkrai03 rohitkrai03 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Sep 3, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Sep 3, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: debsmita1, rohitkrai03

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 3, 2021
@openshift-merge-robot openshift-merge-robot merged commit 48c2b18 into openshift:master Sep 4, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Sep 4, 2021

@debsmita1: All pull requests linked via external trackers have merged:

Bugzilla bug 1975391 has been moved to the MODIFIED state.

In response to this:

Bug 1975391: fix install operator description iframe

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@spadgett spadgett added this to the v4.9 milestone Sep 4, 2021
@@ -203,6 +203,8 @@ const IFrameMarkdownView: React.FC<InnerSyncMarkdownProps> = ({
setLoaded(true);
}, [updateDimensions]);

useResizeObserver(updateDimensions, frame);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is triggering the error:

unhandled error: ResizeObserver loop limit exceeded

If we update the frame height here, it triggers a ResizeObserver event since the frame size changed, which updates the height, etc.

Related to bug https://bugzilla.redhat.com/show_bug.cgi?id=2003120

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally we fail CI on any uncaught error. I think the reason this wasn't failing CI is because we had an uncaught error in our error handler... We assume error is defined in window.onerror when sometimes we just get message, so it blows up here before seeing window.windowError:

https://github.com/openshift/console/blob/master/frontend/public/components/app.jsx#L365

@spadgett
Copy link
Member

In general I don't see why we continue to use iframe markdown views instead of setting the inline option to render the markdown inline without the iframe.

Security. This lets us sandbox the content.

@christianvogt
Copy link
Contributor

@spadgett but we also already sanitize the output to an allow list of html tags.

@spadgett
Copy link
Member

@christianvogt We do, but sanitizing markup is really really easy to get wrong. If there's ever a bug in the library we use for it, it opens us up to XSS attacks. Sandboxing prevents it entirely. To me, we'd need a very good reason to move away from sandboxed iframes.

@christianvogt
Copy link
Contributor

@spadgett fair enough. However a goal of santize-html is to address XSS and we should keep the library up to date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. bugzilla/severity-low Referenced Bugzilla bug's severity is low for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. component/core Related to console core functionality component/helm Related to helm-plugin kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants