Repository navigation
fix(cli): read files saved by Windows PowerShell's redirect - #687
Conversation
`trustshell sign-receipt body.json > r.json`, the command demo prints, wrote UTF-16 in Windows PowerShell 5.1, and verify-receipt then called the file "not valid JSON". Found by running the same commands in each shell from a clean install. Every file a person hands the CLI now decodes the same way, including claims files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Strix Security Review✅ No open security findings. PR summary: Adds a `decodeText` helper that strips a byte-order mark and decodes UTF-16LE/BE, and uses it for every file the CLI reads from a person (receipts, envelopes, `report --evidence`, `--claims-file`), so files written by Windows PowerShell 5.1's `>` are read correctly. Review summaryThe PR adds a small Ruled out (3)
Review 1 on this PR · Reviewed by Strix |
There was a problem hiding this comment.
The PR adds a small decodeText helper that strips a UTF-8 byte-order mark and decodes UTF-16LE/BE, and routes the CLI's receipt, envelope, --evidence and claims-file reads through it. I traced every changed read to its sink: receipt and envelope integrity are computed over kernelCanonicalJson of the parsed object, so file encoding cannot influence a signature or hash decision (confirmed end-to-end, including a tampered UTF-16 receipt that still fails); the claims plain-ASCII gate runs on the decoded text, so UTF-16 cannot smuggle non-ASCII past it; and the claims byte cap is still measured on raw bytes. The committed dist/ matches the src/ change. No security vulnerabilities were found in the changed code.
Reviewed by Strix
Configure security review settings
trustshell sign-receipt body.json > r.json, the commandtrustshell demotells a new user to run, fails on Windows PowerShell 5.1. Its>writes UTF-16, andverify-receiptthen says the file is "not valid JSON".Found by running the same commands in each shell from a clean install of the tarball. Every file a person hands the CLI now decodes the same way: receipts, envelopes, saved
check --jsonevidence and claims files.Evidence:
tests/decode-text.test.ts. Release E2E on a tarball with this change, Windows, PowerShell 5.1 and Git Bash: 21 of 21 steps passed, includingshells.powershell-5.1.redirect, which failed before it.🤖 Generated with Claude Code