jojo/models/gitea_migrations/fixtures/Test_MigrateTaskSecretsToKeying/task.yml
Gusted 0c11e9a43a feat: use keying for task secrets (#9923)
- Follow up of forgejo/forgejo!5041, forgejo/forgejo!6074, forgejo/forgejo!8692
- The `task` table contains three secrets: clone address (with credentials), auth password and auth token. These secrets are stored for migrating repositories (also the only usage of this table, although it allows for more usages).
- Use `keying` to safely store these secrets and bound them to the table, column, row id and JSON field name.
- The migration isn't spectacular but does closely follow what we learned in the previous two migrations: use a transaction and delete records when you can't decrypt them. We also learned about `db.Iterate` not being happy when updating records but it has since been fixed.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/9923
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
2025-11-03 13:42:32 +01:00

38 lines
987 B
YAML

-
id: 1
doer_id: 5
owner_id: 5
repo_id: 5
type: 0
status: 4
start_time: 1761951636
end_time: 1761951636
payload_content: '{"auth_token_encrypted": "2142ac70cf41885b4a3a74f2d36a64662bdbc70f70c7f5b2", "clone_addr_encrypted": "79b9eb793d5af95af61d483566474454b880c4aa80bf3028f561ca227fccfc518b18fb9823c2fa79fa9cf0efae1eb13080e0c51f26c40622ee9d649bff0ef64b", "auth_password_encrypted": "986717ee9de0b9b1fda8afe5f64d53245d8ec4131221085f59ac7e13"}'
message: 'working'
created: 176195163
-
id: 2
doer_id: 5
owner_id: 5
repo_id: 5
type: 0
status: 4
start_time: 1761951636
end_time: 1761951636
payload_content: '{"auth_token_encrypted": "badbad", "clone_addr_encrypted": "badbad", "auth_password_encrypted": "badbad"}'
message: 'working'
created: 176195163
-
id: 3
doer_id: 5
owner_id: 5
repo_id: 5
type: 0
status: 4
start_time: 1761951636
end_time: 1761951636
payload_content: '{ badjson'
message: 'working'
created: 176195163