Skip to content

New project fails to open in sandboxed iframe (RStudio IDE) #12262

Closed

Description

@dan-aridhia

System details

RStudio Edition : Server
RStudio Version : 2022.07.2+576 "Spotted Wakerobin" Release (e7373ef832b49b2a9b88162cfe7eac5f22c40b34, 2022-09-06) for Ubuntu Bionic
OS Version      : Ubuntu 20.04.5 LTS
R Version       : 4.2.1 (2022-06-23) -- "Funny-Looking Kid"

Steps to reproduce the problem

  1. Load RStudio into an iframe with the sandbox attribute present.
  2. Create a new project File > New Project > New Directory > New Project > Create Project.

I have attached a minimal working demo of the issue with a docker-compose file.
rstudio_sandbox_issue.tar.gz

Describe the problem in detail

Issue

Given R Studio is rendered in a sandboxed iframe, when I create and new project then it hangs on a toast saying "Switching to project path/to/project...". An error appears in the javascript console, akin to:

Unsafe attempt to initiate navigation for frame with URL 'http://localhost/rstudio/' from frame with URL 'http://localhost/rstudio/'. The frame attempting navigation is sandboxed, and is therefore disallowed from navigating its ancestors.

The issue only arises when the sandbox attribute is present. However, removing the sandbox attribute is not an option for us.

This is the same issue as previously raised on the community forum.

Other observations

The project does load successfully if the top level navigation is manually refreshed.

The javascript that triggers the refresh is calling $wnd.location.replace(X). Setting a breakpoint where the error is thrown and instead manually invoking $wnd.location.reload() performs the refresh without issue, and the new project loads as expected.

Describe the behavior you expected

When I create a new project in R studio that is rendered in a sandboxed iframe, the new project loads.

  • I have read the guide for submitting good bug reports.
  • I have installed the latest version of RStudio, and confirmed that the issue still persists.
  • [] If I am reporting an RStudio crash, I have included a diagnostics report.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.

Activity

  1. added
    new
    on Nov 1, 2022
  2. ronblum commented on Nov 2, 2022

    @ronblum
    Contributor

    @dan-aridhia Thank you for raising this! Unfortunately, we don't support running the open source version of RStudio inside of an iframe. It's only available in the professional version. (If you're curious, it's described in the Tutorial API chapter of the admin guide

  3. added
    new
    and removed
    new
    on Nov 2, 2022
  4. ronblum commented on Nov 2, 2022

    @ronblum
    Contributor

    @dan-aridhia I apologize—I'm totally wrong: Running in an iframe is absolutely supported in the open source version, as a security feature. (Covered in the Security Considerations chapter, but you probably already know that. 🙂 )

  5. reopened this on Nov 2, 2022
  6. ronblum commented on Nov 2, 2022

    @ronblum
    Contributor

    Back to the original issue: We don't currently support sandboxed iframes. However, I'll switch this over to an enhancement request for review as we continue to develop RStudio. And sorry for the pendulum swing!

  7. added and removed
    new
    on Nov 2, 2022
  8. dan-aridhia commented on Nov 4, 2022

    @dan-aridhia
    Author

    @ronblum no problem, thanks for the updates. I have reproduced the issue using rstudio workbench. As suspected, this issue is not specific to the open source version of R Studio - it is an issue with the R Studio IDE itself.

  9. github-actions commented on May 4, 2023

    @github-actions

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs, per https://github.com/rstudio/rstudio/wiki/Issue-Grooming. Thank you for your contributions.

  10. added
    stale
    on May 4, 2023
  11. github-actions commented on May 18, 2023

    @github-actions

    This issue has been automatically closed due to inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementstale

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions