Skip to content

fix(module): allow sqlite db writes to ~/.local/share/revue - #2

Merged
kleinbem merged 3 commits into
mainfrom
fix/db-readwrite
Nov 4, 2026
Merged

kleinbem merged 3 commits into
mainfrom
fix/db-readwrite

Conversation

@kleinbem

@kleinbem kleinbem commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

When services.revue.user is configured and ProtectHome = 'read-only', SQLite writes to the default database location at ~/.local/share/revue/revue.db fail with attempt to write a readonly database. Add /home/${cfg.user}/.local/share/revue to ReadWritePaths.

Summary by CodeRabbit

  • Bug Fixes
    • The service can now write to the user’s local Revue storage directory as well as its Gemini storage directory.
    • Revue data is stored in the local directory configured for the service, alongside the existing Gemini data. The directory is created with user-specific ownership and permissions when a service user is configured.

When user is set and ProtectHome is 'read-only', SQLite writes to the
default database at ~/.local/share/revue fail with attempt to write a
readonly database. Add ~/.local/share/revue to ReadWritePaths.
@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Explain Change →

Walkthrough

When cfg.user is set, the module creates /home/${cfg.user}/.local/share/revue and configures the service to write to it. The service sets REVUE_DATA_DIR to that directory.

Changes: Configured-user service

Layer / File(s) Summary
Configure Revue data access
nix/module.nix
The module creates the Revue data directory with mode 0750 and ownership based on cfg.user and cfg.group. The service adds the directory to ReadWritePaths and sets REVUE_DATA_DIR to its path.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Merge Risk: Minimal · up to 8f052

No confirmed actionable risk remains in the current change.

Security architecture risk: Low · up to 8f052

The added write access is narrowly scoped, and existing sandbox controls remain enabled. No introduced vulnerability was established, but activation ordering, effective database permissions, and upgrades from another database location remain deployment-dependent.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The declared authority increase is a writable Revue directory for the configured service identity on the host. It does not grant a new identity or intentionally make the entire home writable; effective filesystem exposure still depends on deployed path resolution and permissions.

Trust Boundaries and Controls

  • observed — ProtectSystem=strict, ProtectHome=read-only, NoNewPrivileges, and PrivateTmp remain enabled for the configured-user service. Directory ownership matches its User and Group. Database availability does not determine webhook-secret resolution in the inspected startup flow.

Resilience and Maintainability Implications

  • observed — The module declares directory creation separately from service startup and explicitly orders the service only after network.target. This does not establish a missing effective dependency: generated NixOS ordering and activation evidence were unavailable, so first-activation and upgrade readiness remain unverified.

Hardening Proposals

  • proposed — Where stored review data must be private to the service account, consider an owner-only directory and restrictive service umask, or a dedicated group with verified membership. This is a hardening option, not a verified disclosure finding.
Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly identifies the main change: allowing SQLite database writes to ~/.local/share/revue through the module update.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)

Finishing Touches
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Fix comments: Fix CodeRabbit comments on this PR

Comment thread nix/module.nix Resolved

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Fix comments: Fix CodeRabbit comments on this PR

Comment thread nix/module.nix Resolved
@kleinbem
kleinbem enabled auto-merge (squash) November 4, 2026 10:34

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional comments: 1
nix/module.nix-58-60: 1

58-60: Minor · Functional Correctness · Quick win

Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

Preserve ownership of the parent directories.

If /home/${cfg.user}/.local/share does not exist, this leaf-only rule causes systemd-tmpfiles to create the parent directories as root:root with mode 0755. Only revue receives ${cfg.user} ownership. (freedesktop.org)

The service user can write the Revue directory but cannot create other entries under .local/share. Add explicit parent rules with the configured owner and group, while leaving existing modes unchanged.

Proposed fix
     systemd.tmpfiles.rules = lib.mkIf (cfg.user != null) [
+      "d /home/${cfg.user}/.local - ${cfg.user} ${if cfg.group != null then cfg.group else "users"} -"
+      "d /home/${cfg.user}/.local/share - ${cfg.user} ${if cfg.group != null then cfg.group else "users"} -"
       "d /home/${cfg.user}/.local/share/revue 0750 ${cfg.user} ${if cfg.group != null then cfg.group else "users"} -"
     ];
Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Central YAML; Path: .coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8996fffd-f1bf-45b1-a6dd-c0f1e08d741a
Commits

Reviewing files that changed from the base of the PR and between a65e3ab and 8f05297.

Files selected for processing: 1
  • nix/module.nix

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@kleinbem
kleinbem merged commit 3275698 into main Nov 4, 2026
5 checks passed
@kleinbem
kleinbem deleted the fix/db-readwrite branch November 4, 2026 10:44
kleinbem added a commit to kleinbem/nix-config that referenced this pull request Nov 4, 2026
…rmissions

Upstream kleinbem-dev/revue#2 provides the systemd tmpfiles rule and
ReadWritePaths for ~/.local/share/revue directly. Bump the flake input to
include this fix.
kleinbem added a commit to kleinbem/nix-config that referenced this pull request Nov 4, 2026
…525)

When `services.revue.user` is set to `martin` and `ProtectHome =
'read-only'`, revue cannot write to its default database at
`~/.local/share/revue/revue.db`, failing with `attempt to write a
readonly database`.

Grants write access to `/home/martin/.local/share/revue` pending
upstream module fix: kleinbem-dev/revue#2

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Fixed the Revue daemon’s access to its data directory, allowing it to
write its files successfully.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant