Store PAT, Actions task and runner tokens as SHA-256 instead of PBKDF2,
which 160-bit random tokens don't need, and drop the token caches and
`SUCCESSFUL_TOKENS_CACHE_SIZE` that PBKDF2 required. Legacy rows are
rehashed on first use. Older releases can't verify new or rehashed
tokens. A PAT use now writes only its last-used timestamp, at most once
a minute.
Benchmarks on M2 Max, SQLite, median of 5:
| Benchmark | 1 token | 128 tokens |
| :--- | ---: | ---: |
| PAT lookup | 29.4 → 30.7 µs | 2.24 ms → 29.7 µs |
| PAT lookup with last-used | 107 → 29.6 µs | 2.44 ms → 30.1 µs |
| Task lookup | 63.2 → 48.4 µs | 2.25 ms → 49.4 µs |
| Runner verify, no DB | 122 → 160 ns | 141 → 162 ns |
Docs: https://gitea.com/gitea/docs/pulls/607
Assisted-by: Codet
Assisted-by: Claude Code:claude-opus-5-5
---------
Co-authored-by: silverwind <me@silverwind.io>