microsoft / microsoft/playwright-dotnet

[Feature] Allow to specify custom drivers path (for security reasons)

Open
#2,317 7 comments 10 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P3-collecting-feedback
Dominant language
C#
Stars
3k
Forks
305
Avg merge
20h 47m
Merged PRs (30d)
6

Description

We use playwright to serve PDF files in an ASP.NET Web Application (currently .NET 4.8 with IIS but soon .NET core with IIS).

For security reasons all files of the Web Application are on a separate drive at P:\Projects\ProjectName\Website. On that drive Users have no access, just the App-Pool user can access files of the appropriate Project itself. This way all applications are isolated from each other. There were security bulletins in the last years highly recommending that approach.

In that setup Playwright fails, because node can't open files in P:\Projects\ProjectName\.playwright\, unless the App-Pool user has Read-Permission on both P:\ and P:\Projects. Otherwise it throws PlaywrightException: Process exited (details below). But this breaks the security aspects of isolating each application completely.

It's probably an issue of node which can't handle permissions just granted on a deeper level than on the root of a drive. Probably it's not on the top priorities of node to ever fix that.

Suggestion:
It would be valuable if the location of the .playwright directory could be specified in this case. Currently the .playwright directory must always be in the Application's directory. If it could be at a custom location, security can be configured as needed for node.

This is related to #2241 but affects both .NET 4.8 and ASP.NET Core. I could imagine that other projects will also benefit, if that .playwright directory could be in a custom path, for various reasons. #2241 would already solve that need.

Exception details (captured in transport.LogReceived):

node:internal/fs/utils:345 
    throw err; 
    ^ 
 
Error: EPERM: operation not permitted, lstat 'P:\' 
    at Object.realpathSync (node:fs:2461:5) 
    at toRealPath (node:internal/modules/cjs/loader:394:13) 
    at Function.Module._findPath (node:internal/modules/cjs/loader:550:22) 
    at resolveMainPath (node:internal/modules/run_main:19:25) 
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:71:24) 
    at node:internal/main/run_main_module:17:47 { 
  errno: -4048, 
  syscall: 'lstat', 
  code: 'EPERM', 
  path: 'P:\\' 
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named; start by tracing how the .playwright directory is located for .NET 4.8 and ASP.NET Core, using the EPERM stack trace and related issue #2241 as context. Done means callers can configure a separate drivers path and Playwright starts successfully without requiring access to the drive root.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, node.js
Domain
devtools, testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.