You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An OAuth app created by a deleted user is left behind in the database, and tokens it handed out are still valid, and can even see private repos created after the deletion.
# sudo -u gitea psql -c 'select id,name from public.user where id=5;' | tee /dev/null
id | name
----+------
(0 rows)
Expected Behaviour
I would expect that deleting a user would delete all access rights that user had.
So, I would expect that deleting a user would delete all OAuth apps in their name and immediately revoke all tokens that were given out to it. The tokens not being revoked means a user can leave a ghost app around, at least
Right now you apparently can't get a new OAuth token issued (:+1:), but previously issued ones are still valid (:-1:), meaning someone who phished you into opening their malicious app can hide their tracks.
The HTTP 500 should instead be the standard HTTP 400 with "Client ID not registered":
and clicking "Sync" on Drone (or any similar app) should fail.
The text was updated successfully, but these errors were encountered:
Gitea Version
Gitea version 1.16.3 built with GNU Make 4.1, go1.17.7 : bindata, sqlite, sqlite_unlock_notify
Git Version
2.25.1
Operating System
Ubuntu 20.04
How are you running Gitea?
Installed with:
Run manually with:
On:
(and I have an nginx reverse proxy for TLS in front; if you want to see it's config too I can add it)
Database
PostgreSQL
Can you reproduce the bug on the Gitea demo site?
Yes
Log Gist
https://gist.github.com/kousu/7a0adf177e50bf8387a00b4fa3fd7dd3
Description
An OAuth app created by a deleted user is left behind in the database, and tokens it handed out are still valid, and can even see private repos created after the deletion.
Reproduction
Make two accounts
Account 1
Account 2
In account 1: create an OAuth app
In account 2: create a couple repositories
You can see this on the demo site at: https://try.gitea.io/bivott82
Deploy DroneCI (or some other OAuth consumer), providing it the OAuth app credentials.
Get a public IP, set up DNS and open firewall ports for :80 and :443, and install docker before running this:
In account 2: login to DroneCI; you will see the two repositories:
In account 1: delete account
In account 1: create a third repository
You can see this on the demo site at: https://try.gitea.io/bivott82
In DroneCI: refresh
You will: incorrectly see the third repository.
Log out of DroneCI
Try to login again:
You will: get a half-correct HTTP 500 error from Gitea.
You should be able to see this screen on the demo site at:
https://try.gitea.io/login/oauth/authorize?client_id=4d9b78ea-d8fc-45ed-a11a-ea684a690108&redirect_uri=https%3A%2F%2Fdrone1.kousu.ca%2Flogin&response_type=code&state=30b95ff183c471d4
If you can look in the database:
You will: see the
oauth2_application
is still recorded.even though the associated
uid
is gone:Expected Behaviour
I would expect that deleting a user would delete all access rights that user had.
So, I would expect that deleting a user would delete all OAuth apps in their name and immediately revoke all tokens that were given out to it. The tokens not being revoked means a user can leave a ghost app around, at least
Right now you apparently can't get a new OAuth token issued (:+1:), but previously issued ones are still valid (:-1:), meaning someone who phished you into opening their malicious app can hide their tracks.
The HTTP 500 should instead be the standard HTTP 400 with "Client ID not registered":
and clicking "Sync" on Drone (or any similar app) should fail.
The text was updated successfully, but these errors were encountered: