Repository navigation
Local hardening: agent data folder and discovery file checks, full database URL redaction, patch updates - #44
Open
Skyfuller1303 wants to merge 3 commits into
Conversation
…them, redact the whole database URL An existing data folder was used as it was: another user who could write to it (or to a folder above it without the sticky bit, or who had put a link there) could replace local-api.json and point apps at a listener of their own. On Unix the agent now refuses a data folder that is a link, belongs to someone else, or can be written by group or others, and apps do not read local-api.json, or send its token anywhere, unless the folder and the file pass the same checks. Windows keeps the %LOCALAPPDATA% rule; std has no owner check there. DatabaseConfig's Debug output hid only the credentials before the last @; the query string (which can carry user and password) and fragment are now hidden too. Cargo.lock: patch updates of rustls 0.23.46, rustls-webpki 0.103.16, webpki-root-certs 1.0.10, tokio 1.53.3 and ctutils 0.4.4 for RUSTSEC-2026-0346 to 0349, 0382, 0383, 0385 and 0386.
… whose password holds ? or #, keep the old error for a file at the data path on Windows old_agent_blobs and recents wrote local-api.json with the umask's mode, which the client now refuses on Unix; they write it 0600. redact_url cut at the first ? or # before it looked for the @, so postgres://cc:pa#ss@db/cc showed the user and the start of the password; the credentials now end at the last @ of the authority, wherever a ? or # sits. DataDir::create treats a file or a dangling link at the data path as an error again on Windows.
…in-tests applies on Unix The test module was gated by cfg(all(test, unix)); clippy only treats a plain cfg(test) as test code, so Linux and macOS clippy rejected its unwrap() calls (the Windows build never compiles the module). Mechanical repair of the merge of fix/local-security-hardening.
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.
Merge after: none. Independent of the other PRs; based on
main. Diff against main.Local hardening of the agent and the server's configuration, plus patch updates of four dependencies. None of it changes a documented behaviour for a normal single-user install.
What
local-api.jsonthe app reads to find the agent, are used only if no other user can write to them (on Unix: owner, mode and the folders above). The app's client applies the same check to the discovery file before it connects. If a folder or file does not pass, the agent or the client refuses with a message that names the path and what is wrong, instead of using it. On Windows the check is not applied (the per-user profile already restricts access); the Unix checks cannot run on the Windows development machine and are covered by the Linux and macOS CI jobs.Debugoutput ofDatabaseConfighid only the credentials before the last@; the query string, which can carry a user and a password for some drivers, was printed. The whole URL is now hidden, including passwords that contain?or#.Cargo.lock:rustls0.23.46,rustls-webpki0.103.16,webpki-root-certs1.0.10,tokio1.53.3 andctutils. NoCargo.tomlchange.private.rstests use a plaincfg(test)so clippy'sallow-unwrap-in-testsapplies on Linux and macOS.Testing
cargo fmt --all -- --checkandcargo clippy --workspace --all-targets --locked -- -D warningspass at this head.cargo test --workspace --locked --no-fail-fast: 966 passed, 0 failed, 2 ignored. The run ends with exit code 101 only becausecraft-cloud-desktop --libcrashes on Windows (STATUS_ACCESS_VIOLATION). Pristinemaincrashes the same way (the wgpu problem fixed by Desktop tests: share one wgpu device (fixes a crash in parallel runs on Windows) #35), so it is unrelated to this change.