atproto pds pds.zat.dev

Reject signed percent escapes in HTTP forms and scope display #34

Open zzstoatzz.io
Open opened by zzstoatzz.io
ZDS v0.14.16 (`c4c4b89df99f320335f9fda98f6c0ce501fd2c60`) uses Zat's strict decoder for scope authorization, permission-set parsing and OAuth icon data URLs. Two remaining helpers still parse percent pairs with `std.fmt.parseInt(u8, pair, 16)`: - [`src/http/api.zig:545`, `percentDecode`](https://tangled.org/zat.dev/zds/blob/c4c4b89df99f320335f9fda98f6c0ce501fd2c60/src/http/api.zig): strict form/query decoding into caller-provided storage; raw `+` becomes space. Used by query parsing and OAuth form/loopback-client parsing. - [`src/atproto/oauth/scope_display.zig:1087`, `percentDecode`](https://tangled.org/zat.dev/zds/blob/c4c4b89df99f320335f9fda98f6c0ce501fd2c60/src/atproto/oauth/scope_display.zig): tolerant display decoding with literal `+` and malformed-text fallback. `parseInt` accepts `%+A` as newline and `%-0` as NUL. Percent escapes require two hex digits. This is a correctness finding; the authorization decoder is already fixed and no authorization bypass is claimed here. Fix strict digit validation without erasing the callers' different policies. Coordinate the form primitive's ownership with Zat, but do not block a narrow fix on an API expansion. Keep `%2B` as plus, raw form `+` as space, and one decoding pass. For display, explicitly retain or decide the malformed-text policy; do not blindly substitute a throwing decoder. Acceptance: - Regression tests through HTTP/OAuth callers and scope display for signed, truncated/nonhex escapes, mixed-case hex, `%2B`, `%2523`, NUL and output-buffer boundaries. - Preserve expected error mapping, allocation ownership and display behavior. - Run `zig zen`, adversarial review, replayable fuzz/property checks and focused before/after performance tests. - Run required repository checks and live smoke of the affected OAuth/query behavior before calling it shipped. Background: [shared decoder review](https://tangled.org/zat.dev/zds/blob/main/docs/history/shared-percent-decoder-2026-11.md), following [Brooke's original fix](https://tangled.org/zat.dev/zds/pulls/33/late…
Sign up or Sign in to add to the discussion.