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

Grant KeePassXC access to its config directory #5453

Closed
wants to merge 1 commit into from

Conversation

WhyNotHugo
Copy link
Contributor

Without this, KeePassXC can't save its config and it gets reset on each run.

Without this, KeePassXC can't save its config and it gets reset on each
run.
Copy link
Collaborator

@rusty-snake rusty-snake left a comment

Choose a reason for hiding this comment

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

This will break a lot to everything.

Please test your changes.

keeassxc.profile is intentional a non-whitelisting profile. If you want to change this, you first have to say why and second do it correct.

@WhyNotHugo
Copy link
Contributor Author

keeassxc.profile is intentional a non-whitelisting profile

I though that if a single whitelistdirective was present, then the profile was a whitelisting profile.

@WhyNotHugo
Copy link
Contributor Author

Please test your changes.

Works perfect for me. I'd love to hear how this breaks other things.

@rusty-snake
Copy link
Collaborator

Where is your database stored? In ~/.config/keepassxc? In /mnt?

@WhyNotHugo
Copy link
Contributor Author

Where is your database stored? In ~/.config/keepassxc? In /mnt?

In ~/keepassxc, which is present in my keepassxc.local.

@rusty-snake
Copy link
Collaborator

Also at a bare minimum you could have looked at the profile and see that there are other paths like ~/.cache/keepassxc.

@WhyNotHugo
Copy link
Contributor Author

Also at a bare minimum you could have looked at the profile and see that there are other paths like ~/.cache/keepassxc.

Please continue, I honestly don't know where this is going.

@WhyNotHugo
Copy link
Contributor Author

Do you want me to include the cache path here too?

@rusty-snake
Copy link
Collaborator

In ~/keepassxc, which is present in my keepassxc.local.

You see the issues? Everyone will require your keepassxc.local.

You need to test this profile, without other modifications.

@WhyNotHugo
Copy link
Contributor Author

You see the issues? Everyone will require your keepassxc.local.

What's the alternative? Grant keepassxc access to all of $HOME?

@WhyNotHugo
Copy link
Contributor Author

If keepass had a "standard" location for its files, I'd use that, but it doesn't.

@rusty-snake
Copy link
Collaborator

What's the alternative? Grant keepassxc access to all of $HOME?

Yes. That's what we currently do. If you want to change this, you need to argue why. And how this can be done without to much breakage.

@rusty-snake
Copy link
Collaborator

Also your PR title is wrong because keepassxc already has access to it's config directory.

@WhyNotHugo
Copy link
Contributor Author

If we're going to grant unrestricted access to $HOME, then why are we sandboxing?

@kmk3
Copy link
Collaborator

kmk3 commented Nov 5, 2022

@WhyNotHugo commented on Nov 5:

keeassxc.profile is intentional a non-whitelisting profile

I though that if a single whitelistdirective was present, then the profile
was a whitelisting profile.

A "whitelisting profile" usually means a profile that whitelists something in
the home directory (as opposed to not whitelisting anything or whitelisting
things in system directories).

This distinction is made because while system paths can mostly be known ahead
of time, users may organize their home directories in very different ways, so
it is not always viable to create a whitelisting scheme in the default profile
that would work by default for all users.

Which is why whitelisting profiles are usually made sparingly.

In this case, if a user puts their database in ~/ or ~/Documents (which are
arguably likely to be common places for that), this PR would break keepassxc
for them.

@WhyNotHugo
Copy link
Contributor Author

I'm fine with adding ~/Documents to this PR too. Not sure about ~ tho; that pretty much negates the filesystem aspect of the sandboxing.

@rusty-snake
Copy link
Collaborator

rusty-snake commented Nov 5, 2022

If we're going to grant unrestricted access to $HOME

  1. It's not unrestricted, there's still disable-commonc.inc+disable-programs.inc
  2. You can harden the profile as much as you like and it contains instructions to do so but we can not enabled them by default.
    • Did you read the comment? It already contains you line.

@rusty-snake
Copy link
Collaborator

then why are we sandboxing?

This is up to you.

In the Thread Model of the most of use you will not need to sandbox it because KeePassXC is likely a trusted component as it has access to all your passwords and secrets.

@WhyNotHugo
Copy link
Contributor Author

Huh, indeed, with a clean profile all of $HOME is accessible. I must have mistrusted and had another issue when setting this up.

It's still quite trivial to escape the sandbox (e.g.: edit neovim's startup file and tell it to execute arbitrary commands), but that's not the scope of this issue.

Sorry for the noise, thanks for the clarifications.

@WhyNotHugo WhyNotHugo closed this Nov 5, 2022
@rusty-snake
Copy link
Collaborator

then why are we sandboxing?

Why do we sandbox if >50% of profiles can be escaped?

@WhyNotHugo WhyNotHugo deleted the keepassxc-config-dir branch November 5, 2022 12:15
@WhyNotHugo
Copy link
Contributor Author

Why do we sandbox if >50% of profiles can be escaped?

I'd assume we both want to reduce that number as much as possible. The fact that there is a clear escape mechanism for KeePassXC (as documented above) kinda negates a lot of its use.

On the topic of hardening this profile, how about:

tmpfs ${HOME}/.config/
whitelist ${HOME}/.config/keepassxc

Wouldn't this effectively result in $HOME/.config only containing the keepassxc subdirectory?

@rusty-snake
Copy link
Collaborator

This is also the case w/o the tmpfs.

@kmk3
Copy link
Collaborator

kmk3 commented Nov 5, 2022

@WhyNotHugo commented on Nov 5:

On the topic of hardening this profile, how about:

tmpfs ${HOME}/.config/
whitelist ${HOME}/.config/keepassxc

Wouldn't this effectively result in $HOME/.config only containing the
keepassxc subdirectory?

If you actually tried your suggestion before posting it, you would have your
answer:

$ firejail --quiet --noprofile \
  --tmpfs='${HOME}/.config' \
  --whitelist='${HOME}/.config/keepassxc' find | LC_ALL=C sort
.
./.Xauthority
./.asoundrc
./.bashrc
./.config
./.inputrc

@WhyNotHugo
Copy link
Contributor Author

Is there any way to mount ${HOME}/.config/keepassxc inside ${HOME}/.config if I'm using tmpfs ${HOME}/.config/?

I think the intent of what I'm trying to do here is obvious: mount an empty tmpfs in .config and mount the external .config/keepassxc inside that tmpfs.

I'm basically looking for something like bubblewrap's --bind.

@WhyNotHugo
Copy link
Contributor Author

This is also the case w/o the tmpfs.

The whitelist mounts the tmpfs on the top level directory, so $HOME would be empty too.

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.

None yet

3 participants