-
Notifications
You must be signed in to change notification settings - Fork 264
Add support for disabling SSL verification in GitLab client #1364
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
base: master
Are you sure you want to change the base?
Add support for disabling SSL verification in GitLab client #1364
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds SSL certificate verification configuration to the GitLab HVCS client by passing the ssl_verify parameter to the gitlab.Gitlab constructor.
- Adds
ssl_verify=not allow_insecureparameter when initializing the GitLab client to properly handle SSL/TLS certificate verification
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Thank you for contributing to PSR to help make it better for everyone.
It was actually not intended for this purpose but I am amenable to adapting it to allow insecure SSL configurations. With this in mind, it is important to update the documentation around the Separately, we would also need to enable
Although, I appreciate you have tested it manually, that does not help us prevent regressions in the future. This should be a fairly simple mocking action of the requests library to simulate the SSL failure exception right?
I am glad you listed out your methodology as that is very helpful for understanding the workflow tested. However, I am confused about why you used the publish command? The publish command is disabled for GitLab--did you mean version? Lastly, please only complete the PR checklist when you have completed the actions requested. |
|
This PR has not received a response in 14 days. If no response is received in 7 days, it will be closed. We look forward to hearing from you. |
|
This PR was closed because no response was received. |
Purpose
This pull request fixes a bug where
python-semantic-releasefails to create releases on self-hosted GitLab instances that use self-signed or internally-issued SSL certificates.When the
insecure = trueflag is set inpyproject.toml, the release process currently fails with anSSLCertVerificationError, preventing users from publishing releases in their private GitLab environments. This PR ensures that theinsecureflag is correctly honored.Solves:
requests.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failedwhen runningsemantic-release publishagainst a self-hosted GitLab instance.Rationale
The root cause of the issue is that the
allow_insecureparameter in thesemantic_release.hvcs.gitlab.Gitlabclass was not being passed down to the underlyingpython-gitlabclient.The
gitlab.Gitlabconstructor accepts anssl_verifyparameter, which defaults toTrue. Thepython-semantic-releasewrapper did not utilize theallow_insecureflag to modify this behavior. As a result, thepython-gitlabclient always attempted to verify SSL certificates, regardless of the user's configuration inpyproject.toml.The solution is to explicitly pass
ssl_verify=not allow_insecureduring the initialization of thegitlab.Gitlabclient withinsemantic_release/hvcs/gitlab.py. This directly connects the configuration option to the client's behavior, making theinsecureflag work as intended.Workarounds like setting
REQUESTS_CA_BUNDLEorGITLAB_SSL_VERIFYenvironment variables were considered but are less ideal as they require extra configuration in the user's CI/CD environment rather than fixing the bug at its source.How did you test?
This change was validated through manual end-to-end testing in a CI/CD environment that replicates the original issue.
Methodology:
python-semantic-releaseand applied the code change on a new branch.pyproject.tomlfile was configured with the following remote settings:python-semantic-releasedirectly from the forked Git repository and branch.- uv pip install "git+https://github.com/your-username/python-semantic-release.git@fix/gitlab-ssl-verify"semantic-release publishcommand.SSLCertVerificationError.publishstep, creating a new release in the self-hosted GitLab project.No edge cases were identified, as this change simply wires a boolean flag to its intended destination. Existing unit tests continue to pass.
How to Verify
A reviewer can verify this fix by following these steps:
pyproject.tomlas follows:python-semantic-release.semantic-release publish.mainbranch, which should fail with theSSLCertVerificationError.PR Completion Checklist