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

iFrame redirection not working #197

Closed
hc1idam opened this issue Jan 2, 2024 · 6 comments
Closed

iFrame redirection not working #197

hc1idam opened this issue Jan 2, 2024 · 6 comments

Comments

@hc1idam
Copy link

hc1idam commented Jan 2, 2024

We have updated our well-know sites JSON to align with the guidance provided but we are running into a redirection problem that we are unsure how to resolve.

We have this defined (currently what we see showing up when looking at chrome://system/ under the Related Website Sets):

{
"AssociatedSites": [ "https://hc1.global" ],
"PrimarySites": [ "https://hc1.com" ],
"ServiceSites": [ "https://hc1cas.com", "https://hc1cas.global" ]
}

But we have the following situation (example):

Launch https://labtastic.hc1.com/
Inside of that, there is an iFramed page that references https://labtastic.bi.hc1.com/MIPreDashboard.i4 this url redirects to https://www.hc1cas.com/ for authentication.

When we launch this in the iFrame, we are not being redirected from the https://labtastic.bi.hc1.com/ url BUT if we launch https://labtastic.bi.hc1.com/ from another browser, it will redirect.

Is there something further we need to define for this to work properly in an iFramed context?

@hc1idam
Copy link
Author

hc1idam commented Jan 2, 2024

Clarification, we are being redirected from https://labtastic.bi.hc1.com/MIPreDashboard.i4 to https://www.hc1cas.com/ in the iframe, we were just expecting that we would not be asked to re-authenticate in the iframe context. We would expect the cookie in the container to not be blocked in the iframe in this case since the sites are related.

@cfredric
Copy link
Collaborator

cfredric commented Jan 3, 2024

Can you confirm that your iframe is calling document.requestStorageAccess() appropriately?

Related Website Sets does not make cookies available by default within the set; it just allows sites within the set to skip the Storage Access API's permission prompt. (See documentation.) So your iframe must call document.requestStorageAccess() if it wants to access its cookies.

@hc1idam
Copy link
Author

hc1idam commented Jan 3, 2024 via email

@cfredric
Copy link
Collaborator

cfredric commented Jan 3, 2024

we are not currently explicitly calling document.RequestStorage() from the iFrame, but we have never had to explicitly do that for this transfer to work.

Can you clarify what you mean by this - has this kind of flow worked for you in Chrome (while third-party cookies are blocked) without having to call document.requestStorageAccess()? To my knowledge, that kind of flow was never supported in Chrome.

Are you saying that we MUST do that when 3rd Party Cookies are disabled?

Yes*, in order for the Storage Access API (and therefore Related Website Sets) to allow you to access those cookies. This requirement is for security reasons (see discussion here: privacycg/storage-access#113).

I recognize that this requirement is restrictive, so I've proposed https://github.com/cfredric/storage-access-headers to improve ergonomics and utility without regressing security. Please take a look and let me know if that would help your use case.

*Chrome is also implementing some heuristics (https://groups.google.com/u/1/a/chromium.org/g/blink-dev/c/yGhI6iTAfeA/m/Z4DR3K23AQAJ) to implicitly restore access to third-party cookies in some limited cases. But these heuristics may not apply to your usage patterns, don't have anything to do with Related Website Sets, and may or may not work the same in every browser, so you may choose not to rely on them.

@hc1idam
Copy link
Author

hc1idam commented Jan 3, 2024 via email

@cfredric
Copy link
Collaborator

cfredric commented Jan 3, 2024

Thanks for the clarification. In that case I think this is working as expected from Chrome's point of view; if you update your iframe to call document.requestStorageAccess() each time before trying to use cookies, it should work properly for you. (Some more info on Chrome's exact behavior is here: https://github.com/cfredric/chrome-storage-access-api?tab=readme-ov-file#design-details.)

Closing.

@cfredric cfredric closed this as completed Jan 3, 2024
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