mirror of
https://github.com/zitadel/zitadel
synced 2024-11-21 16:30:53 +00:00
4e3fd305ab
# Which Problems Are Solved We noticed logging where 500: Internal Server errors were returned from the token endpoint, mostly for the `refresh_token` grant. The error was thrown by the database as it received non-UTF8 strings for token IDs Zitadel uses symmetric encryption for opaque tokens, including refresh tokens. Encrypted values are base64 encoded. It appeared to be possible to send garbage base64 to the token endpoint, which will pass decryption and string-splitting. In those cases the resulting ID is not a valid UTF-8 string. Invalid non-UTF8 strings are now rejected during token decryption. # How the Problems Are Solved - `AESCrypto.DecryptString()` checks if the decrypted bytes only contain valid UTF-8 characters before converting them into a string. - `AESCrypto.Decrypt()` is unmodified and still allows decryption on non-UTF8 byte strings. - `FromRefreshToken` now uses `DecryptString` instead of `Decrypt` # Additional Changes - Unit tests added for `FromRefreshToken` and `AESCrypto.DecryptString()`. - Fuzz tests added for `FromRefreshToken` and `AESCrypto.DecryptString()`. This was to pinpoint the problem - Testdata with values that resulted in invalid strings are committed. In the pipeline this results in the Fuzz tests to execute as regular unit-test cases. As we don't use the `-fuzz` flag in the pipeline no further fuzzing is performed. # Additional Context - Closes #7765 - https://go.dev/doc/tutorial/fuzz |
||
---|---|---|
.. | ||
generate | ||
already_exists_test.go | ||
already_exists.go | ||
deadline_exceeded_test.go | ||
deadline_exceeded.go | ||
error_test.go | ||
error.go | ||
internal_test.go | ||
internal.go | ||
invalid_argument_test.go | ||
invalid_argument.go | ||
not_found_test.go | ||
not_found.go | ||
permission_denied_test.go | ||
permission_denied.go | ||
precondition_failed_test.go | ||
precondition_failed.go | ||
resource_exhausted_test.go | ||
resource_exhausted.go | ||
unauthenticated_test.go | ||
unauthenticated.go | ||
unavailable_test.go | ||
unavailable.go | ||
unimplemented_test.go | ||
unimplemented.go | ||
unknown_test.go | ||
unknown.go | ||
zerror_test.go | ||
zerror.go |