Skip to content

Commit 20a88ef

Browse files
authored
Merge pull request #1155 from TG1999/add_conan
Add support for conan advisories
2 parents e4849ff + 45f1fe2 commit 20a88ef

File tree

7 files changed

+172
-142
lines changed

7 files changed

+172
-142
lines changed

CHANGELOG.rst

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,21 @@ Release notes
22
=============
33

44

5+
Next Release
6+
--------------
7+
8+
- We added loading of env for GitHub datasource in vulntotal.
9+
- We fixed import process in github importer in vulnerablecode reported here
10+
https://github.com/nexB/vulnerablecode/issues/1142.
11+
- We added an improver to get all package versions
12+
of all ecosystems for a range of affected packages.
13+
- We added documentation for configuring throttling rate for API endpoints.
14+
- We fixed kbmsr2019 importer.
15+
- We added support for conan advisories through gitlab importer.
16+
17+
518
Version v32.0.0rc3
6-
------------
19+
-------------------
720

821
- Add aliases to package endpoint.
922
- We added Apache HTTPD improver.

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ toml==0.10.2
107107
tomli==2.0.1
108108
traitlets==5.1.1
109109
typing_extensions==4.1.1
110-
univers==30.9.1
110+
univers==30.10.0
111111
urllib3==1.26.9
112112
wcwidth==0.2.5
113113
websocket-client==0.59.0

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ install_requires =
7070

7171
#essentials
7272
packageurl-python>=0.10.5rc1
73-
univers>=30.9.1
73+
univers>=30.10.0
7474
license-expression>=21.6.14
7575

7676
# file and data formats

vulnerabilities/importers/gitlab.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434

3535
PURL_TYPE_BY_GITLAB_SCHEME = {
36-
# "conan": "conan",
36+
"conan": "conan",
3737
"gem": "gem",
3838
# Entering issue to parse go package names https://github.com/nexB/vulnerablecode/issues/742
3939
# "go": "golang",
@@ -203,7 +203,7 @@ def parse_gitlab_advisory(file):
203203
affected_version_range = None
204204
fixed_versions = gitlab_advisory.get("fixed_versions") or []
205205
affected_range = gitlab_advisory.get("affected_range")
206-
gitlab_native_schemes = set(["pypi", "gem", "npm", "go", "packagist"])
206+
gitlab_native_schemes = set(["pypi", "gem", "npm", "go", "packagist", "conan"])
207207
vrc: VersionRange = RANGE_CLASS_BY_SCHEMES[purl.type]
208208
gitlab_scheme = GITLAB_SCHEME_BY_PURL_TYPE[purl.type]
209209
try:

vulnerabilities/package_managers.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,22 @@ def fetch(self, pkg: str) -> Iterable[PackageVersion]:
556556
)
557557

558558

559+
class ConanVersionAPI(VersionAPI):
560+
"""
561+
Fetch versions of ``conan`` packages from the Conan API
562+
"""
563+
564+
package_type = "conan"
565+
566+
def fetch(self, pkg: str) -> Iterable[PackageVersion]:
567+
response = get_response(
568+
url=f"https://conan.io/center/api/ui/details?name={pkg}&user=_&channel=_",
569+
content_type="json",
570+
)
571+
for release in response["versions"]:
572+
yield PackageVersion(value=release["version"])
573+
574+
559575
class GoproxyVersionAPI(VersionAPI):
560576
"""
561577
Fetch versions of Go "golang" packages from the Go proxy API
@@ -688,6 +704,7 @@ def fetch(self, pkg: str) -> Iterable[PackageVersion]:
688704
CratesVersionAPI,
689705
DebianVersionAPI,
690706
GitHubTagsAPI,
707+
ConanVersionAPI,
691708
}
692709

693710
VERSION_API_CLASSES_BY_PACKAGE_TYPE = {cls.package_type: cls for cls in VERSION_API_CLASSES}

vulnerabilities/tests/test_data/openssl/security_advisories-advisory_data-expected.json

Lines changed: 46 additions & 46 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)