unkeyed / unkey

Open source API management platform
https://go.unkey.com
Other
2.9k stars 286 forks source link

Better 403 error handling for `INSUFFICIENT_PERMISSIONS` #1677

Closed chronark closed 2 months ago

chronark commented 4 months ago

Preliminary Checks

Is your feature request related to a problem? Please describe.

When a key is missing permissions, we only return the error

{
  "code": "INSUFFICIENT_PERMISSIONS",
  "message": "unauthorized"
}

This makes it really hard to understand which permissions are missing and act accordingly.

Describe the solution

Return a list of unsufficient permissions to the client. I'm not sure yet if this needs to be machine readable or if this would be enough:

{
  "code": "INSUFFICIENT_PERMISSIONS",
  "message": "missing permissions: [ \"perm1\", \"perm2\" ]"
}

Describe alternatives you have considered (if any)

making it machine-readable would also benefit us directly as we can build better assertions in our tests

Additional context

No response

linear[bot] commented 4 months ago

ENG-1088 Better 403 error handling for `INSUFFICIENT_PERMISSIONS`

DeepaPrasanna commented 4 months ago

May I work on this issue?

perkinsjr commented 4 months ago

May I work on this issue?

Hey there I am using this for an experiment so currently this is assigned to me

DeepaPrasanna commented 4 months ago

May I work on this issue?

Hey there I am using this for an experiment so currently this is assigned to me

Got it. Thank u so much :)