This repository has been archived by the owner on Jul 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 645
Insecure use of temporary file #1905
Labels
Comments
Can you elaborate on this? |
Because of the pitfalls in using temporary files, most systems include ready functions to securely create temporary files. POSIX has a family of functions like mkstemp(), mkdtemp(), ... Go has By the way, thank you @ramya-rao-a for all your work on vscode-go! It is really appreciated. |
Thanks for the links! PRs are welcome to fix this.
|
I'll take this! |
The fix for this is now out in the latest update to this extension (0.6.90) |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
There are multiple insecure uses of temporary files in the vscode-go extension. I found the following just looking at the output console:
$TMPDIR/go-code-cover
. Command palette: "> Go Toggle Test Coverage In Current Package".$TMPDIR/go-code-check.*
. See Using vscode-go from multiple user accounts clashes on /tmp/go-code-check #1829.$TMPDIR/vscode-go-debug.txt
. Created when debugging withtrace: "true"
in the launch config.On a multi-user or shared system such clashing or predictable use of temporary files is a hassle at best (two users cannot use vscode without errors) to a serious security issue at worst.
For example, on some system configurations user Bob can overwrite arbitrary files belonging to user Alice (or root) using a symlink attack:
(This example is prevented on modern Linux systems if /tmp has the sticky bit set.)
Recommendation: use secure library functions for temporary files and private files (e.g., in the home directory or workspace) for non-temporary files.
The text was updated successfully, but these errors were encountered: