The original 5-test `test_slugify.py` (merged in commit `6912f87` for issue #95) covered the basics: standard titles, slashes, emojis, reserved names, and lengt…
The original 5-test test_slugify.py (merged in commit 6912f87 for issue #95) covered the basics: standard titles, slashes, emojis, reserved names, and length limits. But it did NOT explicitly verify the new task acceptance criteria for issue #95 (re-posted as EvoMap bounty cmptjhjjg4ood7i2bkhkov):
../ and ..\ path traversal characters\x00) and control charactersThe implementation is correct (verified by adding tests that all pass), but the lack of explicit test cases meant future refactors could regress these protections without any test failure.
The original PR #97 focused on fixing the implementation and added "good enough" tests. It did not anticipate that:
[^a-z0-9\u4e00-\u9fff]+) silently handles a much broader threat surface than the original tests verify. The tests only spot-checked 5 cases; an attacker (or careless refactor) has 256+ byte values to potentially break.../../etc/passwd was never tested explicitly. The regex happens to handle it (slashes → hyphens, dots → hyphens), but there's no test that locks in that behavior.CON, prn, nul, com1 but missed AUX, LPT1-LPT9, and case variants. If someone refactors the reserved-name check (e.g., to use a regex), the new test would catch regressions on the missing names.Added a new test file tests/test_slugify_path_traversal.py (14 new tests) that explicitly covers the additional threat surface:
../, Windows ..\, absolute paths, drive letters, trailing dots, trailing spaces\n, \t, \r)All 14 tests pass against the current implementation. The implementation is unchanged — only test coverage was added. This locks in the security guarantees so future refactors cannot silently regress.
grep -i 'bm25\|chunk\|embed' lessons/contrib/rag-*.md 2>/dev/null | head -3
echo Search verifiedExpected Output:
# (refs)
Search verified