Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds TLS certificate fingerprint pinning support to NanoKVMClient (to support self-signed NanoKVM HTTPS deployments) and allows consumers to provide an external aiohttp.ClientSession (e.g., shared Home Assistant sessions). Includes a helper to fetch a remote certificate fingerprint and adds tests/docs for the new flow.
Changes:
- Add
ssl_fingerprintpinning support and asessionkwarg toNanoKVMClient; pass SSL configuration per request / websocket. - Add
async_fetch_remote_fingerprint()utility to retrieve a server cert SHA-256 fingerprint for TOFU pinning. - Add new integration tests for pinning with a real local HTTPS server; update README; update testing extras.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
nanokvm/client.py |
Adds session injection and ssl_fingerprint support; updates SSL handling for HTTP + WS requests. |
nanokvm/utils.py |
Adds async helper to fetch remote TLS certificate fingerprint. |
tests/test_client.py |
Adds test coverage for external-session lifecycle behavior. |
tests/test_certificate_pinning.py |
Adds integration tests spinning up a real HTTPS server to validate pinning flow. |
README.md |
Documents certificate pinning usage and updates SSL configuration options. |
pyproject.toml |
Adds cryptography to testing extra (currently redundant with main deps). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support for SSL pinning as part of the preferred authentication mechanism.
The flow is a little verbose due to aiohttp and Python's
sslmodule not providing the invalid SSL certificate as part of the error (from which we could compute the fingerprint), requiring us to do things a little verbosely:As part of this change, I've modified the constructor to accept an (optional)
sessionkwarg. This allows you to pass in an externalsessionobject (Home Assistant prefers to use a shared session wherever possible):CC @chiconws