Skip to content

fix(fast_io): honour --insecure-links in the operator-path walk - #7459

Merged
oferchen merged 2 commits into
masterfrom
fix/insecure-links-opt-out
Aug 23, 2026
Merged

oferchen merged 2 commits into
masterfrom
fix/insecure-links-opt-out

Conversation

@oferchen

Copy link
Copy Markdown
Owner

--insecure-links promises the pre-3.4.3 follow-any-symlink behaviour, but oc's
operator-path ownership walk refused an untrusted symlink unconditionally, so the
option could not restore anything. Four upstream 3.5.0 cells fail on that alone,
all with the same text:

--<opt>: CROSS-UID abs leaf insecure: --insecure-links did not restore symlink following.

operator-path-backup-dir, -files-from, -log-file, -write-batch.

Where the fix goes

Upstream asks the question inside the walk, not at its callers - ona_open()
opens with

if (symlink_optout_allowed())
        return open(path, flags, mode);

(syscall.c:300-302), which is why the answer reaches both
open_no_attacker_symlinks() and owner_walk_parent(). The short-circuit added
here sits at the same place and covers this walk's two entry points for the same
reason.

Threading the flag instead would have touched ten call sites across seven crates
and every helper between them, and one un-threaded site would have gone on
confining under an opt-out the operator asked for. The value is a property of the
session, not of the call.

Activation::optout_allowed already spelled the rule out with a twenty-row truth
table and had no production caller; it is now what computes the value the walk
reads. Two arm-specific constructors say which of upstream's two disjoint arms
the caller is, so no site invents values for fields its arm ignores. A daemon's
arm needs a selected module, so the daemon stays on the fully-confined default
until that lands.

Verification

Measured on Linux aarch64, root, against the 3.5.0 suite.

before after
the four cells FAIL PASS
operator-path-insecure-links-refused (confinement still enforced) pass pass
operator-path-insecure-links-daemon (daemon arm untouched) pass pass
operator-path-backup-rmdir, -backup-symlink pass pass

Mutation: forcing session_optout_allowed() to false turns all four back to
FAIL while insecure-links-refused stays green - so they are not passing for an
unrelated reason, and the control does not depend on the opt-out.

The other operator-path failures are untouched and report identical text -
-link-dest/-compare-dest/-copy-dest/-temp-dir/-inplace-backup-dir still
say the symlink was followed (a separate defect: the walk is not reached at
all), and -partial-dir still over-refuses the operator's own euid-owned link.
Neither class is in scope here.

Manifest rows were generated from a full root-leg run, not hand typed; the only
other difference was simd-checksum, which is skip on aarch64 and pass on the
x86_64 runner, so it is deliberately left alone.

The ownership walk refused an untrusted symlink unconditionally, so
--insecure-links could not restore the legacy following it promises.
Four upstream 3.5.0 cells fail on that alone, all with the same text:
"CROSS-UID abs leaf insecure: --insecure-links did not restore symlink
following" - operator-path-{backup-dir,files-from,log-file,write-batch}.

Upstream asks the question inside the walk, not at its callers:
ona_open() opens with `if (symlink_optout_allowed()) return open(path,
flags, mode);` (syscall.c:300-302), which is why the answer reaches
open_no_attacker_symlinks() and owner_walk_parent() alike. The
short-circuit added here sits at the same place and covers this walk's
two entry points for the same reason.

Threading the flag instead would have touched ten call sites across
seven crates and every helper between them, and one un-threaded site
would have gone on confining under an opt-out the operator asked for.
The value is a property of the session, not of the call.

Activation::optout_allowed already spelled the rule out with a
twenty-row truth table and had no production caller. It is now the
thing that computes what the walk reads: install_session stores its
answer, and the two arm-specific constructors say which of upstream's
two disjoint arms the caller is so no site has to invent values for
fields its arm ignores. A daemon's arm needs a selected module, so the
daemon stays on the fully-confined default until that lands.

Note the opted-out branch spells out the empty-path convention:
owner_trusted_parent hands the walk an empty parent for a bare relative
leaf, which the walk resolves by starting at ".", and a plain open()
would report ENOENT.
The --insecure-links fix earns these four, so their rows move from fail
to pass in the same change - an unexpected pass is a red leg, never a
silent one.

Generated from a full root pipe-leg run on Linux aarch64 at this commit,
not hand typed. The emitted manifest differed from the committed one in
exactly these four rows plus simd-checksum, which is skip on aarch64 and
pass on the x86_64 runner - a property of the host, not of this change,
so it is deliberately left alone.

The nonroot leg is unchanged: all four cells self-skip without root (they
need a symlink owned by a non-self uid), so they were already recorded
pass there. The TCP legs never run them at all - --daemon-tests-only
drops every cell that cannot reach the daemon transport.
@github-actions github-actions Bot added the bug Something isn't working label Aug 23, 2026
@oferchen
oferchen merged commit b939e8e into master Aug 23, 2026
72 checks passed
@oferchen
oferchen deleted the fix/insecure-links-opt-out branch August 23, 2026 08:16
oferchen added a commit that referenced this pull request Aug 24, 2026
…7477)

The docs were last refreshed at #7423; 55 PRs have merged since, and the
testsuite figures they quote had drifted far enough to understate the
current state by roughly half.

CHANGELOG: fill in Unreleased for everything merged since #7423. The
dominant theme is routing every operator-named auxiliary file open onto
the ownership walk - upstream's open_no_attacker_symlinks() applied at the
call sites upstream applies it - plus a daemon hardening batch and an
alt-dest correctness batch.

README and SECURITY: the per-leg outcome tables were re-derived from the
committed expect manifests rather than carried forward. Failures fell and
the corpus grew, so every figure moved:

  non-root pipe  43 -> 21 fail   (345 -> 349 corpus)
  root pipe      62 -> 29 fail   (345 -> 349 corpus)
  non-root tcp   42 -> 29 fail   (155 -> 158 corpus)
  root tcp       55 -> 38 fail   (155 -> 158 corpus)

Distinct divergences: 64 -> 31 across the two full-corpus legs, 89 -> 55
across all four.

SECURITY, two CVE rows that had gone stale:
- CVE-2026-53790 said "under audit". The refusal has since been applied at
  the live sink - oc-rsync's own single-character config expander, which
  upstream does not have, so an upstream-shaped port alone would have been
  inert (#7465, #7430, #7445).
- CVE-2026-53795 listed only the staging family. The auxiliary-file family
  followed it onto the walk (#7421-#7426, #7439, #7441-#7443, #7459,
  #7463); what remains is the per-option-family confinement.
oferchen added a commit that referenced this pull request Aug 24, 2026
* fix(fast_io): honour --insecure-links in the operator-path walk

The ownership walk refused an untrusted symlink unconditionally, so
--insecure-links could not restore the legacy following it promises.
Four upstream 3.5.0 cells fail on that alone, all with the same text:
"CROSS-UID abs leaf insecure: --insecure-links did not restore symlink
following" - operator-path-{backup-dir,files-from,log-file,write-batch}.

Upstream asks the question inside the walk, not at its callers:
ona_open() opens with `if (symlink_optout_allowed()) return open(path,
flags, mode);` (syscall.c:300-302), which is why the answer reaches
open_no_attacker_symlinks() and owner_walk_parent() alike. The
short-circuit added here sits at the same place and covers this walk's
two entry points for the same reason.

Threading the flag instead would have touched ten call sites across
seven crates and every helper between them, and one un-threaded site
would have gone on confining under an opt-out the operator asked for.
The value is a property of the session, not of the call.

Activation::optout_allowed already spelled the rule out with a
twenty-row truth table and had no production caller. It is now the
thing that computes what the walk reads: install_session stores its
answer, and the two arm-specific constructors say which of upstream's
two disjoint arms the caller is so no site has to invent values for
fields its arm ignores. A daemon's arm needs a selected module, so the
daemon stays on the fully-confined default until that lands.

Note the opted-out branch spells out the empty-path convention:
owner_trusted_parent hands the walk an empty parent for a bare relative
leaf, which the walk resolves by starting at ".", and a plain open()
would report ENOENT.

* test(ci): record the four opt-out cells passing on the root leg

The --insecure-links fix earns these four, so their rows move from fail
to pass in the same change - an unexpected pass is a red leg, never a
silent one.

Generated from a full root pipe-leg run on Linux aarch64 at this commit,
not hand typed. The emitted manifest differed from the committed one in
exactly these four rows plus simd-checksum, which is skip on aarch64 and
pass on the x86_64 runner - a property of the host, not of this change,
so it is deliberately left alone.

The nonroot leg is unchanged: all four cells self-skip without root (they
need a symlink owned by a non-self uid), so they were already recorded
pass there. The TCP legs never run them at all - --daemon-tests-only
drops every cell that cannot reach the daemon transport.
oferchen added a commit that referenced this pull request Aug 24, 2026
…7477)

The docs were last refreshed at #7423; 55 PRs have merged since, and the
testsuite figures they quote had drifted far enough to understate the
current state by roughly half.

CHANGELOG: fill in Unreleased for everything merged since #7423. The
dominant theme is routing every operator-named auxiliary file open onto
the ownership walk - upstream's open_no_attacker_symlinks() applied at the
call sites upstream applies it - plus a daemon hardening batch and an
alt-dest correctness batch.

README and SECURITY: the per-leg outcome tables were re-derived from the
committed expect manifests rather than carried forward. Failures fell and
the corpus grew, so every figure moved:

  non-root pipe  43 -> 21 fail   (345 -> 349 corpus)
  root pipe      62 -> 29 fail   (345 -> 349 corpus)
  non-root tcp   42 -> 29 fail   (155 -> 158 corpus)
  root tcp       55 -> 38 fail   (155 -> 158 corpus)

Distinct divergences: 64 -> 31 across the two full-corpus legs, 89 -> 55
across all four.

SECURITY, two CVE rows that had gone stale:
- CVE-2026-53790 said "under audit". The refusal has since been applied at
  the live sink - oc-rsync's own single-character config expander, which
  upstream does not have, so an upstream-shaped port alone would have been
  inert (#7465, #7430, #7445).
- CVE-2026-53795 listed only the staging family. The auxiliary-file family
  followed it onto the walk (#7421-#7426, #7439, #7441-#7443, #7459,
  #7463); what remains is the per-option-family confinement.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant