Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Update LanguageServerHost to use NamedPipe #69816
Update LanguageServerHost to use NamedPipe #69816
Changes from all commits
add2080
deaa53c
5786c09
b918214
39841d0
9b0d54d
555bd3c
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
@dibarbet PipeOptions.CurrentUserOnly isn't working. It connects but doesn't send any messages. I could investigate further (I don't know if the issue is between .net and nodjs?) but I don't know if it's worth the time. I don't think this is less secure than the stdin/out was? Thoughts?
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.
I wonder if the client is not creating a pipe that applies to the current user.
Honestly I'm not super familiar with named pipes - but it seems like a lower privileged user could hijack the pipe name and then get access to files from the server that they normally couldn't get. I'm not sure it would be as easy to hijack stdin/out. But maybe it doesn't matter if the pipe is created in the user's tmp dir?
But I don't really know much about named pipes. Not sure @jaredpar might have additional insight?
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.
You can't get a handle to another processes stdin/out, but depending on how the pipe is created, this could be. This is a pretty common source of security bugs in the Linux world, especially since /tmp is world-accessible. The potential attack here is imagine you have two users on a machine, one launches VS Code. The other malicious user sees the pipe get created, and connects to it prior to our LSP connecting to it. In that case, you're now able to send LSP messages to the other user's client, which could be potentially bad/broken. (Imagine getting didOpen for files you can't otherwise read, or sending LSP messages back which executes stuff on the VS Code side...)
It's entirely possible we're OK here if the pipe creation API is already doing the right thing, but we'd need to validate that.
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.
I also don't see a way to configure access on the nodejs side - https://nodejs.org/api/net.html#netcreateserveroptions-connectionlistener
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.
Found it here - https://nodejs.org/api/net.html#serverlistenoptions-callback - looks like the default should be current user, so that looks ok (unless vscode is launching as a different user)
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.
Where do you see the default as current user?
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.
Under server.listen options (from https://nodejs.org/api/net.html#serverlistenoptions-callback ), e.g.
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.
Should we still allow for stdin/stdout for a bit longer, if only so that way we don't have to merge/flow this simultaneously with the VS Code side of things?
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.
David and I discussed this, and determined it would be fine to merge both PRs close together. The only risk is that someone else updates roslyn version before I get PR in, correct?