Skip to content

explain transitivity mechanisms #33

Open

Description

@caridy

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.

Activity

  1. weizman commented on Sep 26, 2024

    @weizman
    Collaborator

    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)

  2. caridy commented on Sep 27, 2024

    @caridy
    Author

    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.

  3. weizman commented on Sep 29, 2024

    @weizman
    Collaborator

    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.

  4. caridy commented on Sep 30, 2024

    @caridy
    Author

    fair enough, but how to feature test this? just curious!

  5. weizman commented on Sep 30, 2024

    @weizman
    Collaborator

    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.

  6. caridy commented on Oct 2, 2024

    @caridy
    Author

    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?

  7. weizman commented on Oct 4, 2024

    @weizman
    Collaborator

    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.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions