Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clientCertificates is not working #29900

Open
787681277 opened this issue Jul 22, 2024 · 1 comment
Open

clientCertificates is not working #29900

787681277 opened this issue Jul 22, 2024 · 1 comment
Labels
stage: needs information Not enough info to reproduce the issue

Comments

@787681277
Copy link

787681277 commented Jul 22, 2024

Current behavior

The login of our company's system relies on the certificate of the local computer.
If the certificate cannot be detected, the message "Invalid Certificate Error" will be displayed and the login will fail. According to the document https://docs.cypress.io/guides/references/client-certificates#__docusaurus_skipToContent_fallback, we added client-certificates, but it does not seem to take effect. The Certificate viewer on the Chrome browser opened by Cypress still shows Cypress Proxy CA.
Is there any way to debug whether the client-certificates code is effective?
12

Desired behavior

  1. The insecure-content label should not be displayed to the left of the URL address bar.
  2. Certificate should be valid instead of invalid
  3. Custom certificate should be displayed on "Certificate Viewer"
  4. User can login correctly. No "Invalid Certificate Error" is displayed when click "SSO" login button

Test code to reproduce

cypress.config.js:

const { defineConfig } = require("cypress");

module.exports = defineConfig({
  e2e: {
    setupNodeEvents(on, config) {
      // implement node event listeners here
      on('before:browser:launch', (browser = {}, launchOptions) => {
        // `args` is an array of arguments that will be passed to the browser
        // when it is launched
        console.log('launchOptions.args:',launchOptions.args)

        if (browser.name === 'chrome') {
          launchOptions.args.push('--enable-automation');
          launchOptions.args.push('--ignore-certificate-errors');
          launchOptions.args.push('--allow-running-insecure-content');
          launchOptions.args.push('--auto-open-devtools-for-tabs');
          launchOptions.args.push('--disable-web-security');
        }
        return launchOptions;
      })
    },
    "chromeWebSecurity": false,
    "experimentalModifyObstructiveThirdPartyCode": true,
    "baseUrl": "https://projectqa.com/",
    "clientCertificates": [
      {
        "url": "https://projectqa.com/",
        "ca": [],
        "certs": [
          {
            "pfx": "./cypress/softcerts/astandardu001.pfx",
            "passphrase": "./cypress/softcerts/pfx-passphrase.txt",
          },
        ],
      },
    ],
   
  
  },
});

E2E:

/// <reference types="cypress" />

describe('example to-do app', () => {
    beforeEach(() => {
      // Cypress starts out with a blank slate for each test
      // so we must tell it to visit our website with the `cy.visit()` command.
      // Since we want to visit the same URL at the start of all our tests,
      // we include it in our beforeEach function so that it runs before each test
      cy.visit('https://projectqa.pwc.com/')
    })

    it('Does not do much!', () => {
      expect(true).to.equal(true)
    })
})

Cypress Version

13.13.1

Node version

v18.17.1

Operating System

macOS 13.6.7

Debug Logs

No response

Other

No response

@jennifer-shehane
Copy link
Member

Are the browser launch arguments working as a workaround? I'm not sure why this wouldn't be working. We don't have any current issues opened for clientCertificates not working.

@jennifer-shehane jennifer-shehane added the stage: needs information Not enough info to reproduce the issue label Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stage: needs information Not enough info to reproduce the issue
Projects
None yet
Development

No branches or pull requests

2 participants