Pacman

Historical bug tracker for the Pacman package manager.

The pacman bug tracker has moved to gitlab:
https://gitlab.archlinux.org/pacman/pacman/-/issues

This tracker remains open for interaction with historical bugs during the transition period. Any new bugs reports will be closed without further action.
Tasklist

FS#8906 - Sp removes user:password@ from URLs

Attached to Project: Pacman
Opened by Roman Kyrylych (Romashka) - Wednesday, 12 December 2007, 13:13 GMT
Last edited by Dan McGee (toofishes) - Friday, 29 February 2008, 13:39 GMT
Task Type Bug Report
Category General
Status Closed
Assigned To Aaron Griffin (phrakture)
Dan McGee (toofishes)
Architecture All
Severity Low
Priority Normal
Reported Version git
Due in Version 3.2.0
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Summary and Info:
pacman -Sp produces URLs without user:password@ part, rendering them invalid.

Steps to Reproduce:
use Server = user:password@some-server.org/blahblah in pacman.conf
run pacman -Sp somepackage
see that URLs are without user:password@
trying to feed this URL to wget results in 401 Authorization Required.
This task depends upon

Closed by  Dan McGee (toofishes)
Friday, 29 February 2008, 13:39 GMT
Reason for closing:  Fixed
Additional comments about closing:  f159203f6fb217bb7bed5ffea8c2518325a9ec12
Comment by Aaron Griffin (phrakture) - Wednesday, 12 December 2007, 16:35 GMT
This was kinda done on purpose. -Sp can be called by anyone, whereas the pacman.d files may be locked down with special (600) permissions. I consider adding user/pass a security hole.

It's not specified that -Sp url's are to be used with wget, and if they are, it's up to you to authenticate.

Dan, unless you feel otherwise, I'd like to close this with a "Won't Implement"
Comment by Dan McGee (toofishes) - Wednesday, 12 December 2007, 17:32 GMT
-Sp is a hack...

But no, you can't really lock down the files with 600 permissions that I know of, considering every pacman operation (whether it uses them or not) loads the server list.

I might agree with the won't implement logic here.
Comment by Roman Kyrylych (Romashka) - Thursday, 13 December 2007, 10:58 GMT
OK, I'm fine with "Won't Fix" here.
With 600 permissions on /etc/pacman.d this indeed may be treated as a security hole, though Server can be setup in pacman.conf as well.
At the moment I'm using simple sed to change the generated -Sp output.
Comment by Nagy Gabor (combo) - Thursday, 13 December 2007, 13:09 GMT
Well, 'are you root?' check probably could be done before trans_commit [it would be also a code-clearer to move "HDD manipulator" things behind _commit, and thus we would win some kind of --simulate option ;-]
Pro:
-user can play with not-modify-anything stuffs in libalpm
Contra:
-user get delayed 'operation not permitted' error
Comment by Aaron Griffin (phrakture) - Thursday, 13 December 2007, 16:55 GMT
Nagy, how does this pertain to the -Sp issue? I don't follow
Comment by Nagy Gabor (combo) - Friday, 14 December 2007, 11:22 GMT
Ooops. I wrote this in the wrong thread (-Sp allowed only to root)

I want to write here this;-):
I don't understand you. Pacman doesn't operate at all, if it cannot read any of the config files (as Dan said), even the included ones (mirrorlist). So this hide password "feature" seems to be useless, because if pacman can read mirrorlist, then also user can.
Comment by Nagy Gabor (combo) - Friday, 14 December 2007, 11:45 GMT
Indeed, in this case that would be useful, if pacman didn't hang on "cannot include foo to pacman.conf", just give a warning. But you can see, that "if pacman can read mirrorlist, then also user can" still holds.
Comment by Aaron Griffin (phrakture) - Friday, 14 December 2007, 17:31 GMT
Correct. While pacman CURRENTLY hangs on that, it doesn't change my opinion on this feature.

How about this:
Allow 'Include' files to fail and continue, but ONLY on Include files
Output URLs with user@domain, but no password

Does this sound like a fair compromise?
Comment by Dan McGee (toofishes) - Friday, 14 December 2007, 19:18 GMT
It sounds like feature bloat to me. What good is a url without username@domain/password anyway, if one is needed?

I think we should not merge problems here. The bug at hand is a BUG- we produce invalid URLs with pacman -Sp output. That must be fixed for us to continue, and it has no bearing on whether the server was listed in pacman.conf or in an include file.

The feature request you are proposing should be filed seperately, something to the extent of "don't allow underprivileged users to have access to mirrorfiles with usernames and passwords". In that case, we still wouldn't filter usernames/passwords out of URLs, as that server would never even be shown if it is never read by the config loading code. If a user does run pacman as root, then they probably want a working URL.
Comment by Nagy Gabor (combo) - Friday, 14 December 2007, 22:15 GMT
I summarize my opinion again:
1. Aaron: filtering URLs (and anything from config file) is simply useless imho, because if you filter something, then this means that you _could_ read it, and if you could read it, then the current "uid" of pacman also can reach that "secret" information (by opening that config file by hand, or compile a patched pacman etc. etc.), so filtering of this content is simply needless (or at least a weak "protection")
2. Dan: I agree with you here, the Include problem is an other story (maybe this would worth an other task). I simply suggested that pacman shouldn't fail on include error, let me show an example:
Include = /etc/pacman.d/secret-mirrors (readable by root only)
Include = /etc/pacman.d/common-mirrors
By doing this, non-root users simply cannot see those mirrors (however, in most cases normal users needn't see any mirrors), and maybe there are some other secret informations where this would be useful (but probably not).
Comment by Aaron Griffin (phrakture) - Friday, 14 December 2007, 22:23 GMT Comment by Nathan Jones (nj) - Friday, 14 December 2007, 23:49 GMT
Here's a patch which should fix this. I also threw in the port for good measure. alpm_db_get_url is only used in one place, so it shouldn't affect anything else.

Here's what the output looks like if no username and password is specified:
guest@mirror.cs.vt.edu/pub/ArchLinux/community/os/i686/xmms-1.2.11-1.pkg.tar.gz"> ftp://anonymous:libalpm@guest@mirror.cs.vt.edu/pub/ArchLinux/community/os/i686/xmms-1.2.11-1.pkg.tar.gz
Comment by Aaron Griffin (phrakture) - Friday, 14 December 2007, 23:54 GMT
Nice, that works. I'm just... ugh, I don't like it, but there's not much we can do about it if it's what people want. Whenever i see a "password" in a printf, I cringe.

Loading...