Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/immich: restrict media filesystem permissions #361627

Merged
merged 1 commit into from
Dec 11, 2024

Conversation

Ralith
Copy link
Contributor

@Ralith Ralith commented Dec 4, 2024

immich appears to create this directory with permissions 0755 by default, which needlessly exposes user data to other processes.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 labels Dec 4, 2024
Copy link
Member

@dotlambda dotlambda left a comment

Choose a reason for hiding this comment

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

We should rather set serviceConfig.UMask.

@Ralith
Copy link
Contributor Author

Ralith commented Dec 6, 2024

That does seem more elegant, but will it fix up existing installations? Seems like a shame to leave some unknown number of users with world-readable data.

@dotlambda
Copy link
Member

dotlambda commented Dec 7, 2024

will it fix up existing installations?

I don't think we should mess with existing installations. What if someone manually adjusted the permissions?
Maybe just add a changelog entry?
EDIT: Actually, this is probably fine. But let's hear the opinion of the other Immich maintainers.

nixos/modules/services/web-apps/immich.nix Outdated Show resolved Hide resolved
nixos/modules/services/web-apps/immich.nix Outdated Show resolved Hide resolved
nixos/modules/services/web-apps/immich.nix Outdated Show resolved Hide resolved
@Ralith
Copy link
Contributor Author

Ralith commented Dec 8, 2024

Applied suggestions. Does also excluding group permissions serve a security purpose, or is it just on principle of minimizing surface area?

@dotlambda
Copy link
Member

Does also excluding group permissions serve a security purpose, or is it just on principle of minimizing surface area?

I guess it's the latter. I'm just following what most other NixOS services with a umask do.

immich appears to create this directory with permissions 0755 by
default, which needlessly exposes user data to other processes.
@dotlambda
Copy link
Member

@ofborg test immich

1 similar comment
@dotlambda
Copy link
Member

@ofborg test immich

@dotlambda dotlambda merged commit d55cc46 into NixOS:master Dec 11, 2024
23 of 25 checks passed
@Scrumplex Scrumplex mentioned this pull request Dec 17, 2024
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants