Repository navigation
Test: Require TLS 1.2 in Gerrit TLS test server - #527
Merged
ModeSevenIndustrialSolutions merged 1 commit intoNov 2, 2026
Merged
ModeSevenIndustrialSolutions merged 1 commit into
ModeSevenIndustrialSolutions merged 1 commit into
Conversation
The tls_server fixture built its server context with ssl.PROTOCOL_TLS_SERVER and no minimum version, so it still accepted TLSv1 and TLSv1.1. CodeQL flags this as py/insecure-protocol (alert 482). Set the context's minimum version to TLSv1.2 before loading the certificate chain, matching what the client under test negotiates. This is the only ssl.SSLContext construction in the repository. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>
ModeSevenIndustrialSolutions
approved these changes
Nov 2, 2026
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the test-fixture change requiring TLS 1.2 or newer, with production code unchanged.
No open issues 🎉
What changed in this PR
Explicitly requires TLS 1.2 or newer in the Gerrit REST client’s TLS test server fixture, addressing the insecure-protocol alert tracked in #526. Production code is unchanged.
Changes:
- Sets the server context’s minimum TLS version immediately after construction, before loading its certificate chain.
| File | Description |
|---|---|
tests/test_gerrit_rest_client.py |
Sets tls_server’s minimum protocol version to TLS 1.2. |
Review effort: Balanced
3 tasks
ModeSevenIndustrialSolutions
merged commit Nov 2, 2026
677880b
into
lfreleng-actions:main
34 checks passed
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.
Closes #526
Authored by an AI agent; human review required
claude-opus-5.5via GitHub Copilot CLI03c617aa6ef9f5075f9a357590f11c0853271446uv run pytest tests/test_gerrit_rest_client.py -quv run pytest tests/test_gerrit_rest_client.py -q --no-covuv run pytest -qprek run --files tests/test_gerrit_rest_client.pyaislop scan --changes --jsongit commit -s (pre-commit and commit-msg hooks)The
github-code-monkey-botworkflow opened this pull request.Nobody has merged it; a maintainer must review it first.
Review findings on this pull request are answered by a later revision round of this workflow, up to ten rounds; a maintainer must act on any finding that remains after that, and reviews every round before merge.
What changed
The
tls_serverfixture intests/test_gerrit_rest_client.pybuilt its server context withssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)and set no minimum protocol version, so the test server still accepted TLSv1 and TLSv1.1. CodeQL reports this as alert 482 (py/insecure-protocol, high).The fixture now sets
context.minimum_version = ssl.TLSVersion.TLSv1_2right after it builds the context and beforeload_cert_chain. The fixture then matches what the client under test is expected to negotiate. The alert is fixed in the code. It is not dismissed or suppressed.A grep for
SSLContext(acrosssrc/andtests/finds no other construction, so no other file needed this change.Validation
uv run pytest tests/test_gerrit_rest_client.py -q --no-cov: all tests pass, including the 15 uses of thetls_serverfixture. Without--no-cov, the targeted run fails only on the project-wide 65% coverage gate, because one file covers 16%.uv run pytest -q(full suite): passes, with 76.40% coverage.prek run --files tests/test_gerrit_rest_client.py: all hooks pass. The commit-time hooks, gitlint included, also pass.aislop scan --changes --json, with the project venv onPATHso the lint and format engines run: emptydiagnostics, and no engine skipped. This repository does not includescripts/agents/aislop-gate.sh, so the scan ran directly.For reviewers
requests/urllib3context, which already requires TLS 1.2, so the TLS tests still negotiate the same way.