Repository navigation
fix(acquire): profile follow-ups from the #33 review - #55
Merged
Merged
Conversation
- Check the key destination as the invoking user, without modifying it, in both preflight and capture (existing file, ownership, links, and the nearest existing folder's write access via faccessat(AT_EACCESS)). - Mirror Rust's discover_default_live_source_root candidate and 14-day recency rules when only source.passphrase_file is configured. - Compare --db-root against the configured root by st_dev/st_ino; a failed lookup is a conflict. - Keep --overwrite in preflight's Next: command. - Extend scripts/sudo-smoke-test-acquire.sh with destination checks. Closes #50 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…check Also require read access on the existing containing folder (the writer opens it O_RDONLY), suggest --db-root with --output for ambiguous accounts, and make the smoke test's absence check require a valid report. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
capture --json now reports a key destination problem in its readiness report (exit 1) instead of exiting 2 with no output. A discovered root keeps requiring --output with --db-root, since a query may discover under a different $HOME. A read-only existing key file gets its own message. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…dden Rust discovers under the query's $HOME; with GREENBUBBLES_CONFIG_FILE set that home can't be established, so require --db-root and --output. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
readdir returns variable-length records; copying the whole d_name tuple could read past the buffer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bojieli
force-pushed
the
fix/issue-50-profile-followups
branch
from
November 24, 2026 01:48
f6c5d1b to
ad13a75
Compare
Unlink the two key fixtures and rmdir the expected-empty folder without sudo, instead of a recursive delete as root; a non-empty folder is left and reported. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…followups # Conflicts: # CHANGELOG.md
Owner
Author
|
Sudo smoke test at cb135e1 on the owner's Mac: 🤖 Generated with Claude Code |
Merged
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.
Closes #50
Follow-ups from the #33 review of profile-aware capture.
Changes
Check the key destination before the logout/login step (
SecretOutputWriter.checkDestinationAccess,main.swift)invokingUser.performand changes nothing. It mirrors the final write's rules:--overwrite(outputExists).--overwrite, the output must be a single-link regular file the user owns and can write. Its folder must not be a symbolic link and must be readable and searchable, because the writer opens itO_RDONLY.faccessat(..., AT_EACCESS), because under sudo the real uid is root and plainaccess(2)would approve everything.preflightandcaptureboth run it. It shows up as its own failed preflight check, so it doesn't hide the database or process diagnostics.capture --jsonreports it inblockersand exits 1 before any logout prompt.destinationNotWritablefor a folder on the path andoutputNotWritablefor an existing read-only key.Mirror Rust discovery when only
source.passphrase_fileis configured (QueryProfileTarget.discoverDefaultLiveSourceRoot)discover_default_live_source_root():com.tencent.xinWeChatcontainer'sxwechat_filesplusGroup Containersentries whose ASCII-lowercased name containswechatorxinwechat.contact,sessionandmessagedirectories.mtimeof a regular file directly inside those three folders.readdirrecords.resolveperformblock.--db-rootreports Rust's reason.--db-rootis given alongside a discovered root: it still needs--output, because a query discovers under its own$HOME.GREENBUBBLES_CONFIG_FILEis set: the query's home can't be known, so no account is guessed.Compare database directories by identity (
AcquireTarget.originConflicting)st_dev/st_inofromstat(run as the invoking user) instead ofrealpathstrings. A failed lookup on either side counts as a conflict.Keep
--overwritein the suggestedNext:command (captureCommand).Smoke test (
scripts/sudo-smoke-test-acquire.sh), new checks:--overwriteand accepts it with--overwrite.capture --jsonreports it and never prints the logout step; nothing gets created. A key folder inside root's home is also refused.--overwriterefuses a root-owned key file and leaves it unchanged.Testing
swift test, run on a copy without the HistoryApp target: all suites pass. Acquire has 137 tests, with new ones for discovery (14-day window, group containers, skipped roots, other owner), identity comparison (NFC/NFD, failed lookup), and destination access (0500/0300/0000 folders, read-only file, hard/symbolic links, file in place of a folder, symlinked parent, other owner).swift format lint --strict: clean.scripts/sudo-smoke-test-acquire.sh --no-sudo: 4/4 pass.Needs manual check
scripts/sudo-smoke-test-acquire.shunder real sudo. The new (e) and (f) checks have not been run as root.Known limitations (Codex P2s not fixed)
add_fileandadd_subdirectoryseparately. The preflight probes genericW_OK, so a split ACL can make preflight disagree with the writer. In that case capture fails at the final write, which is how it behaved before this PR.$HOMEthat differs from the login home, it can still discover a different account than capture does when the defaultconfig.tomlis used. The same was true before this PR, and it also affects the profile file location. TheGREENBUBBLES_CONFIG_FILEcase now fails closed.🤖 Generated with Claude Code