Skip to content

fix: use POSIX path rules on the remote and trust user private groups - #816

Merged
alphaxiv-bot[bot] merged 2 commits into
mainfrom
clo/use-posix-path-rules-on-the-remote-and-trust-user-private-groups
Oct 28, 2026
Merged

alphaxiv-bot[bot] merged 2 commits into
mainfrom
clo/use-posix-path-rules-on-the-remote-and-trust-user-private-groups

Conversation

@paperclover

Copy link
Copy Markdown
Contributor

Supersedes #357. See it's description

Assisted-by: gpt-6.1-terra
Assisted-by: claude-sonnet-5.5

…vate groups

Resolve remote paths with POSIX rules so Windows clients accept absolute remote
paths and do not write backslashes when joining paths or finding parents.

Allow group-writable candidates only when the primary group is named after the
user and the path belongs to that group. Continue to reject group-writable
paths for shared primary groups and all world-writable paths.

Co-authored-by: jie.yuan <yuanjielovejesus@gmail.com>
Assisted-by: gpt-6.1-terra
Assisted-by: claude-sonnet-5.5
@paperclover paperclover added the auto-merge Queue for automatic merge once all checks pass label Oct 28, 2026
@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 3/5

[Medium impact] The changes affect remote connection, path selection, and executable checks.

The group-write exception needs to check group membership before this PR is safe to merge.

Findings

  1. P1 Security Shared groups are trusted ▶
  2. P2 Test assumes the directory's group ▶
Fix with agent prompt
### Issue 1
src/commands/up_remote.rs:2156-2157
Matching the primary group name to the username does not prove that the group is private. If another account belongs to `alice`, it can change an `alice:alice` executable with mode `0775`. The owner check still passes, and the new exception lets the probe run the changed executable as Alice. Verify that no other accounts belong to the group before allowing group writes, or keep rejecting group-writable candidates.

**How this was verified:** The probe checks group names and file ownership, then directly runs `"$p" --version` without checking whether other accounts belong to the group.

### Issue 2
src/commands/up_remote.rs:2876-2878
The new test assumes the temporary directory belongs to the user's primary group, but it only sets its mode. If `TMPDIR` points to a shared directory whose set-group-ID bit is set, the fixture inherits that directory's group. When the user's primary group matches their username, the test expects acceptance even though the probe correctly rejects the fixture's different group. This can fail tests for developers using shared temporary directories. Set the fixture's group explicitly or account for its actual group before choosing the expected result.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

The PR replaces local filesystem path rules with POSIX string helpers for remote settings and paths.

  • Remote install settings follow POSIX path rules on every client.
  • Remote installs accept group-writable paths in a user's matching primary group.

Reviews (1) · Last reviewed commit: "fix(up_remote): use POSIX path rules on ..." · Reviewed by Greptile

Comment thread src/commands/up_remote.rs
Comment on lines +2156 to +2157
if [ \"$(id -gn 2>/dev/null)\" = \"$(id -un)\" ]; then \
unsafe=$(find \"$p\" \"$(dirname \"$p\")\" -prune \\( -perm -002 -o \\( -perm -020 ! -group \"$(id -g)\" \\) \\) -print 2>/dev/null); \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 security Shared groups are trusted

Matching the primary group name to the username does not prove that the group is private. If another account belongs to alice, it can change an alice:alice executable with mode 0775. The owner check still passes, and the new exception lets the probe run the changed executable as Alice. Verify that no other accounts belong to the group before allowing group writes, or keep rejecting group-writable candidates.

How this was verified: The probe checks group names and file ownership, then directly runs "$p" --version without checking whether other accounts belong to the group.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/commands/up_remote.rs
Line: 2156-2157

Comment:
**Shared groups are trusted**

Matching the primary group name to the username does not prove that the group is private. If another account belongs to `alice`, it can change an `alice:alice` executable with mode `0775`. The owner check still passes, and the new exception lets the probe run the changed executable as Alice. Verify that no other accounts belong to the group before allowing group writes, or keep rejecting group-writable candidates.

**How this was verified:** The probe checks group names and file ownership, then directly runs `"$p" --version` without checking whether other accounts belong to the group.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment thread src/commands/up_remote.rs
Comment on lines +2876 to +2878
let dir = std::env::temp_dir().join(format!("orx-probe-group-{}", std::process::id()));
std::fs::create_dir(&dir).unwrap();
std::fs::set_permissions(&dir, std::fs::Permissions::from_mode(0o775)).unwrap();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Test assumes the directory's group

The new test assumes the temporary directory belongs to the user's primary group, but it only sets its mode. If TMPDIR points to a shared directory whose set-group-ID bit is set, the fixture inherits that directory's group. When the user's primary group matches their username, the test expects acceptance even though the probe correctly rejects the fixture's different group. This can fail tests for developers using shared temporary directories. Set the fixture's group explicitly or account for its actual group before choosing the expected result.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/commands/up_remote.rs
Line: 2876-2878

Comment:
**Test assumes the directory's group**

The new test assumes the temporary directory belongs to the user's primary group, but it only sets its mode. If `TMPDIR` points to a shared directory whose set-group-ID bit is set, the fixture inherits that directory's group. When the user's primary group matches their username, the test expects acceptance even though the probe correctly rejects the fixture's different group. This can fail tests for developers using shared temporary directories. Set the fixture's group explicitly or account for its actual group before choosing the expected result.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

@alphaxiv-bot
alphaxiv-bot Bot merged commit 0cfb2d7 into main Oct 28, 2026
12 checks passed
@alphaxiv-bot
alphaxiv-bot Bot deleted the clo/use-posix-path-rules-on-the-remote-and-trust-user-private-groups branch October 28, 2026 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-merge Queue for automatic merge once all checks pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant