Skip to content

--save-script destination can be redirected by other local users who can write an ancestor directory #4565

Open

Description

@thymikee

Purpose

open --save-script=<path> creates a missing parent directory and moves the script into place by rename or link. This happens on the daemon host for a local daemon, and on the client for a remote daemon (#4511).

When another local user can write a directory on the way to the destination, they can swap that directory or plant a symbolic link between the parent's creation and the final rename. Examples are a shared group-writable directory, or a world-writable directory without the sticky bit. The script then lands where they choose, or they can read it from a directory they control. Local and remote recordings have the same exposure.

Options

  • Refuse destinations under a group- or other-writable, non-sticky directory that the user or root does not own. A version of this refused normal Ubuntu/Debian private-group home directories when feat(remote): write the --save-script recording to the caller during the session and at close #4511 tried it, so it needs an exception for a group that holds only the user.
  • Open the parent with O_DIRECTORY | O_NOFOLLOW and publish relative to that directory handle.
  • Document the requirement and warn when an ancestor is writable by others.

Required behavior

  • The chosen rule applies to both local and remote --save-script.
  • Private-group home directories, where each user has a group of their own, keep working.

Completion conditions

  • A test shows that a swapped ancestor directory or a planted symbolic link cannot redirect the script file, for both a local and a remote recording.
  • website/docs/docs/replay-e2e.md describes the rule.

Activity

  1. apex-sentinel-staging commented on Nov 15, 2026

    @apex-sentinel-staging

    Apex Sentinel · Issue review

    Suggested label: bug

    The issue reports a concrete security defect in --save-script handling where writable ancestor directories can let another local user redirect or read the script, and it specifies required behavior plus test/docs completion conditions.

    Required sections

    • Steps to reproduce (missing)
    • Expected and actual behavior (missing)
    • Version or environment (missing)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions