Balki
c138e76c1c
Fix panic when an invalid oauth2 name is passed ( #20820 )
2022-08-17 14:25:28 -04:00
Wim
cb50375e2b
Add more linters to improve code readability ( #19989 )
...
Add nakedret, unconvert, wastedassign, stylecheck and nolintlint linters to improve code readability
- nakedret - https://github.com/alexkohler/nakedret - nakedret is a Go static analysis tool to find naked returns in functions greater than a specified function length.
- unconvert - https://github.com/mdempsky/unconvert - Remove unnecessary type conversions
- wastedassign - https://github.com/sanposhiho/wastedassign - wastedassign finds wasted assignment statements.
- notlintlint - Reports ill-formed or insufficient nolint directives
- stylecheck - https://staticcheck.io/docs/checks/#ST - keep style consistent
- excluded: [ST1003 - Poorly chosen identifier](https://staticcheck.io/docs/checks/#ST1003 ) and [ST1005 - Incorrectly formatted error string](https://staticcheck.io/docs/checks/#ST1005 )
2022-06-20 12:02:49 +02:00
Lunny Xiao
fd7d83ace6
Move almost all functions' parameter db.Engine to context.Context ( #19748 )
...
* Move almost all functions' parameter db.Engine to context.Context
* remove some unnecessary wrap functions
2022-05-20 22:08:52 +08:00
6543
f41c2bec4c
Delete user related oauth stuff on user deletion too ( #19677 )
...
* delete user related oauth stuff on user deletion too
* extend doctor check-db-consistency
2022-05-11 13:16:35 +02:00
Lunny Xiao
772ad761eb
Fix some slice problems (incorrect slice length) ( #19592 )
2022-05-03 17:04:23 +08:00
Gusted
aa23f477b7
Use `CryptoRandomBytes` instead of `CryptoRandomString` ( #18439 )
...
- Switch to use `CryptoRandomBytes` instead of `CryptoRandomString`, OAuth's secrets are copied pasted and don't need to avoid dubious characters etc.
- `CryptoRandomBytes` gives ![2^256 = 1.15 * 10^77](https://render.githubusercontent.com/render/math?math=2 ^256%20=%201.15%20\cdot%2010^77) `CryptoRandomString` gives ![62^44 = 7.33 * 10^78](https://render.githubusercontent.com/render/math?math=62 ^44%20=%207.33%20\cdot%2010^78) possible states.
- Add a prefix, such that code scanners can easily grep these in source code.
- 32 Bytes + prefix
2022-02-04 18:03:15 +01:00
Lunny Xiao
de8e3948a5
Refactor auth package ( #17962 )
2022-01-02 21:12:35 +08:00