bjowes / cypress-ntlm-auth

Windows authentication plugin for Cypress
MIT License
55 stars 9 forks source link

Unable to connect via NTLM with Upstream proxy #206

Closed Ivaylo-Lafchiev closed 2 years ago

Ivaylo-Lafchiev commented 2 years ago

Cypress Version: v10.1.0 Chrome Version: 102.x cypress-ntlm-auth Version: 4.0.2 OS: Catalina 10.15.7

To give some background, we have a websurfing proxy which uses NTLM authentication. For example, I am able to make Internet requests with curl like this:

curl --proxy-ntlm --proxy-user USER:PASSWORD --proxy http://my-company-proxy.com:PORT https://www.google.co.uk

Following the provided instructions for using upstream Proxy, I am doing the following:

  1. Set HTTP_PROXY=http://my-company-proxy.com:PORT before starting cypress
  2. Using cypress-ntlm open
  3. Running a test with the following snippet:
 beforeEach(() => {
    cy.ntlm(["*.cypress.io"], "USERNAME", "PASSWORD");
    cy.visit("https://example.cypress.io/todo");
  });

  it("displays two todo items by default", () => {
    cy.get(".todo-list li").should("have.length", 2);
  });
  1. Test fails with: "We received this error at the network level: > Error: ESOCKETTIMEDOUT"

I understand NTLM is supposedly a Windows Auth scheme, but apparently it works on Mac as well, at least for regular browsing/curl requests.
Am I missing something here? Do I have a configuration error or is this simply impossible on Mac for some reason?

For reference, setting the proxy and running a regular Cypress test results in a 407 Authentication Error, same as trying to curl without providing the NTLM username/password.

I do also get certificate validation warnings, but as I understood it those are safe to ignore and should not prevent the connection?

Any help is appreciated.

bjowes commented 2 years ago

Sorry but this use case is not supported. The purpose of the plug-in is to authenticate against websites with windows authentication, not to authenticate against an intermediate proxy with windows authentication.

Have a look at https://github.com/genotrance/px

It is designed for your use case. I haven’t used it myself, but I believe you could run cypress tests through it in order to pass through the proxy. This plugin should not be used in that scenario.

fre 24 juni 2022 kl. 17:46 skrev Ivaylo Lafchiev @.***>:

Cypress Version: v10.1.0 Chrome Version: 102.x cypress-ntlm-auth Version: 4.0.2 OS: Catalina 10.15.7

To give some background, we have a websurfing proxy which uses NTLM authentication. For example, I am able to make Internet requests with curl like this:

curl --proxy-ntlm --proxy-user USER:PASSWORD--proxy http://my-company-proxy.com:PORT https://www.google.co.uk

Following the provided instructions for using upstream Proxy, I am doing the following:

  1. Set HTTP_PROXY=http://my-company-proxy.com:PORT before starting cypress
  2. Using cypress-ntlm open
  3. Running a test with the following snippet:

` beforeEach(() => { cy.ntlm(["*.cypress.io"], "USERNAME", "PASSWORD"); cy.visit("https://example.cypress.io/todo"); });

it("displays two todo items by default", () => { cy.get(".todo-list li").should("have.length", 2); }); `

  1. Test fails with: "We received this error at the network level: > Error: ESOCKETTIMEDOUT"

I understand NTLM is supposedly a Windows Auth scheme, but apparently it works on Mac as well, at least for regular browsing/curl requests. Am I missing something here? Do I have a configuration error or is this simply impossible on Mac for some reason?

For reference, setting the proxy and running a regular Cypress test results in a 407 Authentication Error, same as trying to curl without providing the NTLM username/password.

Any help is appreciated.

— Reply to this email directly, view it on GitHub https://github.com/bjowes/cypress-ntlm-auth/issues/206, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCHR3F6QIFITGZCTXASKKTVQXJ3VANCNFSM5ZYH6URA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- /Björn W

Skickat från min iPhone

Ivaylo-Lafchiev commented 2 years ago

Ah, apologies. Thanks for the clarification.