<#1231 fix: raise InitializationError for malforme...
# flyte-github
a
#1231 fix: raise InitializationError for malformed API key Pull request opened by EngHabu Problem A garbled / truncated API key (invalid base64) caused
decode_api_key
to leak a raw
binascii.Error
("Invalid base64-encoded string: number of data characters … cannot be 1 more than a multiple of 4") as a crash report — surfaced in Sentry as FLYTE-SDK-5C (via
flyte.cli._common.initialize_config
→
decode_api_key
→
base64.b64decode
). This is bad user input, not an SDK bug. Fix Wrap the base64 decode (and the existing part-count check) in a typed `InitializationError(code="InvalidApiKey", kind="user")`: • Clear, actionable message ("Re-copy the API key from the Union console"). •
InitializationError
is in the
_is_user_error
allowlist (
_sentry.py
), so it is filtered from crash reporting instead of leaking. Tests Added
test_auth_utils
cases for a valid key, malformed base64, and wrong part count. fixes FLYTE-SDK-5C flyteorg/flyte-sdk