Repository navigation
Reject invalid UTF-8 in trusted workflow blobs - #1614
Conversation
Architecture-Review: unchanged; Git still resolves the same trusted ref. Decoder failures report the existing source label. Co-Authored-By: Codex <noreply@openai.com>
There was a problem hiding this comment.
loopzero primary review by claude on 028e9d058d2e649a73d4e69e82669764d12d205e, 15.9s: approve (0 critical, 0 important, 2 suggestion)
Settings per native call (launch configuration and CLI claims, not backend attestation):
- Call 1: requested model claude-opus-5-5 (effort medium); CLI-reported model claude-opus-5-5 (effort unknown); configured model claude-opus-5-5 (effort medium)
Native Claude output is retained in the restricted local review receipt.
| raise ConfigError(f"cannot read {source}. {hint}") | ||
| try: | ||
| data = tomllib.loads(shown.stdout) | ||
| data = tomllib.loads(shown.stdout.encode("utf-8", errors="surrogateescape").decode("utf-8")) |
There was a problem hiding this comment.
suggestion: Surrogateescape round-trip is roundabout
With preserve_newlines=True, _proc.run decodes stdout with errors="surrogateescape" (_proc.py:170). This change re-encodes that output to get the raw bytes back, then decodes it strictly. The result is correct: invalid bytes now raise instead of being silently replaced with U+FFFD as in the old text mode. But it depends on an internal detail of _proc.run's error handler, so it can break silently if that detail changes. The encoding is also passed in two places that must stay in sync. A simpler fix is to let _proc.run decode strictly or return raw bytes, then pass the bytes to tomllib.loads(raw.decode("utf-8")).
| data = tomllib.loads(shown.stdout) | ||
| data = tomllib.loads(shown.stdout.encode("utf-8", errors="surrogateescape").decode("utf-8")) | ||
| except UnicodeDecodeError as exc: | ||
| raise ConfigError(f"{source}: {exc}") from exc |
There was a problem hiding this comment.
suggestion: Trusted-Git UTF-8 error omits the recovery hint
Every other error from _remote_workflow adds . {hint}, which tells the user to fetch the trusted base or supply --config. The new UnicodeDecodeError branch leaves it out, so a malformed trusted blob is the only trusted-source error without recovery guidance. Use raise ConfigError(f"{source}: {exc}. {hint}") from None to match the TOML branch next to it.
|
@Mergifyio queue |
✅ Merged into
|
|
No description provided. |
Reject invalid UTF-8 in trusted workflow blobs
Context and goal
Closes #1605
Acceptance
Base
Base: 09fad5b
Validation
Recorded for
028e9d058d2euv run --group dev ruff check src tests: exit 0uv run --group dev tach check: exit 0uv run --python 3.14 python scripts/check_architecture_docs.py: exit 0scripts/size_budget.sh: exit 0uv run --group dev pytest -q: exit 0Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Review