npm / npm/cli

[BUG] npm can't pick up PAC file for proxy auto-configuration

Open
#5,144 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Enhancement Priority 2 Release 8.x
Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

Description

Is there an existing issue for this?
  • I have searched the existing issues
This issue exists in the latest npm version
  • I am using the latest npm
Current Behavior

In the organization I work at, for security reasons, to connect to the outside internet there's an HTTP proxy server in the middle configured with a PAC file. https://docs.microsoft.com/en-us/windows/win32/winhttp/winhttp-autoproxy-support

npm can't reach out to the registry without that configuration, so my workaround is to use a secondary reverse proxy locally, but that isn't the most optimal solution by any means.

Expected Behavior

npm should be able to pick up the pac file's location from IE's settings, read it, and use the appropriate proxy, using user default credentials if applicable (such as the case of an NTLM-based proxy server or one using Kerberos authentication).

Steps To Reproduce
  1. Install an HTTP(S) proxy server that requires Kerberos authentication.
  2. Restrict network connectivity so internet can only go through that proxy.
  3. Run npm update -g
  4. Wait for it to time out as it can't figure out that proxy.
Environment
  • npm: 8.13.2
  • Node.js: 16.15.1
  • OS Name: Windows 10
  • npm config:
null = ""
registry = "http://localhost:8080/"
strict-ssl = true

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

Start by tracing the proxy configuration used when running npm update -g on Windows, then investigate how the PAC file location from IE settings and WinHTTP auto-proxy support could be used. Reproduce with a Kerberos-authenticated proxy and restricted internet access; done means npm selects the PAC-provided proxy and authenticates with the user's default credentials.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
authentication, cli, networking
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.