fix(root_policy): allow /var paths when temp indexing is opted in - #643
Conversation
|
👋 Thanks for the contribution! Quick heads-up: this repo lands changes on the current Please retarget this PR via Edit → base branch to the active release branch (currently (Automated hint — reply here if you need a hand.) |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4a7df97c9a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (!tempIndexingAllowed()) { | ||
| if (isExactOrChild(path, "/private/tmp")) return false; | ||
| if (isExactOrChild(path, "/tmp")) return false; | ||
| if (isExactOrChild(path, "/private/var")) return false; | ||
| if (isExactOrChild(path, "/var")) return false; |
There was a problem hiding this comment.
Keep system /var paths blocked when temp opt-in is set
With CODEDB_ALLOW_TEMP=1 or --allow-temp, this guard is skipped and /var plus /private/var now fall through because they were removed from system_prefixes. That means an opted-in CI/SWE-bench run (or an MCP project argument) can index /var/log, /var/lib, or /private/var/log; the existing issue-407 test documents those paths as containing logs/secrets and never being valid project roots. Please narrow the opt-in to the intended Fedora home/project case (for example /var/home/...) or keep non-home /var subtrees unconditionally denied.
Useful? React with 👍 / 👎.
Move /var and /private/var from unconditionally blocked system_prefixes to the tempIndexingAllowed guard, so they become indexable when CODEDB_ALLOW_TEMP=1 is set. On Fedora Silverblue and CoreOS, user home directories live under /var/home instead of /home. Blanket-blocking /var prevents legitimate use cases like indexing projects in ~/Projects on these systems. The safe default is preserved: /var is still blocked when CODEDB_ALLOW_TEMP is unset, preventing accidental indexing of /var/tmp, /var/log, etc. Users on affected distros simply set CODEDB_ALLOW_TEMP=1 to opt in. (cherry picked from commit 4a7df97)
4a7df97 to
76475ee
Compare
|
Thanks again for the report and the PR, @XaviCode1000 — this is landing. What I did (using the maintainer-edit access on the PR): your branch was based on
The ordering matters: the Validation on the rebased branch: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 76475eecc4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // (footgun guard) but allowed when temp indexing is opted in (#538, #642) | ||
| // — CI/SWE-bench harnesses clone into /tmp, and macOS TMPDIR resolves | ||
| // under /private/var/folders. | ||
| if (!tempIndexingAllowed()) { |
There was a problem hiding this comment.
Keep
/var/home itself denied under temp opt-in
When CODEDB_ALLOW_TEMP=1 or --allow-temp skips this block, /var/home no longer matches the earlier /var/home/ project rule and /var is no longer in system_prefixes, so isIndexableRoot("/var/home") returns true. On OSTree systems that path is the container for users' home directories; the existing issue-642 expectations deny it by default, while the new opt-in test only checks /var/home/xavi, so an opted-in run that resolves /home to /var/home can scan all homes instead of a project. Please keep /var/home itself denied while allowing only user/project descendants.
Useful? React with 👍 / 👎.
Summary
Move
/varand/private/varfrom the unconditionalsystem_prefixesblock list into thetempIndexingAllowed()guard, matching the existing behavior of/tmpand/private/tmp.This lets Fedora Silverblue and CoreOS users index projects under
/var/home/...by settingCODEDB_ALLOW_TEMP=1, without compromising the safe default.Motivation
On Fedora Silverblue and CoreOS, the user home directory lives at
/var/home/<user>instead of/home/<user>. The current blanket block on/varprevents codedb from indexing any project under these homes, even when the user explicitly opts in viaCODEDB_ALLOW_TEMP.Changes
src/root_policy.zig/varand/private/varfromsystem_prefixesto the!tempIndexingAllowed()guard blockTest Plan
/varpaths are still denied (existing + new tests)CODEDB_ALLOW_TEMP=1:/var/home/<user>/projectis indexablezig build testpasses (pre-existing failures unrelated to this change)zig build -Doptimize=ReleaseSafecompiles successfullyDesign Rationale
Reusing
CODEDB_ALLOW_TEMPinstead of adding a new env var keeps the configuration surface small. Users on affected distros set ONE env var (or pass--allow-temponce) and it covers both the/tmpand/varcases.Closes #642