This is an automated email from the ASF dual-hosted git repository.

abeizn pushed a commit to branch release-v0.18
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/release-v0.18 by this push:
     new d5b613fba fix: Whitelist external source providers types (#5953)
d5b613fba is described below

commit d5b613fba41ed37306411b0e6beb55afe83f3797
Author: Klesh Wong <[email protected]>
AuthorDate: Fri Aug 25 11:18:27 2023 +0800

    fix: Whitelist external source providers types (#5953)
    
    To fetch external repositories from AzDO API, we have to get "service 
endpoints" ids.
    But not all service endpoints are source providers, so we need to filter 
them to keep
    only those whose type is a supported provider type
    
    Co-authored-by: Camille Teruel <[email protected]>
---
 backend/python/plugins/azuredevops/azuredevops/main.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/backend/python/plugins/azuredevops/azuredevops/main.py 
b/backend/python/plugins/azuredevops/azuredevops/main.py
index ac0d27dda..a58d53591 100644
--- a/backend/python/plugins/azuredevops/azuredevops/main.py
+++ b/backend/python/plugins/azuredevops/azuredevops/main.py
@@ -29,6 +29,9 @@ from pydevlake.pipeline_tasks import gitextractor, refdiff
 from pydevlake.api import APIException
 
 
+_SUPPORTED_EXTERNAL_SOURCE_PROVIDERS = ['github', 'githubenterprise', 
'bitbucket', 'git']
+
+
 class AzureDevOpsPlugin(Plugin):
 
     @property
@@ -93,7 +96,10 @@ class AzureDevOpsPlugin(Plugin):
             yield repo
 
         for endpoint in api.endpoints(org, proj):
-            provider = endpoint['type']
+            provider = endpoint['type'].lower()
+            if provider not in _SUPPORTED_EXTERNAL_SOURCE_PROVIDERS:
+                continue
+
             res = api.external_repositories(org, proj, provider, 
endpoint['id'])
             for repo in res.json['repositories']:
                 props = repo['properties']

Reply via email to