The rules and connection database isn't protected from other accounts on the Mac the way the Insights store is

Open
#290 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
57/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
sqlite, swift
Domain
database, security

Research direction

Read Sources/Shared/RuleStore.swift:100-107 alongside Sources/Helper/InsightsStore.swift:400-450 to trace how the main store is created and how the Insights store enforces permissions. Check the installed database and its sidecar file modes on macOS, then update the store handling so existing installs are tightened on helper start and startup fails if root-only access cannot be ensured. Done when the folder, database, and sidecars are root-readable only.

Written by the indexing model from the issue text.

Description

area:shared bug priority:high status:queued type:security

The Insights store locks itself down: its folder is created with mode 700 and its files with 600, and it refuses to open anything else (Sources/Helper/InsightsStore.swift:127, :164, :405-450).

The main database gets none of that. RuleStore.init creates the folder with try? FileManager.default.createDirectory(atPath: dir, withIntermediateDirectories: true) and opens the file with a plain sqlite3_open(path, &db) (Sources/Shared/RuleStore.swift:100-107). No mode is set and none is checked, so the folder and the file get whatever the helper's default umask gives them. For a launchd daemon that is normally readable by everyone.

That database holds every rule, the profiles, the blocklists and the recorded connections (app, destination, time).

Steps

  1. Install FreeSnitch and let it record connections.
  2. Log in as another, non-admin account on the same Mac.
  3. Check whether that account can read /Library/Application Support/FreeSnitch/freesnitch.sqlite and its -wal file.

Where

  • Sources/Shared/RuleStore.swift:100-107
  • Sources/Helper/InsightsStore.swift:400-450 (how the Insights store does it)

Done when: the main database, its sidecar files and its folder are readable by root only, existing installs are tightened on the next helper start, and the helper refuses to use the store if it can't make that true.

I found this reading the code and haven't reproduced it on a signed build yet: the actual file modes on an installed Mac still need checking.

Dominant language
Swift
Stars
49
Forks
5
Avg merge
16h 48m
Merged PRs (30d)
82

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from isaaclins/freesnitch

All issues in isaaclins/freesnitch

Similar issues

More Swift issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.