-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Switch to golang.org/x/sys/execabs for windows security fix #2344
Conversation
The os/exec package on Windows will match the behaviour of cmd.exe by considering the local folder as a primary part of the path. This means that a malicious binary with the same name, in the current folder, would be run instead of the expected binary in the system path. Due to the backwards compat being an issue, this could not be fixed within ox/exec before Go v2. See https://blog.golang.org/path-security for more info.
As a further note, I have switched everything to use the new package for the sake of consistency. Some of the vendored code uses "os/exec" still, so I don't think we gain any binary size improvements from doing this. |
The switch to the new package has been made upstream as well. Update to gain that functionality there.
From the vendor folder, these are the deps that still rely on
|
I have lucor/goinfo#3 open now. |
Should I get a PR up for godbus as well? There is no extra security to gain for us as we just use it on other platforms, but there could potentially be a use case for knowing that we do not depend on "os/exec" in terms of binary size. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just need to update github.com/lucor/goinfo@fce12a3 from your PR
Probably having a PR for godbus does not hurt, even if as you said it does not add any extra security due to the target platform. |
Yeah, you are right. Always good to be a helpful open source citizen and contribute upstream where possible :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don’t delete khrplatform.h
Yeah good idea |
I think updating unrelated dependencies should be a different PR - it requires a lot more testing and if there is an issue we would surely address them separately |
Sorry if I was a bit vague here. The blog post above mentions that all of the
If it was deleted, it must have happened when running |
yes. Our old approach (fyne vendor) could work, but we stopped using it. I filed a bug upstream some time ago go-gl/gl#140 |
Can we not just add the file upstream instead of here then? |
Maybe you need to read the ticket more carefully… the file exists upstream but is removed during vendoring. I suggested they take the same workaround approach as GLFW did that allowed us to stop using our own vendor script |
Ah, sorry. Makes sense. Will add the file back in the meantime. |
I have added back the file now. |
Description:
The os/exec package on Windows will match the behaviour of cmd.exe by considering the local folder as a primary part of the path. This means that a malicious binary with the same name, in the current folder, would be run instead of the expected binary in the system path. Due to the backwards compat being an issue, this could not be fixed within ox/exec before Go v2. See https://blog.golang.org/path-security for more info.
This should not change any behaviour for anything else than Windows platforms. I think we should target this for develop as it potentially could break things if we run any binaries within the local path (easily fixed by adding
./
in the code). It did not look like any of the use cases here ran binaries in the current folder, so I think we should be fine. I do however not have access to any Windows computer to test it on at this point in time.Checklist: