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

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

Merged
merged 4 commits into from
Apr 15, 2024

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
@@ -38,6 +38,12 @@ describe('urlMatchesCertHost', () => {
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 merged commit 259a502 into develop Apr 15, 2024
7 checks passed
@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