Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Clone

Read only, no credentials:

https://rodent.software/git/vole.git

Write over SSH with a registered key:

git clone ssh://git@0.0.0.0:2222/vole.git

A free and open-source forge that lives in your Git repo.

Fuzz the path validators and the Markdown sanitizer

5fce878d41da32448803f3a4f4d42c7841fba331 · Keenan Nemetz · 10d ago · parent d9f5a930

Fuzz the path validators and the Markdown sanitizer

Two pieces of untrusted text decide where a file is written and what a browser
runs: the validators that turn a request path, an artifact glob, or a site
directory into a place under a root, and the markdown boundary where goldmark and
bluemonday turn a pushed body into HTML a page trusts.

The sanitizer assertions parse the output with an HTML parser rather than
searching the string, because the difference is the whole question: a script tag
rendered as text is a text node, and hand-written <script> looks the same to a
substring search. The test asks what the browser will do: no script-shaped
element, no on* attribute, and no scheme outside http, https, mailto.

The path targets state the guarantee the way the caller uses it -- joined to a
root, the result stays under that root -- and pin that cleaning is idempotent, so
one page cannot become two cache keys.

cleanPath's comment claimed dot segments were refused; they are resolved, and the
comment now says so, which is what the property pins.

Closes #98.

go.mod +1−1

@@ -11,6 +11,7 @@ require (
11 11 github.com/microcosm-cc/bluemonday v1.0.27
12 12 github.com/yuin/goldmark v1.8.6
13 13 golang.org/x/crypto v0.58.0
14 golang.org/x/net v0.61.0
14 15 gopkg.in/yaml.v3 v3.0.1
15 16 )
16 17
@@ -26,7 +27,6 @@ require (
26 27 github.com/philhofer/fwd v1.2.1 // indirect
27 28 github.com/tinylib/msgp v1.6.5 // indirect
28 29 github.com/x448/float16 v0.8.4 // indirect
29 golang.org/x/net v0.61.0 // indirect
30 30 golang.org/x/sys v0.49.0 // indirect
31 31 golang.org/x/text v0.43.0 // indirect
32 32 )