Skip to content

Keep certificate checks on in the usage sharing example - #116

Merged
jwrosewell merged 2 commits into
rcfrom
fix/shareusage-certificate-checks
Nov 13, 2026
Merged

jwrosewell merged 2 commits into
rcfrom
fix/shareusage-certificate-checks

Conversation

@jwrosewell

@jwrosewell jwrosewell commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Closes #51.

Problem

The on-premise usage sharing example replaced requests.post for the whole process with a version that passes verify=False, and silenced urllib3's InsecureRequestWarning (shareusage.py lines 68 to 73 on rc). So the usage data the example sends to https://devices-v4.51degrees.com/new.ashx, and every other requests.post in the same process, went over HTTPS without checking the server's certificate, and nothing was logged. The comment said it was for testing, but the example is the code people copy into their own applications, and no other example or package here turns certificate checks off.

What changed

  • The six lines and their comment are removed from shareusage.py, so the example sends with certificate checks on, as the ShareUsage element does by default.
  • test_shareusage_certificate_checks.py is new. It reads the example's source and fails if the example assigns to requests.post, passes a verify argument or sets a verify key, or calls disable_warnings. It reads the source rather than running the example, so it needs no data file and no network.

Nothing relied on the lines. No test runs the usage sharing example, and the example's own endpoint, https://devices-v4.51degrees.com/new.ashx, has a certificate that a normal check accepts.

The examples package is tested but never published, so the release plan releases nothing for this change.

How it was verified

Both runs are temporary branches holding a workflow that installs the pipeline packages from the checkout into a virtual environment of the runner's own Python (3.12.3 on Ubuntu, 3.12.10 on Windows) and runs the new test with pytest.

  • Red, rc at df0949d7 with the new test, commit da28865f, run 43479727528, failed on ubuntu-latest and windows-latest with 3 failed, being test_does_not_replace_requests_post, test_does_not_turn_off_certificate_checks and test_does_not_silence_certificate_warnings.
  • Green, head 0678b496, run 43479745896, passed on both with 3 passed.
  • Full build, run 43480128738, started by tools/pr-matrix.py on tmp/pr-matrix-116, finished with success. Configure printed "Left out 5 macOS entries", all ten Build and Test jobs (Ubuntu and Windows, Python 3.10 to 3.14) passed, and all eleven Setting 'PullRequestSha' lines read 0678b496fdd25437afc274dc3d20e8a79bfe08fb, this head. macOS was left out of this draft's full build under the 9 November decision. The rc head is built with macOS before it merges into main.
  • Quick checks passed on this head, being run 43480099355 (environment variable names), run 43480100014 (only rc into main) and run 43480099353 (link campaign tags).

The last release into main was #114, merged at 06:22 UTC on 13 November.

@jwrosewell
jwrosewell marked this pull request as ready for review November 13, 2026 23:27
@jwrosewell
jwrosewell merged commit f084e85 into rc Nov 13, 2026
3 checks passed
@jwrosewell
jwrosewell deleted the fix/shareusage-certificate-checks branch November 13, 2026 23:27
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.

1 participant