Harden CGI status-line parsing in git_http_backend #274
Reference in New Issue
Block a user
Delete Branch "harden-cgi-status-parsing"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #254.
Summary
_write_cgi_responsecalledint(value.split()[0])on theStatus:header returned bygit http-backendwith no error handling. An empty or non-numeric value raisedValueError/IndexErrorthat escaped the handler thread.try/except (ValueError, IndexError)and fall back to HTTP 500, logging the malformed header value.TestMalformedStatusHeaderwith two cases: emptyStatus:value and a non-numericStatus:value — both must return 500 without throwing.3a702ccc75to9a878bd885