AgeCommit message (Collapse)AuthorLines
Clamp the log offset to bound history walksBryce Kwon-1/+11
A crafted ofs value could send cgit walking most of the history for one request.
Require a boundary in the about-path prefix checkBryce Kwon-1/+7
The about subpath was confined to the readme directory with a plain byte-prefix match, so a sibling directory sharing the base name as a prefix passed the check and its files were served.
Build the tree line gutter in one bufferBryce Kwon-2/+5
The line-number gutter did one allocation and one write per line.
Check max-blob-size up front and default to 10 MBBryce Kwon-8/+33
Only the tree view honoured the limit, and only after loading the whole object. The default moves from unlimited to 10 MB so a fresh install never buffers a huge object whole. Zero still turns the limit off.
Harden the blob view error pathsBryce Kwon-13/+27
A blob requested by ref with an unknown path fell through to the commit object and was served with a 200 instead of a 404. Two error pages passed a null pointer to a %s format when the request carried no object id, and the error pages left the layout open.
Keep an overlong path out of the tab titleBryce Kwon-4/+15
fmt() aborts the request rather than truncate, so a very long path fed into a context-sensitive tab title took down page rendering.
Fix the stats year label and a missing authorBryce Kwon-2/+4
The year period rendered without its label, and a commit with no author line crashed the view.
Cast signed chars before ctype callsBryce Kwon-6/+6
A plain char is undefined in the ctype functions for negative values, which a high byte produces wherever char is signed.
Avoid an out-of-bounds read on short scan pathsBryce Kwon-1/+1
A relative path shorter than five bytes made the /.git suffix test read before the buffer.
Bail out on a read error in read_first_lineBryce Kwon-2/+11
read_in_full returns a signed -1 on error, which became SIZE_MAX once stored in the size_t length and then wrote a terminator far out of bounds.
Tolerate a missing or empty repository URLBryce Kwon-2/+4
trim_end() returns NULL when a repo url is empty or all slashes, and the later newline trim dereferenced it. The legacy r= and p=about path also read the last byte of the url without checking it was set.
Escape non-markdown readmes without a filterBryce Kwon-2/+16
A readme that is not markdown was written to the about page as raw HTML when no about-filter was configured, so an untrusted repository could inject script.
Render README markdown in the browserBryce Kwon-12/+49
cgit had no markdown support of its own, so a readme was rendered through an external python filter or not at all. Escaping the source and formatting it in cgit.js keeps the work in the browser like the blob highlighter, and the page stays readable as plain text without scripting.
Add built-in syntax highlightingBryce Kwon-1/+8
Highlighting previously required a source filter shelling out to something like Pygments. A configured source filter still takes precedence, every character is preserved so the line gutter stays aligned, and large files are skipped.
Adapt the layout to small screensBryce Kwon-8/+10
On a phone the description, owner and shortcut columns crowded the index and pushed the age off screen, and tapping the name already opens the repository, so the index collapses to name and age.
Add a light and dark theme toggleBryce Kwon-0/+3
The button is emitted hidden and only revealed by the script, so a browser without JavaScript never shows a control that cannot work and the page keeps tracking the system theme.
Overhaul the stylesheet with tokens and dark modeBryce Kwon-1/+1
The old sheet had no overflow rules, so wide code, diff, blame and stats blocks scrolled the whole page sideways on a phone. The classic layout, badge colours and age shading are kept.
Add viewport and color-scheme meta tagsBryce Kwon-0/+5
Without a viewport meta, mobile browsers assume a desktop-width page and scale it down, which is the root cause of content overflowing on small screens.
Rebuild the page chrome as semantic HTMLBryce Kwon-59/+91
The masthead, tab bar, breadcrumb, content region and footer were HTML tables, which cannot reflow and forced the page to scroll sideways on small screens. Class and id names are kept so custom themes keep matching.
Add enable-tree-group-dirs to list dirs firstBryce Kwon-5/+63
Gate the cache listing behind enable-cache-listBryce Kwon-0/+9
The ls_cache page printed the cache directory path and the urls other visitors had requested, with no gate at all.
Let cgit build with or without LuaBryce Kwon-1/+1
Lua only powers the filter extensions, so it stays optional and autodetected. Autodetection skipped Lua 5.3 and 5.4, so a system with only those fell back to a build without Lua. The release script still leaves Lua out unless asked, so its binary needs no Lua at runtime.
Replace the glibc-only memrchr for portabilityBryce Kwon-1/+12
Reorganise into source, assets and librariesBryce Kwon-0/+10748
Everything the build generates now lands in build/, so a clean is a single remove and the source tree stays free of build output.