Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal: cmd/go: cgo flags blacklisting mechanism for compiler safety #23844

Closed
glycerine opened this issue Feb 15, 2018 · 5 comments
Closed

Comments

@glycerine
Copy link

glycerine commented Feb 15, 2018

As a complement to #23672 and #23749,

Consider the developer who wants to upgrade to a new C compiler version, but notices that the new compiler allows flags that enable arbitrary code execution, during a CGO build of dependent packages, as per #23672.

And it just so happens that the new flags are allowed by the existing whitelist set.

In order to use the new compiler safely, while not waiting the average 3-6 months for an updated Go version, the developer would like to set an environment variable regex that blacklists the use of those new, unsafe flags, when building dependencies.

Suggested names:
CGO_CFLAGS_FORBID,
CGO_LDFLAGS_FORBID

@glycerine glycerine changed the title allowing new C compilers with arbitrary flags, safely allowing new C compilers flags, safely Feb 15, 2018
@odeke-em odeke-em changed the title allowing new C compilers flags, safely proposal: cmd/go: cgo flags blacklisting mechanism for compiler safety Feb 15, 2018
@gopherbot gopherbot added this to the Proposal milestone Feb 15, 2018
@odeke-em
Copy link
Member

Thank you for this proposal @glycerine, I've tweaked the title a little PTAL.

@glycerine
Copy link
Author

@odeke-em Title change is an improvement, thanks.

@glycerine
Copy link
Author

glycerine commented Feb 15, 2018

CGO_CFLAGS_DISALLOW is mentioned as being already present by https://golang.org/cmd/cgo/, and I see there is also a corresponding CGO_LDFLAGS_DISALLOW in the go1.9.4 source. So this proposal may be redundant.

@ianlancetaylor
Copy link
Contributor

Yes, we have DISALLOW environment variables. I think this is done. Thanks. Closing.

@glycerine
Copy link
Author

Good to know. Thanks for all your work on getting these in place, Ian.

@golang golang locked and limited conversation to collaborators Feb 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants