-
Notifications
You must be signed in to change notification settings - Fork 18
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
Bug 1899701 - Add home-read-all plug #62
base: nightly
Are you sure you want to change the base?
Conversation
Add a 'home-read-all' plug that sets the 'read' attribute for the 'home' interface to the special value 'all', to allow the Firefox snap to read files in the user's home directory that are owned by another user but that the current user should still be able to read via group membership. Note: 'read: all' technically allows reading the home directory of any user, but per snapd folks that's as granular as we can get because AppArmor does not have per-user profiles. https://bugzilla.mozilla.org/1899701 https://snapcraft.io/docs/home-interface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is correct and in line with my understanding of what the issue is and how to avoid it. A non-root user won't be gaining any extra permissions through this, as DAC is still in effect.
To be precise: the home interface uses @{HOME} apparmor parser variable, which expands to /home/*, which is true for both variants (read and read:all). What all does is it drops the owner constraint. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been tagged so I'm going to comment but restrain from voting since I don't feel like I understand enough the situation to give an informed opinion.
The change seems fine to me so if snapd/security team are +1 that works for me.
It seems a bit suboptimal/hackish to have to do that though. If there is no downside to the change shouldn't it just be the default? It feels like that issue of 'can't open a file it should be able to` is just going to impact any snap trying to access content no?
Hum, also reading the documentation it states
isn't that going to be an usability regression? |
We need to restore the auto-connection through the store. |
I wonder if I'm missing something finer in the security model but I agree with this opinion. CC @alexmurray |
I tend to agree that the use of I suspect this restriction was added due to the fact that AppArmor doesn't actually know the users real home directory, ie it defines However as @zyga said, we still have DAC which would then block such access (unless other users have explicitly opted in to making their files readable OR they installed Ubuntu before we introduced private home dirs in 21.04). Which means that if we remove the But this is no different than that user directly reading those same files and providing them to the snap etc. So I do not think there is a huge risk here. Personally, I feel we lose more in terms of usability by the use of So for the purpose of firefox, +1 from me for this change. @bandali0 please can you open a corresponding topic on the snapcraft forum so we can start the ball rolling on discussing granting this from the store side to ensure the |
Many thanks all for your comments and explanations. @alexmurray Ack, done: Request for auto-connection of 'home' with 'read: all' for Firefox snap Thanks again. |
I don't object to firefox having the home-read-all access as it has its own sandbox and is defensively programmed and this seems to solve a real issue for users. As for historical context, when the home interface was defined, we were thinking about a few things: that snaps can run on all kinds of systems (not just Ubuntu and not just systems with restricted HOME of 0700) and that AppArmor had limited options for restricting access (eg, only had glob syntax, owner and tunables to work with). Portals wasn't yet a thing nor was apparmor prompting, a All considered,
Altogether, the home interface might spit out rules like (eg, in
This is still not perfect, but somewhat better in terms of usability (without portals and prompting). It certainly would require more thought than I just gave it (most importantly, ensuring that when users are added/deleted/modified that the corresponding per-user profiles are created). Better would be for the kernel to maintain the user/home mapping so we don't need per-user profiles (eg, add the Hope this helps! |
Thanks for the context @jdstrand - I really appreciate it. The is work ongoing in AppArmor to support per-user rules in AppArmor profiles (this actually comes out of the prompting work) which the parser translates into appropropriate UID checks on the subject IIRC (@jrjohansen will correct me if I am wrong on the details here ;)) so once that lands we may be able to make use of it in snapd to make the |
So @alexmurray remembers correctly, you will be able to do several different things. You won't even have to have the whole thing to do what we are discussing. The
That is the ordering that the extensions should land with 1 coming first, followed by 2, ... |
@seb128 Can we land this ? |
Add a
home-read-all
plug that sets theread
attribute for thehome
interface to the special valueall
, to allow the Firefox snap to read files in the user's home directory that are owned by another user but that the current user should still be able to read via group membership.Note:
read: all
technically allows reading the home directory of any user, but per snapd folks that's as granular as we can get because AppArmor does not have per-user profiles.@seb128 I tried your suggestion for a potential alternative workaround of opening the file using Firefox's open file dialog, and it failed the same way (Firefox doesn't seem to try to use the document portal).
@alexmurray would you please review this? I imagine I'd then need to submit a store request for a formal review/approval once we've merged this and uploaded a build with it to the store.
/cc @lissyx @zyga
https://bugzilla.mozilla.org/1899701
https://snapcraft.io/docs/home-interface