Windows: an index created by one account locks every other account out. Index files should inherit the project folder's ACL, not be owner-only #317

Closed
opened 2026-10-05 13:24:12 +02:00 by buildagent · 0 comments
Member

Field setup (operator, 2026-10-05): two different Windows accounts, an admin account and a desktop user, work in the same project folder with the same code-index. When the admin account creates or rewrites .code-index/index.db, the desktop account can no longer open it.

Why v0.33.0 does not prevent it. perms::restrict_to_owner (crates/indexer/src/perms.rs) puts a PROTECTED DACL on every index file. It grants full access to OWNER RIGHTS, SYSTEM and the token user's SID. That fixes the single-account case, where an elevated and a non-elevated session of the same user share a SID. For two accounts it shuts the second account out by construction. v0.33.0 turns the symptom into a permanent index_unavailable_permission refusal with the repair (icacls <dir> /reset /T, or rename .code-index), but the lockout still happens.

Rule: the index must be no more private than the project folder it was built from. Anyone who can read the source can read its index.

  • On Windows, files under .code-index/ should INHERIT the project folder's ACL. No protected owner-only DACL. That covers index.db, -wal, -shm, daemon.* and languages.toml.
  • Existing indexes that already carry the protected DACL must be repaired on open, whenever the opening process is allowed to change the DACL. That is a one-time inherit reset.

Also check:

  • Unix has the same shape (0600 files in a folder shared by a group). Decide it explicitly: either keep it, and say so, or follow the folder's mode.
  • doctor reports the condition.

Tests:

  • Windows: a file created with the new rule has no protected DACL and carries the parent's inherited ACEs.
  • An index carrying the old owner-only DACL is reset when opened by its owner.
  • The index_access_denied_e2e refusal still holds when a folder genuinely denies the user.

Target: v0.33.1, right after v0.33.0.

**Field setup (operator, 2026-10-05):** two different Windows accounts, an admin account and a desktop user, work in the same project folder with the same code-index. When the admin account creates or rewrites `.code-index/index.db`, the desktop account can no longer open it. **Why v0.33.0 does not prevent it.** `perms::restrict_to_owner` (`crates/indexer/src/perms.rs`) puts a PROTECTED DACL on every index file. It grants full access to OWNER RIGHTS, SYSTEM and the token user's SID. That fixes the single-account case, where an elevated and a non-elevated session of the same user share a SID. For two accounts it shuts the second account out by construction. v0.33.0 turns the symptom into a permanent `index_unavailable_permission` refusal with the repair (`icacls <dir> /reset /T`, or rename `.code-index`), but the lockout still happens. **Rule:** the index must be no more private than the project folder it was built from. Anyone who can read the source can read its index. - On Windows, files under `.code-index/` should INHERIT the project folder's ACL. No protected owner-only DACL. That covers `index.db`, `-wal`, `-shm`, `daemon.*` and `languages.toml`. - Existing indexes that already carry the protected DACL must be repaired on open, whenever the opening process is allowed to change the DACL. That is a one-time inherit reset. **Also check:** - Unix has the same shape (`0600` files in a folder shared by a group). Decide it explicitly: either keep it, and say so, or follow the folder's mode. - `doctor` reports the condition. **Tests:** - Windows: a file created with the new rule has no protected DACL and carries the parent's inherited ACEs. - An index carrying the old owner-only DACL is reset when opened by its owner. - The `index_access_denied_e2e` refusal still holds when a folder genuinely denies the user. Target: v0.33.1, right after v0.33.0.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
h-dv/code-index#317
No description provided.