]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.20] cmd/go: enforce flags with non-optional arguments
authorRoland Shoemaker <bracewell@google.com>
Fri, 5 May 2023 20:10:34 +0000 (13:10 -0700)
committerGopher Robot <gobot@golang.org>
Tue, 6 Jun 2023 17:03:00 +0000 (17:03 +0000)
commit356a419e2f811b65d227abcea1a346f8dcb154e0
tree09b56a1821261613f0d18f4f7508ef623c32f3b9
parentfa60c381ed06c12f9c27a7b50ca44c5f84f7f0f4
[release-branch.go1.20] 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.

Updates #60305
Fixes #60512
Fixes CVE-2023-29404

Change-Id: I5989f68d21a8851d8edd47f08550850524ee9180
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>
(cherry picked from commit 896779503cf754cbdac24b61d4cc953b50fe2dde)
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1902226
TryBot-Result: Security TryBots <security-trybots@go-security-trybots.iam.gserviceaccount.com>
Run-TryBot: Roland Shoemaker <bracewell@google.com>
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1904346
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/501221
Run-TryBot: David Chase <drchase@google.com>
Auto-Submit: 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