forgejo/routers/api/v1
Giteabot f144521aea
Deprecate query string auth tokens (#28390) (#28430)
Backport #28390 by @jackHay22

## Changes
- Add deprecation warning to `Token` and `AccessToken` authentication
methods in swagger.
- Add deprecation warning header to API response. Example: 
  ```
  HTTP/1.1 200 OK
  ...
  Warning: token and access_token API authentication is deprecated
  ...
  ```
- Add setting `DISABLE_QUERY_AUTH_TOKEN` to reject query string auth
tokens entirely. Default is `false`

## Next steps
- `DISABLE_QUERY_AUTH_TOKEN` should be true in a subsequent release and
the methods should be removed in swagger
- `DISABLE_QUERY_AUTH_TOKEN` should be removed and the implementation of
the auth methods in question should be removed

## Open questions
- Should there be further changes to the swagger documentation?
Deprecation is not yet supported for security definitions (coming in
[OpenAPI Spec version
3.2.0](https://github.com/OAI/OpenAPI-Specification/issues/2506))
- Should the API router logger sanitize urls that use `token` or
`access_token`? (This is obviously an insufficient solution on its own)

Co-authored-by: Jack Hay <jack@allspice.io>
Co-authored-by: delvh <dev.lh@web.de>
2023-12-12 13:45:00 +08:00
..
activitypub More refactoring of db.DefaultContext (#27083) 2023-09-15 06:13:19 +00:00
admin Another round of db.DefaultContext refactor (#27103) (#27262) 2023-09-25 19:24:35 +02:00
misc More db.DefaultContext refactor (#27265) (#27347) 2023-09-29 13:35:01 +00:00
notify More db.DefaultContext refactor (#27265) (#27347) 2023-09-29 13:35:01 +00:00
org Delete repos of org when purge delete user (#27273) (#27728) 2023-11-01 10:03:12 +08:00
packages Another round of db.DefaultContext refactor (#27103) (#27262) 2023-09-25 19:24:35 +02:00
repo Also sync DB branches on push if necessary (#28361) (#28403) 2023-12-11 06:16:56 +00:00
settings Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
swagger refactor(API): refactor secret creation and update functionality (#26751) 2023-08-28 13:08:19 +08:00
user enable system users search via the API (#28013) (#28018) 2023-12-08 21:46:08 +00:00
utils Fix comment permissions (#28213) (#28216) 2023-11-25 23:43:23 +00:00
api.go Deprecate query string auth tokens (#28390) (#28430) 2023-12-12 13:45:00 +08:00