Expand description
Request-path guards: the percent-encoding refusal and the owner / repo / ref / path validators the JSON API and the HTML lanes share.
Cites the JSS forge dispatcher (the %2e|%2f|%5c|%00 refusal ahead of
routing) and helpers.js (okSegment, okPath, okRef) by name only.
Constants§
- RESERVED_
OWNERS - First path segments the router gives a meaning of its own. An owner with
one of these names would be routed one way and gated another (for example
/api/<name>.git/info/refsis smart-HTTP git but looks like the API namespace to a path-segment check), so they can never be owner names.
Functions§
- is_sha
- JSS
SHA_RE:^[0-9a-f]{4,64}$. - ok_
owner - JSS
OWNER_NAME:^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$, no... - ok_path
- Segment-wise
ok_segmentover a path split. - ok_ref
- JSS
okRef:^[A-Za-z0-9][A-Za-z0-9._/-]{0,200}$without.., a trailing/or//. - ok_repo
- JSS
REPO_NAME:^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$, no.., no.gitsuffix. - ok_
segment - JSS
okSegment: a non-empty path segment of at most 255 bytes that does not start with., contain.., a backslash, a control character or a percent-form of. / \. - percent_
guard - Refuse a request path that still carries a percent-form of
.,/,\or NUL, or a literal NUL, backslash or control character. - reserved_
owner truewhensis aRESERVED_OWNERSword (ASCII case-insensitive).