You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What would happen when a newly created same domain iframe without the meta/header attempts to create another same domain iframe? Similarly, what would happen if the iframe's src (from same domain) does have additional meta/header itself? I see the following paragraph in the readme:
the top main realm is the only realm in a webpage with the power to set the new CSP directive, and it must trickle down to child realms from the same origin, as they don't have the power to set this directive.
But it is not clear how this will work. While CSP directives can trickle down just fine... this is not about a traditional CSP rule, but about an entry point to execute scripts. What happens if top adds a.js, while the iframe adds b.js to the meta/header? From the paragraph above it seems that only a.js gets executed, even though b.js should be additive.
The paragraph correctly manifests this proposal's intention - b.js should not be added.
Non-top realms should not be able to set the RIC directive, I am not yet convinced it makes sense for child realms to be able to set it.
As for this not being a classic CSP rule, agreed, we are already investigating whether CSP is most appropriate for this proposal #10 (comment)
Non-top realms should not be able to set the RIC directive, I am not yet convinced it makes sense for child realms to be able to set it.
The thing is that in many cases, the child does not need to know that it is being embedded, nor it needs to be controlled by the same people. In the child app requires the directive to function well, will that app just simply fail to load because it is trying to exercise a capability that is often available but not always available? I don't recall any precedent for something like this in the web.
I don't recall any precedent for something like this in the web.
The whole 3rd party scripts long living paradigm is such precedent, which is true to almost any software that's being constructed at runtime (remember '$' is undefined?).
When websites are being constructed live in the browser, they embed scripts that often count on some prerequisites to exist. To this day many of them do so unsafely, and by that crash with exceptions, but the better ones simply check for those required prerequisites to exist before counting on them.
Same goes for cross origin iframes, and same would be expected from same origin iframes - to check whether capabilities needed by the child were first initialized via an RIC script (or something else) at the top.
Well, it really depends on what they expect to find, since RIC's nature is essentially code.
So if the precedent was '$' is undefined so that scripts would ask if (!window['$']) return, here it would be pretty much the same, where a normal script would ask if (!window['SOME_API_LEFT_BY_RIC']) return.
Since many RIC use cases would be to perform reconfiguration of the environment instead of exposing new APIs, they could also leave a mark instead if (!window['ENV_DEFENDER_JS_DOT_COM_EXECUTED']) return.
Oh, that's a user-land mechanism, I was asking about a built-in mechanism, equivalent to something like "am I being embedded?", so you can take certain measures. Equivalently, I can ask, is my app running in a distorted env, so I can't really distort my same domain iframes?
The spirit of the web from what I've gathered is that it doesn't provide builtin tools to tell whether your env is distorted (which is different from telling that your env is embedded, which is possible).
Meaning, when extensions mutate the env, or some script does, before your code runs, your code does not have tools to tell that such a scenario took place. Same goes for telling which CSP rules are actively restricting your environment.
Given that, how do you find RIC to be different? What of its nature convinces you it should let participants know it is there via builtin APIs?
Activity
weizman commentedon Sep 26, 2024
The paragraph correctly manifests this proposal's intention -
b.jsshould not be added.Non-top realms should not be able to set the RIC directive, I am not yet convinced it makes sense for child realms to be able to set it.
As for this not being a classic CSP rule, agreed, we are already investigating whether CSP is most appropriate for this proposal #10 (comment)
caridy commentedon Sep 27, 2024
The thing is that in many cases, the child does not need to know that it is being embedded, nor it needs to be controlled by the same people. In the child app requires the directive to function well, will that app just simply fail to load because it is trying to exercise a capability that is often available but not always available? I don't recall any precedent for something like this in the web.
weizman commentedon Sep 29, 2024
The whole 3rd party scripts long living paradigm is such precedent, which is true to almost any software that's being constructed at runtime (remember
'$' is undefined?).When websites are being constructed live in the browser, they embed scripts that often count on some prerequisites to exist. To this day many of them do so unsafely, and by that crash with exceptions, but the better ones simply check for those required prerequisites to exist before counting on them.
Same goes for cross origin iframes, and same would be expected from same origin iframes - to check whether capabilities needed by the child were first initialized via an RIC script (or something else) at the top.
caridy commentedon Sep 30, 2024
fair enough, but how to feature test this? just curious!
weizman commentedon Sep 30, 2024
Well, it really depends on what they expect to find, since RIC's nature is essentially code.
So if the precedent was
'$' is undefinedso that scripts would askif (!window['$']) return, here it would be pretty much the same, where a normal script would askif (!window['SOME_API_LEFT_BY_RIC']) return.Since many RIC use cases would be to perform reconfiguration of the environment instead of exposing new APIs, they could also leave a mark instead
if (!window['ENV_DEFENDER_JS_DOT_COM_EXECUTED']) return.caridy commentedon Oct 2, 2024
Oh, that's a user-land mechanism, I was asking about a built-in mechanism, equivalent to something like "am I being embedded?", so you can take certain measures. Equivalently, I can ask, is my app running in a distorted env, so I can't really distort my same domain iframes?
weizman commentedon Oct 4, 2024
The spirit of the web from what I've gathered is that it doesn't provide builtin tools to tell whether your env is distorted (which is different from telling that your env is embedded, which is possible).
Meaning, when extensions mutate the env, or some script does, before your code runs, your code does not have tools to tell that such a scenario took place. Same goes for telling which CSP rules are actively restricting your environment.
Given that, how do you find RIC to be different? What of its nature convinces you it should let participants know it is there via builtin APIs?
Maybe I'm missing something.