Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor SSL socket handling to use wrap_socket_to_ssl method #980

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tanaydin
Copy link
Contributor

Update test_ssl.py, socket.py, and ssl.py to replace direct calls to ssl.wrap_socket with a new wrap_socket_to_ssl function. Adjust test cases accordingly to ensure proper integration and functionality. This improves code organization and makes SSL socket wrapping more explicit.Refactor SSL socket wrapping logic

Moved SSL socket wrapping to a dedicated function wrap_socket_to_ssl within the ssl.py module, improving code modularity and readability. Updated the imports and references across the codebase to reflect this change, enhancing maintainability and reducing redundancy.

Proposed change

Your PR description goes here.

Type of change

  • New core framework functionality
  • Bugfix (non-breaking change which fixes an issue)
  • Code refactoring without any functionality changes
  • New or existing module/payload change
  • Localization improvement
  • Dependency upgrade
  • Documentation improvement

Checklist

  • I've followed the contributing guidelines
  • I've run make pre-commit, it didn't generate any changes
  • I've run make test, all tests passed locally

return socket_connection, ssl_flag
def wrap_socket_to_ssl(socket_connection):
context = ssl.SSLContext()
return context.wrap_socket(socket_connection)

Check failure

Code scanning / CodeQL

Use of insecure SSL/TLS version High

Insecure SSL/TLS protocol version TLSv1 allowed by
call to ssl.SSLContext
.
Insecure SSL/TLS protocol version TLSv1_1 allowed by
call to ssl.SSLContext
.
@tanaydin tanaydin force-pushed the fix-for-ssl-wrap-socket-py312 branch 6 times, most recently from b54be42 to 93848a5 Compare December 12, 2024 18:34
Update `test_ssl.py`, `socket.py`, and `ssl.py` to replace direct calls to `ssl.wrap_socket` with a new `wrap_socket_to_ssl` function. Adjust test cases accordingly to ensure proper integration and functionality. This improves code organization and makes SSL socket wrapping more explicit.Refactor SSL socket wrapping logic

Moved SSL socket wrapping to a dedicated function `wrap_socket_to_ssl` within the `ssl.py` module, improving code modularity and readability. Updated the imports and references across the codebase to reflect this change, enhancing maintainability and reducing redundancy.
@tanaydin tanaydin force-pushed the fix-for-ssl-wrap-socket-py312 branch from 93848a5 to e0ef65e Compare December 12, 2024 18:49
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