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

Setting sandbox attribute of frame #258

Closed
th174 opened this issue Aug 19, 2019 · 5 comments
Closed

Setting sandbox attribute of frame #258

th174 opened this issue Aug 19, 2019 · 5 comments

Comments

@th174
Copy link

th174 commented Aug 19, 2019

Is there some way to set the sandbox attribute of the iframe? Specifically, I want to prevent the child inside the iframe from being able to inject javascript inside the context of the parent.

@bluepnume
Copy link
Collaborator

Hi @th174.

You can do:

const MyComponent = zoid.create({
    attributes: {
        iframe: {
            sandbox: '...'
        }
    }
})

That said:

I want to prevent the child inside the iframe from being able to inject javascript inside the context of the parent

If the iframe is on a different domain, that will be impossible anyway, even without sandbox

@th174
Copy link
Author

th174 commented Aug 19, 2019

If the iframe is on a different domain, that will be impossible anyway, even without sandbox

That's currently how it is, however, because of some unrelated requirements, I might need to reverse proxy the iframe's domain through the parent's domain. In that case, I would need the sandbox to preserve the same separation of permissions.

@bluepnume
Copy link
Collaborator

Interesting. Could you reverse-proxy onto a subdomain? Otherwise the site will also have same-domain access to any of your server's urls/apis.

@th174
Copy link
Author

th174 commented Aug 19, 2019

I was hoping to prevent that by revoking allow-same-origin access with the sandbox attribute. Would that not be sufficient?

@bluepnume
Copy link
Collaborator

That would work, but what if somebody redirects to the page outside of an iframe? Using a subdomain would give an extra layer of security for cases like that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants