darcs

Patch 1634 Resolve issue2537: Allow / as root directory

Title Resolve issue2537: Allow / as root directory
Superseder Nosy List gpiero
Related Issues Allow / as root directory
View: 2537
Status rejected Assigned To
Milestone

Created on 2018-01-06.12:35:49 by gpiero, last changed 2023-02-16.18:28:43 by bfrk.

Files
File name Status Uploaded Type Edit Remove
resolve-issue2537_-allow-_-as-root-directory.dpatch gpiero, 2018-01-06.12:35:47 application/octet-stream
See mailing list archives for discussion on individual patches.
Messages
msg19818 (view) Author: gpiero Date: 2018-01-06.12:35:47
I don't know how to safely test it via a shell script in tests/, so if
someone
versed in Haskell unit testing could add a test checking something like
makeSubPathOf (AbsolutePath "/") (AbsolutePath "/dir") = Just (SubPath
"dir")
...
Attachments
msg19823 (view) Author: gpiero Date: 2018-01-18.19:01:17
It occurred to me that this patch possibly doesn't work or could even do 
harmful things in Windows, depending on how file paths are represented.
More specifically:

1. if absolute paths are in the form '/<volume>/<path>' (unlikely, I 
think), this patch does evil things(tm), like considering '/D/file' to 
be part of '/C/' repo.

2. if absolute paths are in the form '<volume>:\<path>' and the root of 
a repo created in the top dir of a volume is '<volume>:\', i.e.: 
'C:\file' and 'C:\' respectively, this patch fixes the problem on POSIX 
but the issue still stands on Windows.

3. if absolute paths are in the form '<volume>:\<path>' and the root of 
a repo created in the top dir of a volume is '<volume>:', i.e.: 
'C:\file' and 'C:'(note the lack of slash) respectively, this patch 
fixes the problem on POSIX. The issue was not present on Windows nor 
this patch introduces a regression.

My guess is the right answer is the number 2, but I would be grateful if 
someone could create a repo on the top dir of a volume and let me know 
the content of the 'Root:' line in the output of `darcs show repo`.

Thanks,
Gian Piero.

PS: 'direction' (forward or backward) of the slashes is irrelevant as, 
if I've read correctly the code, all backward slashes are transformed to 
forward ones before comparing the paths.
msg19863 (view) Author: gh Date: 2018-02-09.17:36:46
As mentionned by GianPiero in http://bugs.darcs.net/patch1634 , a fix
for this shall be tested to work well under both Linux/Unixes and Windows.
msg20635 (view) Author: bfrk Date: 2019-01-24.15:35:29
No follow-ups since almost a year. Besides, I think it is a bad idea to
allow that for obvious security reasons.
msg23066 (view) Author: gpiero Date: 2022-12-31.16:01:16
Resurrecting a very old thread...

* [Thu, Jan 24, 2019 at 03:35:29PM +0000] Ben Franksen:
>No follow-ups since almost a year. Besides, I think it is a bad idea to
>allow that for obvious security reasons.

I'm not complaining about the rejection of the patch, and I still 
neither have nor plan to have access to a Windows machine, so I've given 
up on this.

Anyway I do not agree that there's a security risk specifically arising 
from running darcs on the root. I'm pretty sure you're thinking about 
running it as the root user, but that's a privileges issue that also 
affect, e.g. /etc. In other worlds, I do not think there are security 
problems that could only show when running darcs on the root dir and do 
not manifest themselves in any other directories.
msg23076 (view) Author: bfrk Date: 2023-01-07.12:01:53
I agree that managing "/" with a VCS is not *necessarily* a security 
risk per se. Can you come up with a hypothetical scenario where I 
would want to do that on purpose?
msg23089 (view) Author: gpiero Date: 2023-02-07.16:34:59
* [Sat, Jan 07, 2023 at 12:01:53PM +0000] Ben Franksen:
>I agree that managing "/" with a VCS is not *necessarily* a security
>risk per se. Can you come up with a hypothetical scenario where I
>would want to do that on purpose?

According to OP, it was in order "to track changes to an
operating system" [http://bugs.darcs.net/msg19805].
msg23092 (view) Author: falsifian Date: 2023-02-10.23:22:45
I've thought about using version control to directly manage config files (mostly in /etc) but haven't actually tried doing it. I'm not necessarily advocating for the patch; just came across this thread.
msg23097 (view) Author: bfrk Date: 2023-02-16.12:42:35
Hm, so the idea is to support something like etckeeper but not limited 
to /etc. That might indeed work. Let's reopen this if and when there 
is actual demand for this.
msg23099 (view) Author: bfrk Date: 2023-02-16.18:28:41
makeSubPathOf is no longer used for this, so the patch doesn't work 
anyway. Instead we now have makeRelativeTo and that works just fine 
with "/". Ineed I tested manually that the issue is fixed with current 
screened.
History
Date User Action Args
2018-01-06 12:35:49gpierocreate
2018-01-18 19:01:18gpierosetmessages: + msg19823
2018-01-19 07:28:00gpierosetstatus: needs-screening -> in-discussion
2018-02-09 17:35:49ghsetissues: + Allow / as root directory
2018-02-09 17:36:46ghsetmessages: + msg19863
2019-01-24 15:35:29bfrksetstatus: in-discussion -> rejected
messages: + msg20635
2022-12-31 16:01:17gpierosetmessages: + msg23066
2023-01-07 12:01:53bfrksetmessages: + msg23076
2023-02-07 16:35:02gpierosetmessages: + msg23089
2023-02-10 23:22:48falsifiansetmessages: + msg23092
2023-02-16 12:42:38bfrksetmessages: + msg23097
2023-02-16 18:28:43bfrksetmessages: + msg23099