gotson / komga

Media server for comics/mangas/BDs/magazines/eBooks with API and OPDS support
https://komga.org
MIT License
3.76k stars 219 forks source link

Bug Report: Admin User Receives 403 Error When Accessing Library #1470

Closed Kuan-Lun closed 4 months ago

Kuan-Lun commented 4 months ago

Steps to reproduce

  1. Utilize two libraries, named A and B.
  2. Create a user account named alice who is not an administrator.
  3. Modify the access restrictions for library A but not for library B.
  4. Append authorization using the URL [komg-url]swagger-ui/index.html.
  5. Change the user role of alice to an administrator.
  6. Attempt to use the REST API to retrieve information from library B.
  7. Observe a 403 Error, indicating forbidden access to library B despite alice now being an administrator. This error is unexpected as admin rights should grant full access.
  8. Change the user role of alice back to a non-administrator.
  9. Modify the access restrictions for both libraries A and B.
  10. Change the user role of alice to an administrator.
  11. Successfully access library B after the access restrictions modification.

Expected behavior

See step 7.

Actual behavior

See step 6.

Logs

No response

Komga version

v1.10.4-master

Operating system

Linux

Installation method

Docker

Other details

No response

Acknowledgements

gotson commented 4 months ago

I don't understand what you are doing tbh

Kuan-Lun commented 4 months ago

Granting any account administrator permissions should allow the account to access all libraries. However, in practice, the libraries accessible are limited to those set for access before the administrator permissions were granted. I think this might be a bug.

gotson commented 4 months ago

can you provide which endpoints you tried that returned that error ?

Kuan-Lun commented 4 months ago
import requests  # type: ignore
from requests.auth import HTTPBasicAuth  # type: ignore

url = f"[komga-url]/api/v1/books/0FR5EDTZ1XAKA/metadata"
response = requests.patch(
    url, auth=HTTPBasicAuth("test@example.com", "test123"), json={"title": "new title"}
)
response.raise_for_status()

requests.exceptions.HTTPError: 403 Client Error: for url: [komga-url]/api/v1/books/0FR5EDTZ1XAKA/metadata

github-actions[bot] commented 4 months ago

🎉 This issue has been resolved in 1.11.0 (Release Notes)