Deleted users lead to 500 responses on various time-related API endpoints #9920

Closed
opened 2025-11-02 08:53:09 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @danieldietsch on GitHub (Dec 2, 2022).

Description

When a user deletes their account, they become a Ghost account.
Such a user may already have logged time on issues.
image

In such a case, the following web API endpoints return 500.

  • GET /repos/{owner}/{repo}/issues/{index}/times
  • GET /repos/{owner}/{repo}/times
    Other endpoints may also be affected, but our scripts did only ran into trouble here.

In particular not affected is GET /repos/{owner}/{repo}/times/{user} as long as user is not the id of a deleted user.

Gitea Version

1.17.2

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

We are running Gitea with docker from image: gitea/gitea:1.17.2. Gitea DB is mariadb:10.9.2. The web API is behind a traefik reverse proxy.

Database

MySQL

Originally created by @danieldietsch on GitHub (Dec 2, 2022). ### Description When a user deletes their account, they become a `Ghost` account. Such a user may already have logged time on issues. ![image](https://user-images.githubusercontent.com/3883391/205251318-af2c7013-5750-405e-8d92-4d7411a96e9c.png) In such a case, the following web API endpoints return 500. * GET `/repos/{owner}/{repo}/issues/{index}/times` * GET `/repos/{owner}/{repo}/times` Other endpoints may also be affected, but our scripts did only ran into trouble here. In particular not affected is `GET /repos/{owner}/{repo}/times/{user}` as long as user is not the id of a deleted user. ### Gitea Version 1.17.2 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? We are running Gitea with docker from ` image: gitea/gitea:1.17.2`. Gitea DB is `mariadb:10.9.2`. The web API is behind a traefik reverse proxy. ### Database MySQL
GiteaMirror added the type/bug label 2025-11-02 08:53:09 -06:00
Author
Owner

@lunny commented on GitHub (Dec 2, 2022):

Have you tried to upgrade to 1.17.3 ?

@lunny commented on GitHub (Dec 2, 2022): Have you tried to upgrade to 1.17.3 ?
Author
Owner

@danieldietsch commented on GitHub (Dec 2, 2022):

Yes, did it just now. Issue is still present.

@danieldietsch commented on GitHub (Dec 2, 2022): Yes, did it just now. Issue is still present.
Author
Owner

@zeripath commented on GitHub (Dec 3, 2022):

It would be very helpful to see the logs for these.

@zeripath commented on GitHub (Dec 3, 2022): It would be very helpful to see the logs for these.
Author
Owner

@danieldietsch commented on GitHub (Dec 3, 2022):

I am sorry, we did not retain logs.
A easy workaround is removing the user in question manually from the DB (just delete all entries of the user from tracked_time).

But repro should be easy:

  • Create new user
  • Log time to some issue
  • Delete user
  • Query API for issue or repo in question with admin user
@danieldietsch commented on GitHub (Dec 3, 2022): I am sorry, we did not retain logs. A easy workaround is removing the user in question manually from the DB (just delete all entries of the user from `tracked_time`). But repro should be easy: - Create new user - Log time to some issue - Delete user - Query API for issue or repo in question with admin user
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#9920