Conversation
os.Create used the process umask, so port.txt was world-readable on Linux. Open it as 0600, chmod again in case the file already existed, and create its directory as 0700. Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
Launch now calls writeServicePortFile. The test pre-creates the file as mode 0644 and checks the writer leaves mode 0600 and the port:secret line. helpers.WriteFile is not this path. Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
PR type
What kind of change does this PR introduce?
PR checklist
What is the current behavior?
Launchwrites the daemon port file withos.Create. That uses the process umask, so on Linux the file can be mode 0644. The file contains the TCP port and the secret local clients must send withHello. The directory for that file is created withos.ModePerm.A private report of this was closed without a code change (GHSA-9vqc-pp5f-wmc9).
Issue number: N/A
What is the new behavior?
The port file is opened mode 0600, and
Chmod(0600)runs again when the file already exists. Its directory is created mode 0700.TestWriteFileMode0600checks thathelpers.WriteFilewith mode 0600 keeps those bits on Unix.Does this PR introduce a breaking change?
The UI and CLI still read the same
port:secretline. Other local users can no longer read it when the daemon runs as root.Other information
Base is
development. CONTRIBUTING.md names the integration branchdevelop; this repository's default branch isdevelopment.