Skip to content

ui-sdk: the worker socket walk misses a socket bind-mounted onto a file path #2745

Description

@schlessera

Context

packages/ui-sdk/tests/worker-var-sockets.test.ts proves that no worker profile can see an unapproved socket. The fixture's walk (walkSockets, packages/ui-sdk/tests/fixtures/worker-var-sockets.ts) takes each entry's type from readdir and calls lstat only on entries the filesystem left untyped. That optimization arrived in #2675.

getdents reports the type of the directory entry in the parent filesystem. A bind mount on that entry does not change it. bwrap creates an empty regular file as the mount point for a file bind. So a socket bind-mounted onto a file path (--ro-bind /path/x.sock /dest/x.sock) shows up in the walk as a regular file, and the walk does not report it. lstat on the same path returns the socket.

The fixture's planted sockets are bound through directories (/run/brain-egress) or are reached by connect() checks (VAR_HOST_SOCKET_CONNECTIONS_REFUSED, VAR_CUPS_SOCKET_UNREACHABLE), so no current assertion depends on this. A future mask regression that file-binds a socket would pass the walk's SOCKET_WALK_ONLY_APPROVED_RELAY_AND_PROXY assertion unnoticed.

Found while working #2674.

Scope

Make the walk report sockets mounted on file mount points: lstat every mount point listed in the walking process's /proc/self/mountinfo (outside /proc and /sys), in the fixture's baseline walk and in each worker.

Out of scope

Acceptance criteria

  • A positive control: a socket file-bind-mounted into a path that every profile can see is reported by every profile. The test fails without the mount-point lstat and passes with it.
  • bun run test packages/ui-sdk/tests/worker-var-sockets.test.ts passes.

Verification

bun run test packages/ui-sdk/tests/worker-var-sockets.test.ts, with the failing-first receipt in the PR.

Contract impact

None. Test fixture only.

2026-10-29 dependency-priority reconciliation: this fixture correction directly verifies #1645’s required controlled-egress/socket-isolation output, also required by #1636. Both remain priority p0. Set this prerequisite to priority p0 under the blocker-priority rule; this does not claim an observed production socket leak or change its test-only scope, readiness, assignment or release attribution.

Blocked by #3461

Activity

  1. added
    type: fix
    area: ui-sdk
    agent-ready
    on Oct 23, 2026
  2. schlessera commented on Oct 23, 2026

    @schlessera
    OwnerAuthor

    2026-10-24 restructuring: attached to #1645. Detecting an unapproved socket bind-mounted into a worker verifies that epic's controlled-egress boundary.

  3. added
    priority: p0
    on Oct 29, 2026
  4. self-assigned this
    on Nov 2, 2026
  5. schlessera commented on Nov 2, 2026

    @schlessera
    OwnerAuthor

    Claiming (claim token wi-2745-da387ca5). Branch: fix/2745-socket-walk-mount-points. Collision report for the cited fixture/test paths: closure-only overlaps with open drafts #3054, #3056, #3059, #3069, #3116, #3277, #3278, #3279; no path collisions.

  6. added this to the 0.45.0 milestone on Nov 2, 2026
  7. added
    blocked
    on Nov 2, 2026
  8. schlessera commented on Nov 2, 2026

    @schlessera
    OwnerAuthor

    Outcome (claim wi-2745-da387ca5): implemented in draft PR #3282 (fix/2745-socket-walk-mount-points, head beecb74c8). The walk now lstats mount points from /proc/self/mountinfo. A socket file-bound to /opt/odysseus-file-bound/walk-control.sock is the positive control. Hosted run 41446241074 shows every profile reporting it, and worker-var-sockets passes in unit (4). The failing-first receipt is in the PR: the old walk misses the file-bound socket and the new one reports it. It was taken with single-level bwrap, because this host's AppArmor denies the test's nested bwrap.

    Not merged. The confirmation's browser (3) failed on the unrelated Storybook flake #3267 (second occurrence, now escalated and raised to p0), so proof is red. Hence Blocked by #3267. To resume after #3267 lands: refresh #3282 onto main, run bun scripts/integrate.ts confirm 3282 --issues schlessera/brain-kit#2745, and merge on a fully passing proof. The PR and this issue carry milestone 0.45.0. Releasing my assignment.

  9. removed their assignment
    on Nov 2, 2026
  10. removed
    blocked
    on Nov 2, 2026
  11. schlessera commented on Nov 2, 2026

    @schlessera
    OwnerAuthor

    Unblocked: #3267 is closed by #3286 (squash efea2be3edb69c8eb2e95549fb19852afa07b089 on main, milestone 0.45.0).

    The browser (3) failure on #3282 was the "Layout Phone" artifact story charging a cold lazy FileViewer chunk load to a 1000 ms wait. It was not caused by #3282. The stories now wait for the real lazy imports before those waits. In #3286's candidate run 41454363060, every selected job passed, including all three browser shards, and both ArtifactTheme projects ran 4/4.

    #3282 can be resumed: refresh it onto current main and request candidate confirmation again. Its earlier failed confirmation runs do not count as proof.

  12. self-assigned this
    on Nov 2, 2026
  13. schlessera commented on Nov 2, 2026

    @schlessera
    OwnerAuthor

    Resuming (claim token wi-2745-r2-2e72ad82). Dependency reconciled: #3267 is closed by #3286, so the Blocked by #3267 line is removed. Under the 0.45.0 epic-integration process, #3282 (fix/2745-socket-walk-mount-points) is rebased onto and retargeted to epic/1645-egress-controls. Collision report for #3282 at beecb74c8: closure-only overlaps with open PRs #3054, #3056, #3059, #3069, #3116, #3277, #3279, #3287, #3288, #3290; no path collisions.

  14. added 2 commits that reference this issue on Nov 2, 2026
    eea1f8f
    3c9f48b
  15. schlessera commented on Nov 2, 2026

    @schlessera
    OwnerAuthor

    Delivered to the epic integration branch epic/1645-egress-controls at 3c9f48b92c38a49f60466b257ad33ab9c0c729c3 (squash of #3282, head eea1f8fe8 rebased onto epic head a62db8f27). Candidate confirmation run 41467070753 passed every selected job and proof on the first attempt (pack was intentionally skipped as a tests-only change). Its metadata BASE_SHA/HEAD_SHA and the synthetic merge parents matched the live epic head and the PR head. The epic head was unchanged at merge. This issue stays open and closes when the epic batch lands on main. Milestone 0.45.0 is kept. Releasing my assignment (claim wi-2745-r2-2e72ad82).

  16. removed their assignment
    on Nov 2, 2026
  17. added
    blocked
    on Nov 3, 2026
  18. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Delivered on epic/1645-egress-controls. Its landing on main (#3443) is blocked by #3461: the ready-candidate run 41625377355 failed runtime_host on that issue's maintenance-admission race, which is not rerun into green under the strict-flake rule. The landing resumes once #3461 merges.

  19. removed
    blocked
    on Nov 3, 2026
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

    agent-readyarea: ui-sdkpriority: p0type: fix

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions