]> Cypherpunks repositories - gostls13.git/commit
cmd/go: enforce flags with non-optional arguments
authorRoland Shoemaker <bracewell@google.com>
Fri, 5 May 2023 20:10:34 +0000 (13:10 -0700)
committerDavid Chase <drchase@google.com>
Tue, 6 Jun 2023 20:23:36 +0000 (20:23 +0000)
commitbbeb55f5faf93659e1cfd6ab073ab3c9d126d195
tree0bce53f45e949f5dca8a50ca631576c6a2988d92
parent6d8af00a630aa51134e54f0f321658621c6410f0
cmd/go: enforce flags with non-optional arguments

Enforce that linker flags which expect arguments get them, otherwise it
may be possible to smuggle unexpected flags through as the linker can
consume what looks like a flag as an argument to a preceding flag (i.e.
"-Wl,-O -Wl,-R,-bad-flag" is interpreted as "-O=-R -bad-flag"). Also be
somewhat more restrictive in the general format of some flags.

Thanks to Juho Nurminen of Mattermost for reporting this issue.

Fixes #60305
Fixes CVE-2023-29404

Change-Id: I913df78a692cee390deefc3cd7d8f5b031524fc9
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1876275
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/501225
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/cmd/go/internal/work/security.go
src/cmd/go/internal/work/security_test.go