Skip to content

Conversation

ngeorger
Copy link
Member

Potential fix for https://github.com/sredevopsorg/copyparty/security/code-scanning/9

To remediate the issue, we must ensure that insecure protocols such as TLSv1.0 and TLSv1.1 are not allowed, by explicitly setting the minimum accepted protocol in the SSL context to TLSv1.2 or higher. This entails, after creating the SSL context on line 168, adding code to set ctx.minimum_version = ssl.TLSVersion.TLSv1_2 (for Python >=3.7), or, for earlier Python versions, disabling them via context options: ctx.options |= ssl.OP_NO_TLSv1 | ssl.OP_NO_TLSv1_1. Since we don't know the Python version at runtime, we should add a version check. The best way is to set the minimum version for modern Python, and fall back to disabling protocols via context options for old Python.

This change should be done right after context creation (line 168), to ensure all connections use only secure protocol versions. We need to add import sys if not already present for the version check. The fix must be implemented within the scope shown, so all edits should be within copyparty/httpconn.py. No functional changes to the rest of the code are required.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…version

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Nicolás Georger <[email protected]>
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