Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auth: Mask errors returned by OpenFGADatastore (#14446)
While working on #14085 I set up a new fine-grained TLS identity and issued the following commands as that identity, without any permissions yet (I forgot I'd changed my default remote): ``` $ lxc auth group create tmp Error: Forbidden $ lxc auth group permission add tmp server admin Error: Failed to check OpenFGA relation: No such entity "/1.0/auth/groups/tmp" ``` Creating the group failed, this is correct behaviour. When attempting to add a permission to the non-existent group, the request failed (correct) but the OpenFGA Authorization driver returned the above error. This is incorrect. This PR checks if the error returned by a `Check` request on the embedded OpenFGA server is a `Not Found` error and returns a generic not found error. This makes errors returned by the authorizer consistent. We are masking all not found errors returned before access control decisions are made to prevent discovery. After this change, the same command returns: ``` $ lxc auth group permission add tmp server admin Error: Not Found ```
- Loading branch information