-
Notifications
You must be signed in to change notification settings - Fork 8
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
Access service of other user #9
Comments
That's a good find. There is a missing part in the Nginx proxy which wasn't implemented yet :( Actually accessing internal services should be only allowed via a dedicated service access token (Cookie: Here are the original notes on that aspect: In other words: If the Doing it this way has a lot of security benefits by still reducing the number of required checks and DB calls in the backend (token is automatically set as a cookie and we apply heavy caching). The two missing parts are: Implementing the workflow of getting the Service Access Token in Nginx and finishing the backend API method to do the required checks (e.g. service part of the project). |
This was the initial way we wanted to solve this, however, using a dedicated access token provides a lot of additional benefits, and we don't have to rely on a certain structure in the naming. |
Thanks for the explanation @lukasmasuch I saw that there is already a concept of session tokens implemented in the Nginx proxy. As I understand it, a session JWT token is set as a cookie ( Moreover, I found this issue when implementing a workspace extension. This extension is started as a service in the global extension project. When a user calls the extension endpoint which creates a new workspace, the provided token of the user is used to create the workspace service via the contaxy API. If I understand you corrently, this would no longer be possible with the implementation of the |
I think the behavior described by @lukasmasuch should already be implemented here. Though, currently nginx generates it's own session token (here) instead of using the mentioned API endpoint (https://github.com/ml-tooling/contaxy/blob/main/backend/src/contaxy/api/endpoints/deployment.py#L703). The |
Hi all,
Lately we have been doing some further testing of contaxy and I noticed a bug that allows a user to access any service regardless of permissions.
Steps to reproduce:
/projects/6i2jix6d17pg61vun97kydah2/services/ctxy-p-6i2jix6d17pg61vun97kydah2-s-echo/access/80
/projects/9xz28racfobhlrzqigcg18pg4/services/ctxy-p-6i2jix6d17pg61vun97kydah2-s-echo/access/80
This allows user B to access the service of user A.
I think the issue is in the nginx config (https://github.com/ml-tooling/contaxy/blob/main/docker/nginx/nginx.conf#L166). By modifying the url to point to the private project of User B, the token verification for the following permission is made "/projects/9xz28racfobhlrzqigcg18pg4/services/ctxy-p-6i2jix6d17pg61vun97kydah2-s-echo/access/80#read". This check succeeds as User B has access to the project and therefore access to all its services. However, it is not checked if the service being accessed is actually part of that project.
As a potential fix of the nginx config we could extract the project id from the service name (everything between -p- and -s-) and use that for the permission check or check that it is the same as the project id in the URL.
What do you think?
Thanks,
Jan
The text was updated successfully, but these errors were encountered: