-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Set secure flags when opening a named pipe on Windows #58216
Conversation
r? @Kimundi (rust_highfive has picked a reviewer for you, use r? to override) |
cc @DemiMarie @retep998? |
@pitdicker There are other potential paths through which a named pipe could be found. Specifically, I know that I strongly believe that we should pass these flags unconditionally. They are only unwanted in rare cases, and purely path-based blacklisting is likely insufficient, due to symbolic links and other cases. |
I half remember I understand your concern. If a path-based solution is not watertight it is of not much use. But if it works, it is the nicest solution because it doesn't make flags in Microsoft made it difficult here by reusing the same bits for different things. I think setting the flags unconditionally is also not great, because we would then need to offer some way to un-set them. And what happens if another duplicate flag is added in the future? |
Paths that start with |
Just tested it just to make sure, and you are both right about Now I am not sure what is the best way to proceed. Shall I just include the fix for Or fix #42036 by setting the flags unconditionally (although I don't feel completely confident about that). @DemiMarie do you want to defend that choice if I change the commit? |
if security_qos_flags(SECURITY_ANONYMOUS) is set
Removed the commit that attempted to set secure defaults. I think it is best to let further discussion for that take place in the #42036. This PR is now a basic bug and documentation fix. |
ping @Kimundi, or does someone else want to review? |
@bors: r+ Sorry for the delay, thanks @pitdicker! |
📌 Commit 9295f49 has been approved by |
Set secure flags when opening a named pipe on Windows Fixes rust-lang#42036, see also the previous attempt in rust-lang#44556. Whether this is correct depends on if it is somehow possible to create a symlink to a named pipe, outside the named pipe filesystem (NPFS). But as far as I can tell that should be impossible. Also fixes that `security_qos_flags(SECURITY_ANONYMOUS)` does not set the `SECURITY_SQOS_PRESENT` flag, and the incorrect documentation about the default value of `security_qos_flags`.
Set secure flags when opening a named pipe on Windows Fixes rust-lang#42036, see also the previous attempt in rust-lang#44556. Whether this is correct depends on if it is somehow possible to create a symlink to a named pipe, outside the named pipe filesystem (NPFS). But as far as I can tell that should be impossible. Also fixes that `security_qos_flags(SECURITY_ANONYMOUS)` does not set the `SECURITY_SQOS_PRESENT` flag, and the incorrect documentation about the default value of `security_qos_flags`.
Set secure flags when opening a named pipe on Windows Fixes rust-lang#42036, see also the previous attempt in rust-lang#44556. Whether this is correct depends on if it is somehow possible to create a symlink to a named pipe, outside the named pipe filesystem (NPFS). But as far as I can tell that should be impossible. Also fixes that `security_qos_flags(SECURITY_ANONYMOUS)` does not set the `SECURITY_SQOS_PRESENT` flag, and the incorrect documentation about the default value of `security_qos_flags`.
Failed in #58666 (comment), @bors r- |
src/libstd/sys/windows/ext/fs.rs
Outdated
/// | ||
/// .open("foo.txt"); | ||
/// .open("\\.\pipe\MyPipe"); |
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.
Use a raw string for this.
@alexcrichton can you please r+ again? |
@bors: r+ |
📌 Commit 089524c has been approved by |
Set secure flags when opening a named pipe on Windows Fixes #42036, see also the previous attempt in #44556. Whether this is correct depends on if it is somehow possible to create a symlink to a named pipe, outside the named pipe filesystem (NPFS). But as far as I can tell that should be impossible. Also fixes that `security_qos_flags(SECURITY_ANONYMOUS)` does not set the `SECURITY_SQOS_PRESENT` flag, and the incorrect documentation about the default value of `security_qos_flags`.
☀️ Test successful - checks-travis, status-appveyor |
Fixes #42036, see also the previous attempt in #44556.
Whether this is correct depends on if it is somehow possible to create a symlink to a named pipe, outside the named pipe filesystem (NPFS). But as far as I can tell that should be impossible.
Also fixes that
security_qos_flags(SECURITY_ANONYMOUS)
does not set theSECURITY_SQOS_PRESENT
flag, and the incorrect documentation about the default value ofsecurity_qos_flags
.