summaryrefslogtreecommitdiffstats
path: root/services/user
diff options
context:
space:
mode:
authorGusted <postmaster@gusted.xyz>2024-08-11 05:13:01 +0200
committerEarl Warren <contact@earl-warren.org>2024-11-15 10:59:36 +0100
commit1ce33aa38d1d258d14523ff2c7c2dbf339f22b74 (patch)
tree93298b9246f031cf684b126fc76b901e781fbbb4 /services/user
parentMerge pull request 'ci: use oci mirror images' (#5963) from viceice/ci/oci-mi... (diff)
downloadforgejo-1ce33aa38d1d258d14523ff2c7c2dbf339f22b74.tar.xz
forgejo-1ce33aa38d1d258d14523ff2c7c2dbf339f22b74.zip
fix: extend `forgejo_auth_token` table
- Add a `purpose` column, this allows the `forgejo_auth_token` table to be used by other parts of Forgejo, while still enjoying the no-compromise architecture. - Remove the 'roll your own crypto' time limited code functions and migrate them to the `forgejo_auth_token` table. This migration ensures generated codes can only be used for their purpose and ensure they are invalidated after their usage by deleting it from the database, this also should help making auditing of the security code easier, as we're no longer trying to stuff a lot of data into a HMAC construction. -Helper functions are rewritten to ensure a safe-by-design approach to these tokens. - Add the `forgejo_auth_token` to dbconsistency doctor and add it to the `deleteUser` function. - TODO: Add cron job to delete expired authorization tokens. - Unit and integration tests added.
Diffstat (limited to 'services/user')
-rw-r--r--services/user/delete.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/services/user/delete.go b/services/user/delete.go
index 74dbc09b82..587e3c2a8f 100644
--- a/services/user/delete.go
+++ b/services/user/delete.go
@@ -96,6 +96,7 @@ func deleteUser(ctx context.Context, u *user_model.User, purge bool) (err error)
&user_model.BlockedUser{BlockID: u.ID},
&user_model.BlockedUser{UserID: u.ID},
&actions_model.ActionRunnerToken{OwnerID: u.ID},
+ &auth_model.AuthorizationToken{UID: u.ID},
); err != nil {
return fmt.Errorf("deleteBeans: %w", err)
}