Skip to content

Non-unix fallback for .sc/local-key permissions (P33 follow-on) #214

Closed

Description

@tonibergholm

.sc/local-key is created 0600 from the first byte through a unix-only OpenOptions::mode call (crates/repo/src/cache.rs, write_key_0600). There is no non-unix path, so on a non-unix target the key file is left with default permissions, which may be world-readable. Deferred in ROADMAP.md (P33).

The key keys the protected-cache tag PRF, so leaking it lets a local reader test guesses against cached plaintext tags.

Needs a Windows environment to verify. Options: restrict the file ACL to the current user (via a small, justified dependency or icacls-free API calls), or refuse to create the key and run cacheless (spurious re-seals, never incorrect) when permissions cannot be set.

Acceptance criteria

  • On Windows the key file is readable only by the current user, or the cache is disabled with a clear warning.
  • A test that runs on the Windows CI target, if one exists; otherwise a documented manual check.
  • THREAT-MODEL.md notes the platform behavior.

Activity

  1. tonibergholm-codento commented on Oct 20, 2026

    @tonibergholm-codento
    Collaborator

    Amended framing (PR #225): the original cacheless idea was rejected because it makes status and the clean-tree gates refuse for non-unix users with protected files. #225 instead keeps the key and caches on non-unix with inherited default permissions and prints a one-time warning once a cache holds a protected entry. Checkout already writes protected plaintext with default permissions on every platform, so the added exposure is small (see THREAT-MODEL.md). Remaining, so this issue stays open: an owner-only Windows ACL (windows-sys is already a transitive dep) and a manual permissions check on a real Windows host. Neither is verified from the macOS dev environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions