bzr clobbers file owner and group
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Bazaar |
Confirmed
|
Low
|
Unassigned |
Bug Description
create a file, assign it a different user and/or group than yours. Edit it. use bzr shelve to revert those changes. By now the ownership is clobbered.
Expected:
the group and user and all permissions stay the same.
Cause:
stracing "bzr unshelve" (I guess bzr shelve will behave the same), I see:
rename(
rename(
That's wrong, it should open the existing file and replace the contents instead. Copying clobbers the ownership, and the ownership can often not be changed (chown and chgrp require escalated permissions for some uid/gid).
Tested against bzr 2.3.4:
$ bzr --version
Bazaar (bzr) 2.3.4
Python interpreter: /usr/bin/python 2.6.5
Python standard library: /usr/lib/python2.6
Platform: Linux-2.
bzrlib: /usr/lib/
$ cat /etc/issue
Ubuntu 10.04.3 LTS \n \l
$ uname -a
Linux <censored> 2.6.35.4-rscloud <censored> SMP Mon Sep 20 15:54:33 UTC 2010 x86_64 GNU/Linux
This bug could be a security vulnerability because it changes the owner and group of the files affected. This could make the files accessible to users who shouldn't have access, a typical privilege escalation problem.
summary: |
- bzr shelve clobbers file owner and group + bzr clobbers file owner and group |
tags: | added: check-for-breezy |
in the above steps, i think you need to add and commit the file before editing it for bzr shelve to catch it, but you probably should know that.
bzr unshelve does the same, by the way:
1. create file (and probably add+commit it)
2. edit it
3. bzr shelve
4. chown or chgrp
5. bzr unshelve
by now the ownership data is overwritten with, again, your own user/group.
I'm not sure if I should make this a separate bug.