javascript - How can I limit what domains a sandboxed iframe can connect to? -


i'm creating app ecosystem each app runs in sandboxed iframe , processes sensitive data. want allow scripts, don't want iframe communicate 3rd party server or might leak data.

is there way enforce whitelist can chrome extensions? going wrong way?

you want limit domains can connected things, not xhr (an img tag can leak data well). modern browsers offer feature called content security policy.

in particular, whitelist domains, want return header following:

content-security-policy: default-src 'self' safedomain.com securedomain.com 

like security related, make sure read on topic , understand implications of dealing with. copy-pasting code stack overflow answer not enough.

also remember older browsers not support feature , silently not enforce it, want detect , prevent browsers exposing sensitive data.


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -