test(util): cover create_no_verify_ssl_context security invariants#287
Draft
bluetoothbot wants to merge 2 commits into
Draft
test(util): cover create_no_verify_ssl_context security invariants#287bluetoothbot wants to merge 2 commits into
bluetoothbot wants to merge 2 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
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.
What: Add a unit test locking down the security invariants of
create_no_verify_ssl_context().Why: This helper builds the SSL context used for every HTTPS call to a camera. It intentionally disables cert and hostname verification (cameras ship self-signed certs) and enables
OP_LEGACY_SERVER_CONNECTfor old firmware. It was the only untested public function inonvif/util.py— a regression that accidentally re-enabled verification or dropped legacy connect would silently break connectivity to real devices with no test to catch it.How: Asserts observable behavior of the returned context —
check_hostname is False,verify_mode is CERT_NONE, and the legacy-connect option bit is set. No production code changed.Testing:
.venv/bin/python -m pytest tests/test_util.py -q→ 26 passed.Quality Report
Changes: 87 files changed, 9573 insertions(+), 1474 deletions(-)
Code scan: 20 issue(s) found
README.rst:61— debug print statementREADME.rst:111— debug print statementexamples/events.py:20— debug print statementexamples/events.py:24— debug print statementexamples/events.py:25— debug print statementexamples/events.py:27— debug print statementexamples/events.py:29— debug print statementexamples/events.py:62— debug print statementexamples/events.py:74— debug print statementexamples/events.py:84— debug print statementTests: failed (FAILED)
Branch hygiene: clean
Generated by Kōan