Skip to content

[P1][OCR] Harden private file durability and directory permissions #49

Description

@Ryder-Sun

Source: OCR_ANALYSIS_REPORT.md, OpenCode Review report generated on 2026-08-12.

Findings: M-1, M-2. desktop/src/security/private-file.cjs writes private files atomically, but the OCR report flags two durability/security gaps: parent directories are not fsynced after rename, and existing directories may retain overly broad permissions because mkdirSync(..., mode: 0o700) only applies to newly created directories.

Expected fix:

  • After atomic rename, fsync the parent directory where supported.
  • Explicitly enforce 0o700 permissions on existing private directories.
  • Keep behavior portable across macOS, Linux, and Windows.
  • Add tests for pre-existing broad directory permissions and successful durable replacement.

Activity

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

    bugSomething isn't workingpriority:p1Core product or architecture prioritysecuritySecurity, permissions, credentials, or supply-chain boundary

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions