forgejo-pdf/release-notes
forgejo-backport-action 61e345cd36 [v10.0/forgejo] fix: teach the doctor about orphaned two_factor rows (#6651)
**Backport:** https://codeberg.org/forgejo/forgejo/pulls/6639

If a row in the two_factor table references a non existent user, it may contain a secret that has an invalid format. Such an orphaned row is never used and should be removed.

Improve the error message to suggest using the doctor to remove it.

Fixes: https://codeberg.org/forgejo/forgejo/issues/6637

## Testing

- make TAGS='sqlite sqlite_unlock_notify' watch
- make TAGS='sqlite  sqlite_unlock_notify' forgejo
- sqlite3 data/gitea.db 'INSERT INTO two_factor VALUES( 0, 500, "", "", "", "", 0, 0)'
- ./forgejo doctor check --run check-db-consistency
  ```
   [1] Check consistency of database
    - [W] Found 1 Orphaned TwoFactor without existing User
   OK

   All done (checks: 1).
   ```
-  ./forgejo doctor check --run check-db-consistency --fix
   ```
   [1] Check consistency of database
    - [I] Deleted 1 Orphaned TwoFactor without existing User
   OK

   All done (checks: 1).
   ```

## Checklist

The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. 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

- I added test coverage for Go changes...
  - [ ] in their respective `*_test.go` for unit tests.
  - [x] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
- I added test coverage for JavaScript changes...
  - [ ] in `web_src/js/*.test.js` if it can be unit tested.
  - [ ] in `tests/e2e/*.test.e2e.js` if it requires interactions with a live Forgejo server (see also the [developer guide for JavaScript testing](https://codeberg.org/forgejo/forgejo/src/branch/forgejo/tests/e2e/README.md#end-to-end-tests)).

### Documentation

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

### Release notes

- [ ] I do not want this change to show in the release notes.
- [x] I want the title to show in the release notes with a link to this pull request.
- [ ] I want the content of the `release-notes/<pull request number>.md` to be be used for the release notes instead of the title.

<!--start release-notes-assistant-->

## Release notes
<!--URL:https://codeberg.org/forgejo/forgejo-->
- Bug fixes
  - [PR](https://codeberg.org/forgejo/forgejo/pulls/6651): <!--number 6651 --><!--line 0 --><!--description Zml4OiB0ZWFjaCB0aGUgZG9jdG9yIGFib3V0IG9ycGhhbmVkIHR3b19mYWN0b3Igcm93cw==-->fix: teach the doctor about orphaned two_factor rows<!--description-->
<!--end release-notes-assistant-->

Co-authored-by: Earl Warren <contact@earl-warren.org>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6651
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
2025-01-22 07:47:34 +00:00
..
3139.md
3285.md
3307.md
3334.md
3337.md
3363.md
3383.md
3414.md
3430.md
3434.md
3442.md
3642.md
3654.md
3723.md
3724.md
3729.md
3752.md
3791.md
3808.md
3811.md
3830.md
3836.md
3838.md
3847.md
3870.md
3886.md
3917.md
3922.md
3934.md
3985.md
3989.md
4026.md
4027.md
4072.md
4083.md
4095.md
4125.md
4134.md
4136.md
4139.md
4143.md
4145.md
4160.md
4189.md
4201.md
4212.md
4218.md
4222.md
4240.md
4253.md
4262.md
4266.md
4291.md
4367.md
4375.md
4400.md
4427.md
4429.md
4439.md
4487.md
4506.md
4547.md
4595.md
4605.md
4607.md
4635.md
4684.md
4716.md
4724.md
4801.md
4819.md
4907.md
4924.md
4941.md
4998.md
5065.md
5090.md
5109.md
5120.md
5149.md
5195.md
5205.md
5325.md
5372.md
5416.md
5459.md
5477.md
5515.md
5543.md
5601.md
5621.md
5677.md
5714.md
5718.md
5719.md
5751.md
5778.md
5789.md
5974.md
5988.md
5997.md
6062.md
6110.md
6200.md
6271.md
6639.md