Reject tab, newline, and carriage return in SDK manifest remote URLs
Summary
The SDK validates a parsed form of scan.target.remote but returns the original string. new URL() removes ASCII tab, line feed, and carriage return before parsing, so those characters can survive in a value that the loader considers valid.
Current evidence
The SDK validator extracts authority with:
const authority = /^[A-Za-z][A-Za-z0-9+.-]*:\/\/([^/?#]+)/.exec(remote)?.[1];
That character class accepts tab/LF/CR, as does the manifest schema's remote pattern. The subsequent URL parser strips them. The original synthetic example is:
{"remote": "https://example.com\nhttps://evil.example.net"}
The parser sees a normalized single-line value, while loadContract() can return the original two-line string. Existing authority checks still reject credentials in the authority; this report does not establish credential smuggling or a live CLI exploit.
Expected behavior
- Reject the demonstrated control characters in the stored remote before URL parsing can discard them.
- Apply the same documented rule at the producer and SDK reader boundaries.
- Retain legitimate URL forms that the parser serializes differently, such as mixed-case hosts, default ports, or internationalized hostnames.
Do not require new URL(remote).href === remote: ordinary serialization changes are not evidence of invalid input. The demonstrated input-validation gap also does not call for a new output-redaction or general string-sanitization policy.
Status and regression scope
#784 is the open SDK proposal. Other finalizer URL-validation changes do not establish that this reader path is fixed. Preserve the original tab/LF/CR cases and valid-URL controls in a sealed-manifest regression.
The original environment was CLI 0.1.5, Node 24.11.1, and Bun 1.3.14 on macOS. The relevant validation shape remains present in the main snapshot linked above.
Resolved by #1310, merged as e6c7b28ad39e3801027aa9bfb2466fdfaf11003a.
Verified on current main at 58433cd3683f48c2bfbfe4f5403e01145e560f32: the SDK reader now rejects raw control characters before URL parsing, matching the producer. That change also added regression coverage in both readers.
Focused verification passed:
- A sealed-manifest probe rejected the original tab/LF/CR combined-URL examples and the corresponding path variants in both readers (6 invalid cases).
- Mixed-case hosts, default ports, internationalized hostnames, and percent-encoded tab/LF/CR remained accepted with their original stored values (6 valid cases). Manifest bytes were unchanged.
- Python finalizer remote-URL tests: 7 passed, with 22 subtests passed.
Closing as completed. The SDK validation gap described here is already fixed independently of the still-open #784.