Skip to content

feat: add fallback for searching a proper client certificate for a host [INS-3680]#7259

Merged
CurryYangxx merged 4 commits intodevelopfrom
feat/client-cert-fallback
Apr 15, 2024
Merged

feat: add fallback for searching a proper client certificate for a host [INS-3680]#7259
CurryYangxx merged 4 commits intodevelopfrom
feat/client-cert-fallback

Conversation

@CurryYangxx
Copy link
Member

@CurryYangxx CurryYangxx commented Apr 11, 2024

changes:

  • add a util function filterClientCertificates and add fallback mechanism (don't check port matching) for finding client certificate
  • add a new param needCheckPort in urlMatchesCertHost
  • use filterClientCertificates in both https and wss logic
  • add test case

@CurryYangxx CurryYangxx marked this pull request as draft April 11, 2024 07:55
@CurryYangxx CurryYangxx changed the title feat: add fallback for searching a proper client certificate for a host feat: add fallback for searching a proper client certificate for a host [INS-3680] Apr 11, 2024
@CurryYangxx CurryYangxx requested a review from a team April 11, 2024 08:29
@CurryYangxx CurryYangxx marked this pull request as ready for review April 11, 2024 08:30
expect(urlMatchesCertHost(certificateHost, requestUrl)).toBe(false);
});

it('should return true if the request URL and certificate host have different ports and the needCheckPort parameter is false', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the case below return true?

      const requestUrl = 'https://www.example.org:1234/some/resources?query=1';
      const certificateHost = 'https://www.example.org';

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I added more test cases and the results are meet the requirements

ihexxa
ihexxa previously approved these changes Apr 12, 2024
Copy link
Contributor

@ihexxa ihexxa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably we should consider to add a test case as @notjaywu proposed, otherwise lgtm.

@CurryYangxx CurryYangxx force-pushed the feat/client-cert-fallback branch from 898d82d to 4b2ae87 Compare April 12, 2024 03:46
@CurryYangxx CurryYangxx merged commit 259a502 into develop Apr 15, 2024
@CurryYangxx CurryYangxx deleted the feat/client-cert-fallback branch April 15, 2024 02:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants