Repository navigation
Replies: 2 comments 1 reply
|
Hi @boazgarty, |
0 replies
|
Hi Patrick,
Following up on your offer in Discussion #1575 — I ran a review of LeafWiki
(main @ 7030e9e), focused on the three areas you flagged (XSS, path
traversal, zip bombs), plus a broader static pass (SCA, SAST, secrets, IaC,
GitHub Actions).
Short version: your existing defenses hold up. I reviewed the relevant code
by hand, not just scanner output — here's what I found.
XSS
Two SAST hits flagged as high-confidence, both false positives on
inspection:
- HighlightedSearchTitle.tsx line 16 — entity-decoding via a detached
<textarea> that's never appended to the DOM. Standard safe pattern.
- useMermaidInjector.ts line 143 — inert <template> parsing, safe in itself.
One thing worth your own look, though, not confirmed as exploitable:
Mermaid is initialized with securityLevel: 'antiscript' rather than its
default 'strict' (DOMPurify-sanitized) mode. Since diagram source is
wiki-editable content and the rendered SVG is inserted into the live DOM
after only Mermaid's own sanitization, it might be worth checking whether
'strict' mode is viable, or adding an explicit sanitize pass on the SVG
output as defense-in-depth. I didn't attempt a PoC.
The main markdown pipeline (rehype-raw into rehype-sanitize, correctly
ordered, plus your own style-attribute whitelist) is solid.
Path traversal
No issues found. I reviewed the three y hand:
resolveBrandingAssetPath(rejects /, , .., absolute paths, extension
allowlist, filepath.Rel containment check), GetRevisionAsset (asset name
is only used for an exact-st — the real path comes from a SHA-256 hash,
never the request), and the two zip extractors (see below).
Zip bombs
Also solid. shared.CopyWithBudget enfotive
archive cap, and adecompression-ratio ceiling against the zip's own
declared size - and restore/manager.go correctly gives untrusted uploads
the capped limits wh path stays unrestricted. Matches whatyou said you'd
already fixed. One minor, low-severity gap: neither extractor caps the
number of entries in an archive, only bytes/ratio - a largeould still
create a lot of inodes. Not urgent.
Other things I noticed along the way
- Two GitHub Actions workflows (build-terpolate ${{ github.actor }}
directlyinto run: shell blocks instead of via env: — a template-injection
pattern, lower risk here since
github.actor is narrow-charset, but yway.
- Dockerfile and Dockerfile.builder don't set a USER, so the container runs
as root.
- One SCA advisory came up (GO-2026-59checked your actual imports and
youonly ever use bcrypt/ssh/hkdf from that module, never openpgp, so this
doesn't apply to you.
Limitations, plainly stated
This was static analysis only I didnpts, so I can't provide the
exampleexploit per finding you mentioned; that would need a self-hosted
test instance and a separate go-ahead
from you if you're interested. Also, t I used only covers a narrower
patternthan your actual routing, so the "no issues found" above is from
manual code review, not just clean
scanner output.
Happy to share the full write-up (raw s for everything) if useful, or
discuss any of this further — just let me know.
Best,
Boaz
… Message ID: <perber/leafwiki/repo-discussions/1575/comments/18600055@
github.com>
|
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi Patrick,
I'm a security engineer and I've been doing free security reviews for open-source projects I think are worth the time. LeafWiki caught my eye — happy to do it if you're interested.
Why this project: a self-hosted wiki is a classic appsec shape — markdown rendered into a browser, authentication, page and file storage paths, a single Go binary people put straight on the internet. All worth proving rather than assuming, and the codebase is small enough that a review can be genuinely thorough instead of a wall of noise.
What I'd send you: dependency CVEs verified as actually reachable (govulncheck call traces, not just "your version is below the fixed one"), static analysis, secrets, and a container image scan. Anything that looks exploitable gets a working proof rather than a severity label. Where there's a clean fix I'll prepare the patch with the verification attached. You review all of it — I won't open anything against the repo unless you ask.
Two things up front. My tooling is AI-assisted, so if that's outside how you want contributions made, tell me and I'll stop there. And I haven't scanned LeafWiki — I don't test a project before its maintainer says yes.
My track record, including the bad parts. One dependency fix merged upstream: langflow-ai/langflow#15015. One where the maintainer read the reasoning, agreed, and shipped the same fix himself four minutes later: rverton/webanalyze#81. And a batch I got wrong — I opened PRs citing golang.org/x/crypto CVEs against projects whose import graphs never touched the affected ssh subpackages, and a maintainer had to point it out (elithrar/simple-scrypt#33). I retracted the rest and rebuilt the verification around govulncheck reachability. You can see all of it on my profile.
If it's useful, just say so. If not, no follow-up.
Boaz
All reactions