fix: return OpaqueAccessDenied for NotFound remote cluster errors#40571
fix: return OpaqueAccessDenied for NotFound remote cluster errors#40571
OpaqueAccessDenied for NotFound remote cluster errors#40571Conversation
This commit modifies OpaqueAccessDenied to return an identical generic NotFound error whether the input error is NotFound or AccessDenied. The commit also updates all call sites of OpaqueAccessDenied to use it in the paths where there is any error fetching the resource as well as when access is denied. It doesn't do much good to return AccessDenied errors as NotFound, if they don't match the NotFound error you would get if the resource really didn't exist. It's trivial to tell the errors apart and discover the existence of a resource you shouldn't be allowed to access. The commit attempts to mitigate that issue and properly hide the existence of resources the user should not be allowed to list.
espadolini
left a comment
There was a problem hiding this comment.
I think we have plenty of code around that does "if update() is notfound then create()" or "if create() is alreadyexists then update()" - are we ok with potentially breaking that logic? If a Foo doesn't exist and a user that doesn't have blanket read or list permissions for Foos attempts to interact with that Foo, shouldn't the error be AccessDenied rather than NotFound?
|
I'll try to address each of your comments here @espadolini
The only case that will change is where
No changes here, I'm not touching any Create endpoints, there's no need to.
Yes, I'm not changing this, if they don't have |
I'm arguing that that's just a bad lie, whereas returning |
First I'll push back a bit: I have never heard of returning Second: I don't really want to waste our time debating this. A customer filed a support ticket because they were able to discover trusted clusters that they weren't supposed to know about, I thought I could push a quick fix, the relevant change is in |
|
I would suggest scoping this down to just the problem that we are trying to solve for now. It reduces the risk of tsh or tctl doing the wrong thing because the error returned from an API is now different. |
73f4c23 to
f46c5d4
Compare
OpaqueAccessDenied for NotFound errorsOpaqueAccessDenied for NotFound remote cluster errors
I'm convinced, |
|
I went ahead and removed all changes not related to remote clusters to reduce the risk on this PR |
There was a problem hiding this comment.
Up to you if you want to scope it down and remove the new uses of OpaqueAccessDenied like @rosstimothy suggested or not.
edit: it's only extending the existing uses to make them effective now
Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
|
@nklaassen See the table below for backport results.
|
…errors Backport #40571 to branch/v15 This commit modifies OpaqueAccessDenied to return an identical generic NotFound error whether the input error is NotFound or AccessDenied. The commit also updates all call sites of OpaqueAccessDenied to use it in the paths where there is any error fetching the resource as well as when access is denied. It doesn't do much good to return AccessDenied errors as NotFound, if they don't match the NotFound error you would get if the resource really didn't exist. It's trivial to tell the errors apart and discover the existence of a resource you shouldn't be allowed to access. The commit attempts to mitigate that issue and properly hide the existence of resources the user should not be allowed to list. Changelog: generic "not found" errors are returned whether a remote cluster can't be found or access is denied. --------- Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
…errors Backport #40571 to branch/v14 This commit modifies OpaqueAccessDenied to return an identical generic NotFound error whether the input error is NotFound or AccessDenied. The commit also updates all call sites of OpaqueAccessDenied to use it in the paths where there is any error fetching the resource as well as when access is denied. It doesn't do much good to return AccessDenied errors as NotFound, if they don't match the NotFound error you would get if the resource really didn't exist. It's trivial to tell the errors apart and discover the existence of a resource you shouldn't be allowed to access. The commit attempts to mitigate that issue and properly hide the existence of resources the user should not be allowed to list. Changelog: generic "not found" errors are returned whether a remote cluster can't be found or access is denied. Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
…errors Backport #40571 to branch/v13 This commit modifies OpaqueAccessDenied to return an identical generic NotFound error whether the input error is NotFound or AccessDenied. The commit also updates all call sites of OpaqueAccessDenied to use it in the paths where there is any error fetching the resource as well as when access is denied. It doesn't do much good to return AccessDenied errors as NotFound, if they don't match the NotFound error you would get if the resource really didn't exist. It's trivial to tell the errors apart and discover the existence of a resource you shouldn't be allowed to access. The commit attempts to mitigate that issue and properly hide the existence of resources the user should not be allowed to list. Changelog: generic "not found" errors are returned whether a remote cluster can't be found or access is denied. Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
…errors (#40683) Backport #40571 to branch/v13 This commit modifies OpaqueAccessDenied to return an identical generic NotFound error whether the input error is NotFound or AccessDenied. The commit also updates all call sites of OpaqueAccessDenied to use it in the paths where there is any error fetching the resource as well as when access is denied. It doesn't do much good to return AccessDenied errors as NotFound, if they don't match the NotFound error you would get if the resource really didn't exist. It's trivial to tell the errors apart and discover the existence of a resource you shouldn't be allowed to access. The commit attempts to mitigate that issue and properly hide the existence of resources the user should not be allowed to list. Changelog: generic "not found" errors are returned whether a remote cluster can't be found or access is denied. Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
…errors (#40682) Backport #40571 to branch/v14 This commit modifies OpaqueAccessDenied to return an identical generic NotFound error whether the input error is NotFound or AccessDenied. The commit also updates all call sites of OpaqueAccessDenied to use it in the paths where there is any error fetching the resource as well as when access is denied. It doesn't do much good to return AccessDenied errors as NotFound, if they don't match the NotFound error you would get if the resource really didn't exist. It's trivial to tell the errors apart and discover the existence of a resource you shouldn't be allowed to access. The commit attempts to mitigate that issue and properly hide the existence of resources the user should not be allowed to list. Changelog: generic "not found" errors are returned whether a remote cluster can't be found or access is denied. Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
…errors (#40681) Backport #40571 to branch/v15 This commit modifies OpaqueAccessDenied to return an identical generic NotFound error whether the input error is NotFound or AccessDenied. The commit also updates all call sites of OpaqueAccessDenied to use it in the paths where there is any error fetching the resource as well as when access is denied. It doesn't do much good to return AccessDenied errors as NotFound, if they don't match the NotFound error you would get if the resource really didn't exist. It's trivial to tell the errors apart and discover the existence of a resource you shouldn't be allowed to access. The commit attempts to mitigate that issue and properly hide the existence of resources the user should not be allowed to list. Changelog: generic "not found" errors are returned whether a remote cluster can't be found or access is denied. --------- Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
This PR modifies
OpaqueAccessDeniedto return an identical genericNotFounderror whether the input error isNotFoundorAccessDenied. The commit also updates call sites ofOpaqueAccessDeniedrelated to remote clusters to use it in the paths where there is any error fetching the cluster as well as when access is denied.It doesn't do much good to return
AccessDeniederrors asNotFoundif they don't match theNotFounderror you would get if the resource really didn't exist. It's trivial to tell the errors apart and discover the existence of a resource you shouldn't be allowed to access. This PR attempts to mitigate that issue and properly hide the existence of remote clusters the user should not be allowed to list.Changelog: generic "not found" errors are returned whether a remote cluster can't be found or access is denied.