How a Hidden BOM Character in PowerShell Broke API Auth for an Hour
A development team's automated deploy tool successfully pushed an API token to production, but every subsequent API request failed due to a Unicode byte-order mark (U+FEFF) being silently prepended to the token. The BOM originated from Windows PowerShell 5.1's default UTF-8 console encoding with a 3-byte preamble, which was injected when piping the secret to the platform CLI. Diagnosing the issue was significantly delayed because the platform's secret store marked the variable as Sensitive and write-only, making it impossible to read back and inspect through the dashboard, CLI, or API. Commonly cited fixes such as setting $OutputEncoding or [Console]::OutputEncoding were tested and found ineffective in this case. The team ultimately resolved the issue by bypassing the pipe entirely, writing the secret to a temporary file using explicit BOM-free UTF-8 encoding and redirecting that file to the process's standard input.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in