jojo/models/gitea_migrations/fixtures
Mathieu Fenniak 9b88e77c19 feat: expose immutable identifiers in Forgejo Actions JWTs (#12355)
Protect OIDC tokens generated by Forgejo Actions from threats arising when users or repositories are renamed or deleted, freeing their names up for reuse by another user.  In this threat environment, relying on the name of users and repositories in validating JWT claims is unsafe because they can change.

Adds three new claims to Actions' OIDC tokens:
- `actor_id` -- the immutable identifier of the actor who triggered an Action run
- `repository_id` -- the immutable identifier of the repository on which the Action is running
- `repository_owner_id` -- the immutable identifier of the owner of the repository on which the Action is running

Repositories will change their subject (`sub`) OIDC claims to include these immutable identifiers.  Existing repositories will not change, in order to maintain compatibility with existing JWT usage.  The new format will be applied to new repositories, or can be applied by disabling and enabling the Actions unit.  The new format embeds the identifiers:
- **Existing repos:** `repo:my-org/my-repo:ref:refs/heads/main`
- **New repos:** `repo:my-org-123456/my-repo-456789:ref:refs/heads/main`

Fixes #12244.

## Checklist

The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. All work and communication must conform to Forgejo's [AI Agreement](https://codeberg.org/forgejo/governance/src/branch/main/AIAgreement.md). There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org).

### Tests for Go changes

- I added test coverage for Go changes...
  - [x] in their respective `*_test.go` for unit tests.
  - [ ] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
- I ran...
  - [x] `make pr-go` before pushing

### Documentation

- [x] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
    - New fields will be added to documentation soon.
- [ ] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [x] This change will be noticed by a Forgejo user or admin (feature, bug fix, performance, etc.). I suggest to include a release note for this change.
- [ ] This change is not visible to a Forgejo user or admin (refactor, dependency upgrade, etc.). I think there is no need to add a release note for this change.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/12355
Reviewed-by: Andreas Ahlenstorf <aahlenst@noreply.codeberg.org>
2026-05-03 15:46:58 +02:00
..
Test_AddCombinedIndexToIssueUser chore: rename 'migrations' to 'gitea_migrations' 2025-10-14 14:40:49 -06:00
Test_AddConfidentialClientColumnToOAuth2ApplicationTable chore: rename 'migrations' to 'gitea_migrations' 2025-10-14 14:40:49 -06:00
Test_AddForeignKeysAccess migration: update existing foreign key migrations to automatically fix inconsistencies (#10568) 2025-12-29 02:50:20 +01:00
Test_addForeignKeysActionRunnerToken feat: add foreign keys to the action_runner_token table (#10756) 2026-01-12 21:59:40 +01:00
Test_addForeignKeysCollaboration migration: update existing foreign key migrations to automatically fix inconsistencies (#10568) 2025-12-29 02:50:20 +01:00
Test_addForeignKeysForgejoAuthToken migration: update existing foreign key migrations to automatically fix inconsistencies (#10568) 2025-12-29 02:50:20 +01:00
Test_addForeignKeysPullRequest1 migration: update existing foreign key migrations to automatically fix inconsistencies (#10568) 2025-12-29 02:50:20 +01:00
Test_AddForeignKeysStopwatchTrackedTime migration: update existing foreign key migrations to automatically fix inconsistencies (#10568) 2025-12-29 02:50:20 +01:00
Test_AddHeaderAuthorizationEncryptedColWebhook chore: rename 'migrations' to 'gitea_migrations' 2025-10-14 14:40:49 -06:00
Test_AddIssueResourceIndexTable chore: rename 'migrations' to 'gitea_migrations' 2025-10-14 14:40:49 -06:00
Test_AddPayloadVersionToHookTaskTable chore: rename 'migrations' to 'gitea_migrations' 2025-10-14 14:40:49 -06:00
Test_AddRepoIDForAttachment chore: rename 'migrations' to 'gitea_migrations' 2025-10-14 14:40:49 -06:00
Test_AddUniqueIndexForProjectIssue chore: rename 'migrations' to 'gitea_migrations' 2025-10-14 14:40:49 -06:00
Test_ChangeMavenArtifactConcatenation refactor: migrate from lib/pq to jackc/pgx (#10219) 2025-11-30 17:47:45 +01:00
Test_CheckProjectColumnsConsistency fix(models): deduplicate project sorting values and add unique constraints (#11334) 2026-02-27 16:25:20 +01:00
Test_DeleteOrphanedIssueLabels chore: rename 'migrations' to 'gitea_migrations' 2025-10-14 14:40:49 -06:00
Test_MigrateActionSecretToKeying chore: rename 'migrations' to 'gitea_migrations' 2025-10-14 14:40:49 -06:00
Test_MigrateNormalizedFederatedURI chore: rename 'migrations' to 'gitea_migrations' 2025-10-14 14:40:49 -06:00
Test_MigrateTaskSecretsToKeying feat: use keying for task secrets (#9923) 2025-11-03 13:42:32 +01:00
Test_MigrateTwoFactorToKeying chore: rename 'migrations' to 'gitea_migrations' 2025-10-14 14:40:49 -06:00
Test_MigrateWebhookSecrets feat: use keying for webhook secrets (#10059) 2025-12-22 15:51:37 +01:00
Test_RemigrateU2FCredentials chore: rename 'migrations' to 'gitea_migrations' 2025-10-14 14:40:49 -06:00
Test_RemoveInvalidLabels chore: rename 'migrations' to 'gitea_migrations' 2025-10-14 14:40:49 -06:00
Test_removeSoftDeleteActionRunnerToken feat: add foreign keys to the action_runner_token table (#10756) 2026-01-12 21:59:40 +01:00
Test_RemoveSSHSignaturesFromReleaseNotes chore: rename 'migrations' to 'gitea_migrations' 2025-10-14 14:40:49 -06:00
Test_RepositoryFormat chore: rename 'migrations' to 'gitea_migrations' 2025-10-14 14:40:49 -06:00
Test_setOIDCSubjectFormatLegacy15 feat: expose immutable identifiers in Forgejo Actions JWTs (#12355) 2026-05-03 15:46:58 +02:00
Test_SetTopicsAsEmptySlice chore: rename 'migrations' to 'gitea_migrations' 2025-10-14 14:40:49 -06:00
Test_StoreWebauthnCredentialIDAsBytes chore: rename 'migrations' to 'gitea_migrations' 2025-10-14 14:40:49 -06:00
Test_UnwrapLDAPSourceCfg chore: rename 'migrations' to 'gitea_migrations' 2025-10-14 14:40:49 -06:00
Test_UpdateBadgeColName chore: rename 'migrations' to 'gitea_migrations' 2025-10-14 14:40:49 -06:00
Test_UpdateOpenMilestoneCounts chore: rename 'migrations' to 'gitea_migrations' 2025-10-14 14:40:49 -06:00
Test_v14ActionsApprovalAndTrustPopulateTableActionUser refactor: migrate from lib/pq to jackc/pgx (#10219) 2025-11-30 17:47:45 +01:00