Repository navigation
fix(tracking): validate identifiers and keep server paths inside the storage directory - #948
elijahbenizzy wants to merge 4 commits into
Conversation
…storage directory Add an allowlist check for project and app identifiers in LocalBackend and a join helper that resolves paths and verifies they stay inside the configured storage directory. Bind the standalone server to 127.0.0.1 by default.
…e server endpoints Move the project/app identifier rule and the path join helper into burr.tracking.common.identifiers (shared with LocalTrackingClient), keep the LocalBackend wrappers that report failures as HTTP 400, honour BURR_SERVER_HOST for the standalone server, and extend the tests to the FastAPI endpoints, symlinked directories and client-style identifiers.
sangkyoonnam
left a comment
There was a problem hiding this comment.
The server-side checks reject the traversal and encoding cases I sent to the backend endpoints, and pytest tests/tracking passes. The trailing-newline gap in identifiers.py that I noted on #946 applies here too, since the file is identical.
One upgrade question: some existing ids, like user@example.com, still appear in the app listing, but opening them now returns 400. What should users with data created before this change expect?
|
Two remaining hardening items before merging:
Also incorporate the identifier-regex fix from #946: use I view file-level symlink handling as defense-in-depth because the storage directory is operator-controlled, but if this PR claims that every server path remains inside the configured storage directory, final file paths need to satisfy that claim too. |
… mount demos only on request
|
@skrawcz done: (1) the four fixed filenames are containment-checked individually, with a symlink test per file; (2) demo routers are opt-in via |
…ls and the cli extra
Carries forward #795 by @andreahlert with his commit intact, and shares the identifier rule with the tracking client (#946).
python -m burr.tracking.server.runbinds to127.0.0.1by default, overridable withBURR_SERVER_HOST, matching what theburrCLI already does. The CLI help and module docstring note that the server has no built-in authentication.23 tests added. Merge before #944, which documents this behavior.
Update after review. Every file the server opens under an application directory (
graph.json,log.jsonl,metadata.json,children.jsonl) now goes through the same containment check as the directory; a symlinked file pointing outside the storage directory returns 400 (or is skipped with a warning in listings). Demo routers are mounted only whenBURR_SERVER_DEMOSis truthy;burr-demosets it, plainburrdoes not. Shares the widened identifier rule from #946 (any single path segment; see that PR for what is accepted and rejected).