Skip to content

[Bug]: Socket and transform cache directories in a shared /tmp are not private to the user #43698

Closed

Description

Version

main (1.65.0-next)

Steps to reproduce

On Linux with a shared /tmp and two users, A and B:

  1. As B, before A runs anything: mkdir -m 777 /tmp/playwright-transform-cache-<uid of A> and mkdir -m 777 /tmp/pw-<first 8 hex chars of sha1($USER of A)>.
  2. As A, run npx playwright test, and start a CLI session (npx playwright cli open).
  3. As B, list both directories.

Expected behavior

Playwright creates these directories with mode 0700 and does not use a directory that another user owns.

Actual behavior

A uses B's directories:

  • The transform cache (packages/playwright/src/transform/compilationCache.ts) reads and writes transpiled test code there. B can read it, and can put entries there that A's runner executes. The entry header only detects partial writes.
  • The CLI daemon, dashboard and browser.bind sockets (makeSocketPath in packages/utils/fileUtils.ts) are created there, so B can replace them.

Without step 1, both directories are created with mode 0755, so other users can read the cached test code.

macOS and Windows use a per-user temp directory and are not affected.

Activity

  1. github-actions commented on Oct 29, 2026

    @github-actions
  2. github-actions commented on Oct 29, 2026

    @github-actions
    Contributor

    Hi, I'm the Playwright bot and I reproduced this on Linux.

    Reproduced on 1.65.0-next (ac44835d064d1e824ed1ba8b9f544f3493ec3dbe). The default cache and socket directories accept directories owned by another user. The proposed fix creates or restricts these directories to mode 0700 and rejects foreign-owned directories and symlinks before use, including cache hits.

    Verification

    On main, the cache and CLI socket-directory tests create directories with mode 0755. A separate probe using world-writable default directories owned by UID 65534 confirms that UID 1001 accepts both a benign cache entry and a Chromium browser.bind() socket directory. The cache entry is inspected, not executed.

    The fix rejects both foreign-owned directories and a symlinked cache root containing a cache hit. The cache and loader suites pass all 96 tests; the CLI session suite passes all 75 tests across Chromium, Firefox, and WebKit. Build and npm run flint pass. All checks were run on Linux.

    Draft fix: #43751

    Triaged on Linux by the Playwright bot - agent run

  3. yury-s commented on Oct 29, 2026

    @yury-s
    MemberAuthor

    It has been fixed by #43732 and #43733

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions