-
Notifications
You must be signed in to change notification settings - Fork 79
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
fix: custom stylesheet and js are not loaded after OIDC authentication #544
fix: custom stylesheet and js are not loaded after OIDC authentication #544
Conversation
aaef770
to
e77d369
Compare
src/writer/auth.py
Outdated
@@ -191,14 +191,15 @@ def register(self, | |||
redirect_url = urljoin(self.host_url, self.callback_authorize) | |||
host_url_path = urlpath(self.host_url) | |||
callback_authorize_path = urljoin(host_url_path, self.callback_authorize) | |||
static_assets_path = urljoin(host_url_path, "static") | |||
|
|||
auth_ignored_prefix_paths = [urljoin(host_url_path, "static"), urljoin(host_url_path, "assets")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will use the same approach than the code used in server to scan the static asset into the repo
|
I already investigate protecting static assets with WF's stateless architecture without finding a good solution. In the end, it is a common technique not to protect them, particularly to allow their management by a CDN. The management of browser session cookies, which is supposed to be able to allow this, has been hijacked by browsers. They are persisted today. If the user refreshes the page, opens a new tab, closes and reopens the browser, the session cookie is retained.
Strangely, the mechanism works better for basic auth because the browser forgets the credentials when they are closed. It's also a header propagate to all the request (as cookie). Here is the two topics where I have been stuck. Do you see a way to go further without dropping the stateless current architecture ? inject custom header for every query to the server. There remains a major difficulty if we give javascript the right to access the session identifier. How to make the browser add a header to all requests, including static asset loading through an img tag. I'm stuck, it's supposed to be the role of cookies to do that. I don't know of a way to make a cookie used by a single tab. We return to the initial problem. I look to the contextual cookie technique. It does not make it possible to manage this type of case. It is used by Google for multi-account. It only works for APIs, not for static asset loading. |
To fix the current issue, I'm hesitating between 2 strategies. Either add a blacklist in the authentication configuration, or add a whitelist in the authentication. The safest is the whitelist. It's easy to document but hard to diagnose when problem happens.
|
|
4d26dcf
to
2d23b3c
Compare
* fix: allow access to assets and static endpoint * docs: improve details about authentication
2d23b3c
to
a6af9f7
Compare
fix #535
The problem was not fully solved, and worse, has broke the OIDC authentication mechanism. The access to /static url is blocked after user authentication. I fail to diagnose this issue because I was loading those assets through browser cache in local during my test.
The problem is visible on dev review environment. It is fixed on this PR review environment.