microsoft / microsoft/azure-devops-python-api

[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get issuer certificate (_ssl.c:1007)

未关闭
#507 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Python
星标
684
派生
218
平均合并
8 天 10 小时
30 天内合并 PR
1

描述

Running a pipeline on one of our ADO server I try to run the same script but it is connecting to another server

I tried using the local certificate and I tried disabling SSL check at all

Getting a connection works fine, but trying to get projects :

project_client = self.connection.clients_v7_1.get_core_client()

I always get this error

Error occurred in request., SSLError: HTTPSConnectionPool(host='**********', port=443): Max retries exceeded with url: /companyname/_apis (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get issuer certificate (_ssl.c:1007)')))

I tried using the CA path
I tried disabling SSL at all
I tried to run the pipeline on different pools too

I am out of ideas, any help appreciated

class Ado:
   def init_ssl_env(self):
        if not os.path.exists(Ado.certificate_path):
            return

        try:
            if self.verify_ssl:
                # Option 1: Set CA bundle to custom certificate
                os.environ['REQUESTS_CA_BUNDLE'] = Ado.certificate_path
                self.logger.info(f"Enable SSL check - REQUESTS_CA_BUNDLE = {Ado.certificate_path}")
            else:
                # Option 2: Disable SSL verification globally (not recommended for production)
                os.environ['PYTHONHTTPSVERIFY'] = '0'
                self.logger.info(f"Disable SSL check - PYTHONHTTPSVERIFY = 0")

        except Exception as e:
            self.logger.error(f"Error setting SSL: {str(e)}")
            sys.exit(1)

Here is how I get my connection:

def get_api_connection(self,url):
        '''
        Sets up a connection with the Azure Devops API via the Azure Devops python API
        (https://github.com/microsoft/azure-devops-python-api/tree/dev)

        Parameters:
            org_url (string): url of the organization

        Returns:
            <class 'azure.devops.connection.Connection'>: connection with the Azure Devops API
        '''
        _url = f"https://{url}"
        self.url = url
        try:
            credentials = BasicAuthentication('', f"{Ado.servers[url]}")
            self.connection = Connection(base_url = _url, creds = credentials)
            self.logger.info(f'Azure Devops Connection established successfully with {_url}.')
            return True
        except Exception:
            self.logger.exception(f'Error setting up Azure DevOps connection with {_url}.')
            return False

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从报告中描述的 Connection(base_url, creds) 入口点和 get_core_client() 调用开始,然后跟踪 HTTPS 证书验证的配置方式。使用报告中的 CA 设置重现项目列表请求,并确定在不禁用验证的情况下,该请求是否能针对 ADO 服务器成功执行。

由索引模型根据 Issue 内容生成。

评估

技术栈
azure, python
领域
api, security
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。