Skip to content

Should serve user programs with a different origin #1193

Closed

Description

@cdsmith

Shared Program: https://code.world/haskell#Pjuh_bMGIsr9fbGSkqV8bXQ

Description

This use of JavaScriptFFI allows the opportunity for someone to share a link that steals cookies from a user. The good news is that CodeWorld goes out of its way not to store any really sensitive info -- just an opaque identifier. But it's still not great that it's available via Base64-encoded token in a link. Ideally, student JavaScript would be served from a different origin, with no cookies.

Activity

  1. cdsmith commented on Oct 2, 2019

    @cdsmith
    CollaboratorAuthor

    One issue here is that there is actually quite a lot of cross-frame communication going on, particularly when it comes to: (a) console output, and (b) debugging. Thankfully, the debugger already follows a pretty well-defined protocol, so hopefully shouldn't be too hard to convert to window.postMessage.

  2. cdsmith commented on Oct 2, 2019

    @cdsmith
    CollaboratorAuthor

    It would be best, as well, if code from different projects were isolated and couldn't access each other's local storage and such. This is a lower priority for me, since they aren't expected to USE any local storage. More important to isolate student code from the surrounding web site.

  3. cdsmith commented on Oct 2, 2019

    @cdsmith
    CollaboratorAuthor

    Here's a plan that I think will be valuable:

    1. Rewire console and debugger access to use window.postMessage

    2. Include a sandbox attribute on the iframe for loading student code within the development environment. This only partially mitigates the issue, but it's an important step.

    3. Add configuration options for requiring that student code is served from a different host name or port. This makes setup more complex, so it needs some thought on how to keep things easy for self-hosting, and should probably be made optional.

  4. changed the title [-]Should serve user programs with a different origin from [/-] [+]Should serve user programs with a different origin[/+] on Oct 2, 2019
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions