Remove insecure SSL context creation in Triton Python backend #5375
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.
Issue #, if available: https://t.corp.amazon.com/P346071810, #5372
Summary of Changes
This PR removes the following line from
triton_python_backend_utils.py:ssl._create_default_https_context = ssl._create_unverified_contextReason for Change
This line globally disabled SSL certificate verification for the Python process.
Risk Assessment & Verification
I performed a two-step verification to ensure removing this line does not cause regressions for users downloading models or artifacts at runtime.
1. Functional Regression Test
ModelBuilderwith the Triton backend.2. Environment Network Security Test
sagemaker-tritonserver:23.02-py3-cpu) has valid Root CA certificates installed and can perform a standard SSL handshake.urllibwithout the insecure bypass.docker run --rm --entrypoint python3 <IMAGE_URI> -c "import urllib.request; print(urllib.request.urlopen('https://www.python.org').getcode())"Conclusion
The base image correctly handles SSL verification. The insecure workaround is redundant and unsafe, and has been removed.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.