discuss@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Ingo Schwarze <schwarze@usta.de>
To: Kristaps Dzonsons <kristaps@bsd.lv>
Cc: discuss@mdocml.bsd.lv
Subject: Re: makewhatis and homebrew
Date: Tue, 9 Dec 2014 15:25:12 +0100	[thread overview]
Message-ID: <20141209142512.GB327@iris.usta.de> (raw)
In-Reply-To: <5486E96D.5020001@bsd.lv>

Kristaps Dzonsons wrote on Tue, Dec 09, 2014 at 01:22:05PM +0100:

> When I'm forced to use OS X, I'm forced to use  "homebrew" to manage
> software.  What this does is, instead of installing software, it
> links the software to a magical location, e.g.,
> 
> /usr/local/share/man/man1/itstool.1@ ->
> ../../../Cellar/itstool/2.0.2/share/man/man1/itstool.1

Yikes.

Specifically designed to be insecure:

  /usr/local/share/man/man1/mostly_harmless@->
  ../../../../../etc/master.passwd

> These manuals don't appear anywhere in man(1) now because they're
> outside of the chdir.  In fact, when I run makewhatis with -p, I see
> many more of these from the base system installation:
> 
> /usr/share/man/: /System/Library/Frameworks/JavaVM.framework/Versions/A/Resources/Documentation/man/jstat.1:
> outside base directory
> 
> (Which is linked from /usr/share/man/man1/jstat.1.)
> 
> ...etc.
> 
> Is there a way to relax this constraint,

Deleting the five lines

	if (strstr(buf, basedir) != buf) {
		if (warnings) say("",
		    "%s: outside base directory", buf);
		continue;
	}

should just work.  The file will be treated as if it resided at the
place where the symlink was found.

Note, though, that this is not a functionality check,
but a *security* check you are deleting, so we cannot
possibly commit it to the repository.  If it works,
we could introduce a compile time switch (with a big red
warning) to allow it, if you consider that helpful.

> or would that break
> anything further into the parse sequence, i.e., so's?

Well, .so is fragile in the first place, and this madness is
certainly not making it any better.  I hope those crazy people
don't combine the above with .so...  Or if they do, the .so
will be resolved relative to the directory where the symlink
resides, not relative to the directory of the file pointed to.

Yours,
  Ingo
--
 To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv

      parent reply	other threads:[~2014-12-09 14:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-09 12:22 Kristaps Dzonsons
2014-12-09 13:37 ` Kristaps Dzonsons
2014-12-09 14:25 ` Ingo Schwarze [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141209142512.GB327@iris.usta.de \
    --to=schwarze@usta.de \
    --cc=discuss@mdocml.bsd.lv \
    --cc=kristaps@bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).