Normalize runtime secret transport whitespace
This commit is contained in:
parent
5e08b8129c
commit
0ef2ae515e
2 changed files with 27 additions and 1 deletions
|
|
@ -69,7 +69,13 @@ def main() -> None:
|
|||
|
||||
|
||||
def _required(name: str) -> str:
|
||||
value = os.environ.get(name)
|
||||
# Values sourced from files or `kubectl create secret --from-file` commonly
|
||||
# retain one trailing newline. Such a value is unusable in HTTP headers
|
||||
# (notably USER_ENGINE_PROXY_SECRET and provisioning bearer tokens), and
|
||||
# comparing it byte-for-byte makes the trusted boundary impossible to
|
||||
# exercise. Normalize transport whitespace at the runtime boundary; the
|
||||
# domain and adapters still receive an opaque non-empty value.
|
||||
value = os.environ.get(name, "").strip()
|
||||
if not value:
|
||||
raise RuntimeError(f"{name} is required")
|
||||
return value
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue