AgeCommit message (Collapse)AuthorLines
Add filename* for a download name past ASCIIBryce Kwon-3/+24
The plain, snapshot and blob pages sent a name such as café.txt raw in filename, which a client may read as ISO-8859-1. RFC 6266 has such a name sent again as filename*, percent-encoded in UTF-8, for a client that knows the form, with filename first for one that does not. The extended form carries UTF-8 alone, so a name that is not valid UTF-8 keeps the plain filename by itself.
Move the root-readme test to the index testsBryce Kwon-12/+0
The test reads the index and the site about page, both drawn by ui-repolist.c. Its site had no repositories, so the index it read was the error page, and a readme printed below the list went unseen. The shared repositories give it a real index.
Test a repository url in UTF-8Bryce Kwon-0/+21
Test a file name in UTF-8Bryce Kwon-0/+39
Test the about path check for each kind of readmeBryce Kwon-6/+40
Three tests exercised the single path check in about_fn, each through one kind of readme, and none through a readme read from the head being browsed.
Share the security tests' repeated setupBryce Kwon-36/+35
Move the tree grouping test to the tree testsBryce Kwon-17/+4
Grouping folders first is tree page behaviour rather than a security fix, so it joins the tree tests on a repository of its own.
Link a file name of stray bytes percent-encodedBryce Kwon-0/+18
No test gave a file name invalid UTF-8 or a control byte, which APFS refuses on disk, so the tree is built through the index.
Keep the robustness tests to portable shellBryce Kwon-2/+2
An unquoted $cgitbin breaks in a checkout whose path holds a space, and head -c and head -1 are not POSIX. The status of the disconnected request is still read right after its pipeline, which assumes the shell waits for the left side as dash, bash, ksh and busybox ash all do.
Pin the robots.txt rulesBryce Kwon-0/+13
Nothing in tests/ read robots.txt, so dropping the trailing slashes again went unnoticed.
Feed the Location header every kind of byteBryce Kwon-0/+13
Only a benign query had been redirected, so nothing showed that a space, a control byte or a byte past ASCII in the query string is encoded before it reaches the Location header.
Test the download names a request choosesBryce Kwon-0/+18
The plain page's header was the only one fed a newline. A snapshot asked for with h= keeps the name it was requested under, and a blob fetched by id takes any path, so both put visitor bytes into Content-Disposition.
Check the empty author on every page it reachesBryce Kwon-9/+22
The title claimed every page, but only the log, commit and atom pages were asked for. The commit now changes a file, since the patch page leaves out a commit with nothing to show, and its parent is read before the printf, where a failed rev-parse would have gone unnoticed.
Test the dumb transport allowlist in one tableBryce Kwon-7/+18
The allowlist was tested in two places, and the 404 alone did not show the transport was live behind the auth filter, since a page that does not exist answers the same. A loose object and HEAD now have to come through, and the planted alternates file is removed even when the test fails, where it used to leave rob borrowing foo's objects.
Ask for the two 404 pages with the cache offBryce Kwon-10/+9
Both requests went through the shared page cache, and the clone one only worked because clone pages are never stored, which is what the cgitrc_copy comment warns of.
Check the order of branches at odd objectsBryce Kwon-14/+27
points-at-tree only ever matched its entry in the branch switcher, and points-at-tag was never looked for. Every branch also shared one date, so the age and name sorts gave the same rows, and nothing showed the name setting had applied. The loose refs written by hand need the files backend.
Read the surplus conversions from their own pageBryce Kwon-6/+3
The check read the page the previous test had left, and it took any hex where the commit goes and only two of the eight conversions.
Try every risky scheme in a .gitmodules urlBryce Kwon-12/+29
Only a lowercase javascript url was tried, so a denylist of that one spelling would have passed. The quote test also read the page the test before it had left.
Test request values a page echoes backBryce Kwon-0/+36
Only %zz%2 had been sent, so nothing showed that markup in the query, the hidden inputs a form carries, the errors naming a refused value or the Host header is escaped on its way back.
Check the lone percent sign in the search boxBryce Kwon-5/+4
For a bare q=% only the status was checked, so a decoder that dropped the sign passed.
Test markup in refs, names and messagesBryce Kwon-0/+54
No test gave a ref name, a commit or tag message, a note or an ident any markup, and the one hostile file name never reached an attribute. html_txt leaves quotes alone, so a name holding both a quote and a bracket is what tells an attribute written as text.
Test the leading slashes stripped from a urlBryce Kwon-0/+16
Nothing showed that every leading slash goes, through url= or PATH_INFO, and one left behind joins the virtual root into a scheme-relative link to another host.
Send the advisory payloads through PATH_INFOBryce Kwon-0/+35
All three shipped server configs hand cgit the path as PATH_INFO, already decoded, yet every hostile path in the tests went through url= instead.
Prove the filter saw the hostile file nameBryce Kwon-5/+4
The name also sits in the breadcrumb and the title, so the test passed with the source filter never run, and the missing marker proved nothing. dump.sh echoes its arguments ahead of the body it upper-cases, which shows the name arrived whole as one argument.
Check the line links of a side-by-side diffBryce Kwon-9/+17
The links have been written through html_attr since b8adfd6, so with the percent-encoding dropped a quote came out as an entity the absence check could not match, and the presence check was met by the file links above the diff. The test now reads the line links themselves, for a name holding a hash and a question mark as well.
Look for inline handlers on every main pageBryce Kwon-4/+15
Only the commit page was checked, and only for onchange, though a site policy without unsafe-inline blocks every inline handler on any page.
Tie each escaped readme to its own payloadBryce Kwon-8/+7
The escaped script tag alone matched either readme, so the markdown page showing the text readme passed.
Compare the small blob the plain page servesBryce Kwon-2/+6
The test took any page holding the word top, with no status checked. The refusal half lives in t0204, so the fixture now says why its limit is set so low.
Read the --output refusal from its own requestBryce Kwon-10/+10
The refusal was read from a page the previous test had left, which --run could skip, and both requests went through the shared page cache. The marker is also named apart from the one the filter test plants, so a failure in one cannot fail the other.
Check the policy sent with repository bytesBryce Kwon-0/+28
No test asserted the Content-Security-Policy header, though it is all that keeps script in an SVG from running when the plain page serves it under its own type.
Prove the login body is cut at the bufferBryce Kwon-5/+16
The posted body was 22 bytes, so an unclamped read stopped at its end and nothing overflowed, and the test could not fail. The filter now counts what it was handed from a body larger than the buffer.
Spell side-by-side in the test commentsBryce Kwon-1/+1
Ask for a url through cgit_url everywhereBryce Kwon-3/+3
Move the later tests to the config writersBryce Kwon-97/+38
The one-line request wrappers go with them. Configs with several repositories, a key out of place on purpose, the cache on or no repository of their own stay written out.
Work out each gitlink's target onceBryce Kwon-4/+1
Test bodies run in the main shell, so the target named in the fixture reaches every check that greps for it.
Serve both readme escaping checks from one configBryce Kwon-16/+9
Ask each page that sorts odd branches in one loopBryce Kwon-23/+8
Write the test filter scripts with write_scriptBryce Kwon-3/+1
Drop test lines that add nothingBryce Kwon-1/+0
The trash directory starts empty and setup.sh already made the cache, the clamp check already fails on a short query, and the commit the setup named is still there to pin.
Leave two log checks to the log testsBryce Kwon-5/+0
t0103 already renders foo/log and finds commit 5, and its search for a bracket fails the same way this literal search did if --fixed-strings ever goes.
Leave the blob size refusals to the limits testsBryce Kwon-22/+5
t0204 asks the tree, plain, blob and blame pages for one oversized blob and checks the exact status and message, so the looser copy here went.
Serve only the files a dumb clone asks forBryce Kwon-2/+2
The object path check let any run of safe characters through, so a spelling such as info//alternates or info/./alternates reached the alternates file the exact name was refused for.
Describe root-readme as the site's about pageBryce Kwon-0/+16
Answer 404 for any path below the about pageBryce Kwon-1/+1
The about page served every file beside the readme as a page of its own, through the about filter, and answered 200 for directories and missing files alike. Images it passed through came from the root of the default branch whatever the readme's own directory and ref. A readme on disk exposed its whole directory this way.
Test the advisory classes and name an empty authorBryce Kwon-0/+110
Each class behind cgit's published advisories now has a check against the current code, from a newline in a file name to shell syntax handed to a filter. The feed also treated an ident with an empty name and an empty address as present and wrote an empty person, which Atom forbids.
Test the hardening passBryce Kwon-1/+1
Harden the request path, scan and error recoveryBryce Kwon-5/+26
Clean up the whole treeBryce Kwon-2/+1
Trim the comments and dead code across the treeBryce Kwon-4/+2
Remove the auto-submitting selectsBryce Kwon-4/+4