Skip to main content

Module request

Module request 

Source
Expand description

Binder-agnostic request/response types plus the XSS-neutralisation spine.

Mirrors the shape of solid_pod_rs_git::service::GitRequest so the embedding server translates its native (actix/axum/hyper) types once, at the edge, and the forge logic stays framework-free and testable.

Security posture (cites JSS forge design notes, not code): every byte the forge serves is neutralised by content-type, never by trusting HTML sanitisation. Raw repository bytes go out as text/plain; charset=utf-8 or application/octet-stream with a Content-Disposition: attachment, so a browser never renders a blob as markup. The single esc helper HTML-escapes every value the server-rendered views interpolate.

Structs§

ForgeRequest
Opaque HTTP request consumed by crate::ForgeService::handle.
ForgeResponse
Response returned from crate::ForgeService::handle; the server maps it back to its native response type.

Functions§

esc
HTML-escape the five significant characters. This is THE single interpolation helper — every value rendered into a server view passes through it. Ampersand is escaped first so a later < is not double-escaped into <.
looks_textual
Heuristic: does a byte slice look like UTF-8 text safe to serve inline as text/plain? A NUL byte or invalid UTF-8 forces the attachment path.
parse_form
Parse application/x-www-form-urlencoded body into decoded pairs.
percent_decode
Percent-decode a form/query token, mapping + to space and %XX to its byte. Invalid escapes are passed through literally.
sanitize_filename
Strip a filename down to a header-safe token: no quotes, no control chars, no path separators. Prevents header-injection and traversal in the Content-Disposition value.