Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(5)

Issue 4248041: code review 4248041: goinstall: protect against malicious filenames. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years ago by rog
Modified:
14 years ago
Reviewers:
CC:
rsc, niemeyer, golang-dev
Visibility:
Public.

Description

goinstall: protect against malicious filenames. It was possible to make package run arbitrary commands when installing if its filenames contained make metacharacters.

Patch Set 1 #

Patch Set 2 : diff -r 8e157f1abc87 https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r 8e157f1abc87 https://go.googlecode.com/hg/ #

Total comments: 2

Patch Set 4 : diff -r d9ff478c4ed3 https://go.googlecode.com/hg/ #

Patch Set 5 : diff -r d9ff478c4ed3 https://go.googlecode.com/hg/ #

Patch Set 6 : diff -r d9ff478c4ed3 https://go.googlecode.com/hg/ #

Patch Set 7 : diff -r d9ff478c4ed3 https://go.googlecode.com/hg/ #

Patch Set 8 : diff -r d9ff478c4ed3 https://go.googlecode.com/hg/ #

Patch Set 9 : diff -r d9ff478c4ed3 https://go.googlecode.com/hg/ #

Patch Set 10 : diff -r d9ff478c4ed3 https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+23 lines, -0 lines) Patch
M src/cmd/goinstall/make.go View 1 2 3 4 5 6 7 8 9 3 chunks +23 lines, -0 lines 0 comments Download

Messages

Total messages: 23
rog
Hello rsc (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
14 years ago (2011-02-25 13:02:51 UTC) #1
niemeyer
LGTM http://codereview.appspot.com/4248041/diff/3001/src/cmd/goinstall/parse.go File src/cmd/goinstall/parse.go (right): http://codereview.appspot.com/4248041/diff/3001/src/cmd/goinstall/parse.go#newcode58 src/cmd/goinstall/parse.go:58: if strings.IndexAny(d.Name, "$\n\r") >= 0 { Backquotes should ...
14 years ago (2011-02-25 13:29:26 UTC) #2
rog
http://codereview.appspot.com/4248041/diff/3001/src/cmd/goinstall/parse.go File src/cmd/goinstall/parse.go (right): http://codereview.appspot.com/4248041/diff/3001/src/cmd/goinstall/parse.go#newcode58 src/cmd/goinstall/parse.go:58: if strings.IndexAny(d.Name, "$\n\r") >= 0 { On 2011/02/25 13:29:26, ...
14 years ago (2011-02-25 14:14:24 UTC) #3
niemeyer
> ok, but i didn't think backquotes were special to make Try this: FOO=`echo Hi` ...
14 years ago (2011-02-25 14:27:39 UTC) #4
rog
interesting. but they don't work in prerequisite lists, which is where the filenames end up. ...
14 years ago (2011-02-25 14:48:21 UTC) #5
niemeyer
> interesting. but they don't work in prerequisite lists, which > is where the filenames ...
14 years ago (2011-02-25 15:02:14 UTC) #6
rog
ah, of course, it's not just make metacharacters but also sh metacharacters because the filename ...
14 years ago (2011-02-25 15:09:31 UTC) #7
rog
Hello rsc, niemeyer (cc: golang-dev@googlegroups.com), Please take another look.
14 years ago (2011-02-25 15:15:18 UTC) #8
niemeyer
> are there any more potentially dodgy bash metacharacters? > i'm not that familiar with ...
14 years ago (2011-02-25 15:21:01 UTC) #9
niemeyer
> Just reminded of another one: ; And: [({|&<>!* What a can of worms. I ...
14 years ago (2011-02-25 15:27:33 UTC) #10
rsc
Isn't this problem with make, not the rest of goinstall? If so, shoudn't the fix ...
14 years ago (2011-02-25 15:31:04 UTC) #11
rog
the question is where to stop the rot. i see three possibilities: 1) a template ...
14 years ago (2011-02-25 15:49:23 UTC) #12
rog
PTAL On 25 February 2011 15:49, roger peppe <rogpeppe@gmail.com> wrote: > the question is where ...
14 years ago (2011-02-25 16:01:06 UTC) #13
niemeyer
> i'm not sure about whitelisting - i think it's easier to blacklist > but ...
14 years ago (2011-02-25 16:16:48 UTC) #14
rog
On 25 February 2011 16:16, <n13m3y3r@gmail.com> wrote: >> i'm not sure about whitelisting - i ...
14 years ago (2011-02-25 16:23:08 UTC) #15
niemeyer
> for example, do you accept all unicode characters, or provide a list > of ...
14 years ago (2011-02-25 17:09:31 UTC) #16
niemeyer
Sorry, digits are obviously missing, but you get the idea.
14 years ago (2011-02-25 17:11:12 UTC) #17
rog
On 25 February 2011 17:09, <n13m3y3r@gmail.com> wrote: >> for example, do you accept all unicode ...
14 years ago (2011-02-25 17:17:37 UTC) #18
niemeyer
> that's pretty restrictive and would amount to a language change. Yes, it is pretty ...
14 years ago (2011-02-25 17:21:25 UTC) #19
rsc
we seem to be falling into lots of bikeshed discussions recently. to end this one, ...
14 years ago (2011-02-25 17:26:25 UTC) #20
rog
PTAL On 2011/02/25 17:26:25, rsc wrote: > "+-./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz" i might be inclined to add ':', ...
14 years ago (2011-03-01 12:48:51 UTC) #21
rsc
LGTM
14 years ago (2011-03-02 19:59:56 UTC) #22
rsc
14 years ago (2011-03-02 20:04:10 UTC) #23
*** Submitted as c4a961e2e4bc ***

goinstall: protect against malicious filenames.
It was possible to make package run arbitrary
commands when installing if its filenames contained
make metacharacters.

R=rsc, niemeyer
CC=golang-dev
http://codereview.appspot.com/4248041

Committer: Russ Cox <rsc@golang.org>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b