Skip to content

fix: harden serve.py redirects, docs prefix, traversal, and 404s#605

Open
Chessing234 wants to merge 3 commits into
teorth:mainfrom
Chessing234:fix/serve-analysis-docs-hardening
Open

fix: harden serve.py redirects, docs prefix, traversal, and 404s#605
Chessing234 wants to merge 3 commits into
teorth:mainfrom
Chessing234:fix/serve-analysis-docs-hardening

Conversation

@Chessing234

Copy link
Copy Markdown
Contributor

Summary

  • Redirect bare /analysis to /analysis/ (was raising FileNotFoundError).
  • Map /analysis/docs (no trailing slash) to DOCS_SITE instead of BOOK_SITE/docs.
  • Reject .. path traversal under /analysis and return .missing for unknown URLs (clean 404).

Branches: fix/serve-redirect-analysis, fix/serve-docs-prefix, fix/serve-traversal-and-404.

Supersedes #597 and the serve.py half of #602.

Test plan

  • /analysis → 301 /analysis/
  • /analysis/docs → under DOCS_SITE
  • /analysis/../etc/passwd.path-rejected
  • /foo.missing
  • CI Build book

Chessing234 and others added 3 commits July 23, 2026 15:23
Bare /analysis did not match /analysis/ and raised FileNotFoundError.

Co-authored-by: Cursor <cursoragent@cursor.com>
/analysis/docs was treated as a book path under /analysis/, so it
served BOOK_SITE/docs instead of the doc-gen tree.

Co-authored-by: Cursor <cursoragent@cursor.com>
os.path.join allowed .. escapes under /analysis; raising FileNotFoundError
skipped SimpleHTTPRequestHandler's 404 path.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant