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
The architecture of that library's storage is such that trying to login to app B results in a redirect to app A instead.
I understand the blocker on this one was that it's a major architecture change and hosting multiple apps on the same origin is not encouraged. The issue documents the use cases this would enable.
CSS is intended to follow relevant specs, and it turns out that the behaviour of prompt=consent is under-specified. This means that silent authentication is broken.
It appears that refresh token rotation is now considered an acceptable client side solution that permits refresh token storage in browser.
I think Solid-client-authn-browser is unlikely to support this given their current thinking on storage of tokens, e.g., inrupt/solid-client-authn-js#3443
This library might come to a different conclusion?
Hi 👋 and thank you so much for reaching out!
Also, thanks for linking the issues.
From what I understand, there are two related yet distinct points of discussion:
supporting multi-page apps
allowing different apps/clients on the same origin
Status Quo
We chose to not use localStorage because we did not want to persist the refresh tokens - as I said in the README - I am unsure if this is really secure. So, we chose to use sessionStorage. Yes, if a user closes a tab, they need to login again - but I like that better than potentially leaking a session across tabs or being extracted from localStorage after the fact. Again - not sure if this concern is valid - but I feel better this way 😄
We use sessionStorage to store client id, refresh token etc. to allow for refreshing tokens using the RefreshTokenFlow. No redirect is needed in that flow, so if a client id, refresh token etc. are present in the sessionStorage, we simply obtain a fresh set of tokens. I believe this already/directly allows mutli-page applications to re-establish a session when doing full page reloads: Everytime the page is reloaded, the RefreshTokenGrant is executed (as the sessionStorage persists until the tab is closed).
sessionStorage is origin-bound and tab-bound, meaning that you can have multiple distinct sessions on the same origin using different tabs. I believe this already/directly allows for having distinct sessions in different "apps" served on the same origin.
Security Considerations
Despite the fact that the current setup allows for the above, we need to carefully review the security implications.
For a multi-page app, we are golden, we only have one Solid App (client) running on the origin. We thus only have on client_id, that we need to consider.
Now, the crux:
If you consider a multi-page app to actually be comprised of two (or more) Solid Apps (with distinct client_ids ), then it is possible for one Solid App to hijack the session of the other Solid App:
While sessionStorage does not persist after the tab is closed and is not available across tabs, it is still possible that when moving between the two Solid Apps on the same origin in the same tab (similar to moving between pages of the multi-page app served in that origin) the existing refresh token from Solid App 1 can be re-used by Solid App 2 to retrieve fresh tokens (just like the multi-page app does). So now Solid App 2 actually has tokens with the client_id of Solid App 1.
This is a problem from a security perspective: If a resource on a Solid Pod has been restricted via ACP to only be accesible for Solid App 1 but not Solid App 2, the resource can still be accessed by Solid App 2 using the just obtained token (outlined above).
Therefore, I would like to suggest to adhere to the origin-centered security perspective that aligns with the browsers' security mechansims.
If you want to serve multiple Solid Apps under the same origin, I'd suggest you consider this composition one mutli-page app with one overreaching client_id. This way, it is explicit that the different Solid Apps are really just one compositional app living in the same security context / within the same security boundaries enforced by the browser.
If you think that the two Solid Apps should still have distinct client_id, then I strongly suggest you consider the browsers' security mechansims, and thus see that the two disinct Solid Apps would live in the same security context, and thus exhibit a security issue. Therefore, I would strongly recommend in this case to consider serving the two Solid Apps from distinct origins - which aligns the conceptual model of distinct apps with the security model of the browsers: each distinct Solid App / client thus resides in its distinct security context.
To summarise my point: The question on multiple apps on the same origin is to be answered by considering the conceptual relation of the multiple apps with regards to the browers' security mechansims - not by plainly dismissing it as insecure.
I shall include this discussion in a security considerations section in the README.
Thanks for the thorough explanation. This sounds promising and I look forward to trying it out!
Two additional clarifications:
If you think that the two Solid Apps should still have distinct client_id, then I strongly suggest you consider the browsers' security mechanisms, and thus see that the two distinct Solid Apps would live in the same security context, and thus exhibit a security issue.
I would expect this library to handle this case by storing tokens for each client id separately. Is this already the case?
This doesn't protect against one app accessing tokens from the other 1, but I don't think the app should assume that just because the apps are on the same domain, they have the same client id.
The basic example is two apps on the same domain using dynamic registration. If I navigate from one to the other within a tab, I expect that they would each require a separate login and they wouldn't interfere with each other. Using a static client id would be an effective work around, but shouldn't be required.
One possible reason for using dynamic registration is to avoid the redirect URIs from needing to be comprehensively listed ahead of time, e.g. for a multi page app that has arbitrary landing pages.
The second question was to ask whether the library already performs refresh token rotation, i.e. a refresh token is only ever used once?
It sounds like it might?
If not, it would help mitigate the risk that a malicious app exfiltrates the refresh token and achieves persistent access beyond the session.
Footnotes
I don't think this is worth aiming for - it makes sense that if the apps are on the same domain, then presumably malicious apps could share tokens through a back channel anyway. ↩
If you think that the two Solid Apps should still have distinct client_id, then I strongly suggest you consider the browsers' security mechanisms, and thus see that the two distinct Solid Apps would live in the same security context, and thus exhibit a security issue.
I would expect this library to handle this case by storing tokens for each client id separately. Is this already the case?
No. We store the session's details (e.g. client_id and refresh token) in the sessionStorage, and we do not consider having multiple session details (from different paths on an origin) in the same sessionStorage because as you state:
This doesn't protect against one app accessing tokens from the other
which is exactly the security issue, I described above.
I don't think this is worth aiming for - it makes sense that if the apps are on the same domain, then presumably malicious apps could share tokens through a back channel anyway
I politely disagree:
You suggest that two malicious apps on the same origin would share their tokens through a back channel - which makes the whole security discussion irrelevant - independent of whether or not the apps are served on the same origin. So if you assume a back channel, the whole security discussion ends right here as any authentication library could be used in that case and the malicious apps would collude anyway.
Therefore, we consider the case where there is a malicious app that tries to get access to the tokens of honest apps.
In the trust model of Solid-OIDC and ACP, apps that have distinct client_ids can be authorized for the same or different resource access / actions. No app should be able to elevate their privilege by design.
If you as the person deploying the apps already deem the two apps trustworthy and know that they "play nice" then you do not need to assign distinct client_ids and the two apps comprise a compositional app, living a in joint security context.
but I don't think the app should assume that just because the apps are on the same domain, they have the same client id.
The app does not assume anything. It is the person deploying the app who assigns the client_id.
The client_id primarily serves as a security control (for identification, authentication, and authorization) in (Solid-) OIDC.
Its purpose goes beyond just identifying a thing (compared to "just" a URI), or in this case, a set of functionalities provided by an app.
Therefore, the question if two apps should operate under the same client_id is primarily a security question and only second a question of concepts. You can still assign different identifiers to the two apps under the same origin (e.g. via their path) but the client_id to use relates to the security context that these two apps operate in. And as stated above, if the two apps should have different client_ids to distinguish them in authorization procedures then they MUST operate in distinct security contexts (as e.g. provided by the browser).
The basic example is ...
I understand where you are coming from - however - dynamic registration is not an issue here. Dynamic registration cannot be used effectively in restricting access to Pod-stored resources anyway (as the client_id is dynamic). Also, redirect URIs do not need to be known ahead of time, you can simply provide window.location.href when calling the login function. You can have multiple apps on the same origin, you will just be logged in automatically (via RefreshTokenFlow) when switching from one app to another (see #4). Therefore, when using dynamic registration all apps just use the same session information - you will not run into a limitation here (afaik). But maybe I just do not quite understand your exact problem?
Do you really want distinct logins and distinct sessions? This is not a question of concept but a question of security. You MUST deploy the apps on different origins.
To re-iterate my point: We cannot manage distinct sessions within sessionStorage securely. Not because we do not want to but because the browser does not provide us a more granular and secure option.
The second question was to ask whether the library already performs refresh token rotation, i.e. a refresh token is only ever used once?
It sounds like it might?
Thank you for raising the question - I'll look into this. If storing the fresh refresh token is not implemented yet, it should be an easy fix. (EDIT: It was, see #5)
If not, it would help mitigate the risk that a malicious app exfiltrates the refresh token and achieves persistent access beyond the session.
AFAIK, token rotation is to be enforced by the server - not the client. If a refresh token is obtained by an attacker (malicious client) but the server does not rotate the refresh tokens, the attacker is always able to use the refresh token successfully after the fact.
Also, redirect URIs do not need to be known ahead of time, you can simply provide window.location.href when calling the login function. You can have multiple apps on the same origin, you will just be logged in automatically (via RefreshTokenFlow) when switching from one app to another (see #4). Therefore, when using dynamic registration all apps just use the same session information - you will not run into a limitation here (afaik). But maybe I just do not quite understand your exact problem?
The server checks that the redirect URIs match those provided in the client id document, so the only way to not specify a redirect URI ahead of time is to use dynamic registration - assuming it's data that does not require access to be restricted to a specific app.
I note that your multi-page example gets around this issue by different pages reusing the same refresh token, which makes sense to me and is a nice innovation!
I think further exploration of this use case needs a concrete example, so I'll have to get back to you. Thanks for mentioning me in the other issue.
Activity
uvdsl commentedon Apr 26, 2025
Hi 👋 and thank you so much for reaching out!
Also, thanks for linking the issues.
From what I understand, there are two related yet distinct points of discussion:
Status Quo
We chose to not use
localStoragebecause we did not want to persist the refresh tokens - as I said in the README - I am unsure if this is really secure. So, we chose to usesessionStorage. Yes, if a user closes a tab, they need to login again - but I like that better than potentially leaking a session across tabs or being extracted fromlocalStorageafter the fact. Again - not sure if this concern is valid - but I feel better this way 😄We use
sessionStorageto store client id, refresh token etc. to allow for refreshing tokens using the RefreshTokenFlow. No redirect is needed in that flow, so if a client id, refresh token etc. are present in thesessionStorage, we simply obtain a fresh set of tokens. I believe this already/directly allows mutli-page applications to re-establish a session when doing full page reloads: Everytime the page is reloaded, the RefreshTokenGrant is executed (as thesessionStoragepersists until the tab is closed).sessionStorageis origin-bound and tab-bound, meaning that you can have multiple distinct sessions on the same origin using different tabs. I believe this already/directly allows for having distinct sessions in different "apps" served on the same origin.Security Considerations
Despite the fact that the current setup allows for the above, we need to carefully review the security implications.
For a multi-page app, we are golden, we only have one Solid App (client) running on the origin. We thus only have on
client_id, that we need to consider.Now, the crux:
If you consider a multi-page app to actually be comprised of two (or more) Solid Apps (with distinct
client_ids ), then it is possible for one Solid App to hijack the session of the other Solid App:While
sessionStoragedoes not persist after the tab is closed and is not available across tabs, it is still possible that when moving between the two Solid Apps on the same origin in the same tab (similar to moving between pages of the multi-page app served in that origin) the existing refresh token from Solid App 1 can be re-used by Solid App 2 to retrieve fresh tokens (just like the multi-page app does). So now Solid App 2 actually has tokens with theclient_idof Solid App 1.This is a problem from a security perspective: If a resource on a Solid Pod has been restricted via ACP to only be accesible for Solid App 1 but not Solid App 2, the resource can still be accessed by Solid App 2 using the just obtained token (outlined above).
Therefore, I would like to suggest to adhere to the origin-centered security perspective that aligns with the browsers' security mechansims.
If you want to serve multiple Solid Apps under the same origin, I'd suggest you consider this composition one mutli-page app with one overreaching
client_id. This way, it is explicit that the different Solid Apps are really just one compositional app living in the same security context / within the same security boundaries enforced by the browser.If you think that the two Solid Apps should still have distinct
client_id, then I strongly suggest you consider the browsers' security mechansims, and thus see that the two disinct Solid Apps would live in the same security context, and thus exhibit a security issue. Therefore, I would strongly recommend in this case to consider serving the two Solid Apps from distinct origins - which aligns the conceptual model of distinct apps with the security model of the browsers: each distinct Solid App / client thus resides in its distinct security context.To summarise my point: The question on multiple apps on the same origin is to be answered by considering the conceptual relation of the multiple apps with regards to the browers' security mechansims - not by plainly dismissing it as insecure.
I shall include this discussion in a security considerations section in the README.
Looking forward to your feedback! 🚀
jg10-mastodon-social commentedon Apr 28, 2025
Thanks for the thorough explanation. This sounds promising and I look forward to trying it out!
Two additional clarifications:
I would expect this library to handle this case by storing tokens for each client id separately. Is this already the case?
This doesn't protect against one app accessing tokens from the other 1, but I don't think the app should assume that just because the apps are on the same domain, they have the same client id.
The basic example is two apps on the same domain using dynamic registration. If I navigate from one to the other within a tab, I expect that they would each require a separate login and they wouldn't interfere with each other. Using a static client id would be an effective work around, but shouldn't be required.
One possible reason for using dynamic registration is to avoid the redirect URIs from needing to be comprehensively listed ahead of time, e.g. for a multi page app that has arbitrary landing pages.
The second question was to ask whether the library already performs refresh token rotation, i.e. a refresh token is only ever used once?
It sounds like it might?
If not, it would help mitigate the risk that a malicious app exfiltrates the refresh token and achieves persistent access beyond the session.
Footnotes
I don't think this is worth aiming for - it makes sense that if the apps are on the same domain, then presumably malicious apps could share tokens through a back channel anyway. ↩
uvdsl commentedon Apr 30, 2025
Thank you for your input!
Again, I'd like to offer a different perspective:
No. We store the session's details (e.g.
client_idandrefresh token) in thesessionStorage, and we do not consider having multiple session details (from different paths on an origin) in the samesessionStoragebecause as you state:which is exactly the security issue, I described above.
I politely disagree:
You suggest that two malicious apps on the same origin would share their tokens through a back channel - which makes the whole security discussion irrelevant - independent of whether or not the apps are served on the same origin. So if you assume a back channel, the whole security discussion ends right here as any authentication library could be used in that case and the malicious apps would collude anyway.
Therefore, we consider the case where there is a malicious app that tries to get access to the tokens of honest apps.
In the trust model of Solid-OIDC and ACP, apps that have distinct
client_ids can be authorized for the same or different resource access / actions. No app should be able to elevate their privilege by design.If you as the person deploying the apps already deem the two apps trustworthy and know that they "play nice" then you do not need to assign distinct
client_ids and the two apps comprise a compositional app, living a in joint security context.The app does not assume anything. It is the person deploying the app who assigns the
client_id.The
client_idprimarily serves as a security control (for identification, authentication, and authorization) in (Solid-) OIDC.Its purpose goes beyond just identifying a thing (compared to "just" a URI), or in this case, a set of functionalities provided by an app.
Therefore, the question if two apps should operate under the same
client_idis primarily a security question and only second a question of concepts. You can still assign different identifiers to the two apps under the same origin (e.g. via their path) but theclient_idto use relates to the security context that these two apps operate in. And as stated above, if the two apps should have differentclient_ids to distinguish them in authorization procedures then they MUST operate in distinct security contexts (as e.g. provided by the browser).I understand where you are coming from - however - dynamic registration is not an issue here. Dynamic registration cannot be used effectively in restricting access to Pod-stored resources anyway (as the
client_idis dynamic). Also, redirect URIs do not need to be known ahead of time, you can simply providewindow.location.hrefwhen calling the login function. You can have multiple apps on the same origin, you will just be logged in automatically (via RefreshTokenFlow) when switching from one app to another (see #4). Therefore, when using dynamic registration all apps just use the same session information - you will not run into a limitation here (afaik). But maybe I just do not quite understand your exact problem?Do you really want distinct logins and distinct sessions? This is not a question of concept but a question of security. You MUST deploy the apps on different origins.
To re-iterate my point: We cannot manage distinct sessions within
sessionStoragesecurely. Not because we do not want to but because the browser does not provide us a more granular and secure option.Thank you for raising the question - I'll look into this. If storing the fresh refresh token is not implemented yet, it should be an easy fix. (EDIT: It was, see #5)
AFAIK, token rotation is to be enforced by the server - not the client. If a refresh token is obtained by an attacker (malicious client) but the server does not rotate the refresh tokens, the attacker is always able to use the refresh token successfully after the fact.
jg10-mastodon-social commentedon Apr 30, 2025
The server checks that the redirect URIs match those provided in the client id document, so the only way to not specify a redirect URI ahead of time is to use dynamic registration - assuming it's data that does not require access to be restricted to a specific app.
I note that your multi-page example gets around this issue by different pages reusing the same refresh token, which makes sense to me and is a nice innovation!
I think further exploration of this use case needs a concrete example, so I'll have to get back to you. Thanks for mentioning me in the other issue.