Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 Bug: V2 API returns wrong status code and message combination on 401 and 403 #7272

Closed
1 task done
woodmin opened this issue Dec 21, 2023 · 0 comments 路 Fixed by #7285
Closed
1 task done

馃悰 Bug: V2 API returns wrong status code and message combination on 401 and 403 #7272

woodmin opened this issue Dec 21, 2023 · 0 comments 路 Fixed by #7285
Assignees
Labels
Status: Reproducible Able to reproduce the issue based on the reporters' guideline.

Comments

@woodmin
Copy link

woodmin commented Dec 21, 2023

Please confirm if bug report does NOT exists already ?

  • I confirm there is no existing issue for this

Steps to reproduce ?

I am working on API response status message handling.
When working with personal API tokens, NocoDB returns "403" status code with message "Unauthorized" in both of those cases:

  1. When incorrect and non-existent API token is provided,
  2. When user has not been granted access rights to the resource (db, table or view).
    In both of those cases response status and message combination is contradicting.
    403 is actually "Forbidden" (not "Unauthorized") and is generally used to indicate that the server recognizes the client's credentials, but those credentials don't grant permission to access the requested resource.
    "Unauthorized" is actually a message for status code "401" (not "403") and is typically used when authentication has failed or hasn't been provided.

Desired Behavior

  1. Return "401" with message "Unauthorized" when API is accessed with unknown/non-existent personal API key (currently "403" with message "Unauthorized"),
  2. Return "403" with message "Forbidden" when API is accessed with known personal API key of a user, that does not have access rights to the resource (currently also "403" with message "Unauthorized").

Project Details

Docker: true
PackageVersion: 0.202.10
Node: v18.18.2
Arch: x64
Platform: linux
RootDB: pg
Database version : 15.5

Attachments

No response

@dstala dstala added the Status: Reproducible Able to reproduce the issue based on the reporters' guideline. label Dec 23, 2023
@wingkwong wingkwong self-assigned this Dec 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Reproducible Able to reproduce the issue based on the reporters' guideline.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants