-
Notifications
You must be signed in to change notification settings - Fork 890
Unhelpful 403 message when starting/deleting a workspace that doesn't exist #1899
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
Comments
Is the request here to just change the order of the two clauses? |
No. I just made a mistake in the |
There are some cases where we return a 403 with no extra message. We need to make a decision from a security standpoint. If you return a 404, then a user can fish for workspaces that exist. If you return a 403 with no context, you prevent information gain. It's a usability vs security thing. I'm happy either way, but we've had penn tests in the past mark this information gain as a security vulnerability |
I think the security perspective is that we need to avoid communicating that a workspace exists to someone who is not authorized to have access to it. The message "this workspace does not exist, or you do not have access to it" seems to satisfy that. It doesn't provide additional context, but it does make the message more comprehensible to humans. 403 v. 404 I don't think matters as long as it's the same whether the workspace exists or not. |
I'm going to argue strongly for 404 in this case. 403 is very surprising when querying your own workspaces. c.f. #2177 Also, pretty sure 404 is the more standard thing to do, e.g. from incognitio, coder/m returns
|
Why don't we just return 404 on This PR only returns a 403 when trying to fetch a user that does not exist. Places I return a 404: (#2194)
I think we can eval the security implications in the future, but UX wise, a 403 is kind of annoying. Especially considering how we handle I know we can do a case by case right now, like the workspace by name in your own "user" namespace will be 404, but by ID is 403. But if we do this now, then how we use the api in the CLI will be result in different behavior based on nuances that are not obvious to the user imo. |
404 for everything is a sane default that I support. |
403 should be returned if all of the following are true:
c.f. https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses So
I believe this should be a 404 as well. |
Will 404 all cases for now then. |
Fixed! (error is a bit verbose, but that can be improved with the cli error handling in general)
|
Uh oh!
There was an error while loading. Please reload this page.
OS Information
coder --version
:Steps to Reproduce
coder workspace delete this-workspace-does-not-exist
Expected
Actual
The text was updated successfully, but these errors were encountered: