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(client): configurable certificate verification #320

Merged
merged 3 commits into from
Nov 27, 2023

Conversation

iainsproat
Copy link
Contributor

Description & motivation

Currently the client always validates the certificate. This is secure behaviour and should continue to be the default.

In certain conditions, for example when using specklepy with a server in a test environment, the server may not be able to present a valid certificate.

In these conditions it is helpful to be able to disable certificate verification.

Changes:

  • additional optional argument to pass to the client to enable or disable certificate verification
  • if no value is passed it defaults to true

To-do before merge:

Screenshots:

Validation of changes:

Checklist:

  • My pull request follows the guidelines in the Contributing guide?
  • My pull request does not duplicate any other open Pull Requests for the same update/change?
  • My commits are related to the pull request and do not amend unrelated code or documentation.
  • My code follows a similar style to existing code.
  • I have added appropriate tests.
  • I have updated or added relevant documentation.

References


def __init__(self, host: str = DEFAULT_HOST, use_ssl: bool = USE_SSL) -> None:
def __init__(self, host: str = DEFAULT_HOST, use_ssl: bool = USE_SSL, verify_certificate: bool = VERIFY_CERTIFICATE) -> None:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gjedlicska - should this line be wrapped?
As a side quest, there should probably be a linter running in CI that would catch long lines like this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I completed the side-quest, but it threw up a lot of python linting issues: #321

@iainsproat iainsproat marked this pull request as ready for review November 24, 2023 15:59
Copy link

codecov bot commented Nov 24, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (4e96aad) 90.36% compared to head (7ad0785) 90.36%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #320   +/-   ##
=======================================
  Coverage   90.36%   90.36%           
=======================================
  Files          89       89           
  Lines        5335     5337    +2     
=======================================
+ Hits         4821     4823    +2     
  Misses        514      514           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gjedlicska gjedlicska merged commit ae6fc85 into main Nov 27, 2023
5 checks passed
@gjedlicska gjedlicska deleted the iain/configurable-certificate-verification branch November 27, 2023 13:36
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.

None yet

2 participants