Skip to content

Commit

Permalink
feat: add version range to mariner provider (#585)
Browse files Browse the repository at this point in the history
* feat: add version range to mariner provider

Previously, this provider could only include upper bounds on ranges.

Signed-off-by: Will Murphy <[email protected]>

* pin xsdata at 22.12 and re-generate models

This keeps the mariner models being generated by the same code that
generated them initially, which reduces the risk of an incompatible
generated change.

Signed-off-by: Will Murphy <[email protected]>

---------

Signed-off-by: Will Murphy <[email protected]>
  • Loading branch information
willmurphyscode authored May 28, 2024
1 parent a625772 commit 5beee99
Show file tree
Hide file tree
Showing 15 changed files with 344 additions and 59 deletions.
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ updates:
directory: "/"
schedule:
interval: daily
ignore:
# used to generate Mariner models.
# pin to keep from introducing needless drift in the models.
- dependency-name: "xsdata"
38 changes: 18 additions & 20 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ orjson = "^3.8.6"
SQLAlchemy = ">= 1.4.46, < 2.0" # note: 1.4.x currently required for enterprise
mergedeep = "^1.3.4"
importlib-metadata = "^7.0.1"
xsdata = {extras = ["cli", "lxml", "soap"], version = ">=22.12,<25.0"}
xsdata = {extras = ["cli", "lxml", "soap"], version = "=22.12"}
pytest-snapshot = "^0.9.0"
mashumaro = "^3.10"
iso8601 = "^2.1.0"
Expand Down
186 changes: 186 additions & 0 deletions schema/vulnerability/os/schema-1.0.1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"title": "os-vulnerability",
"description": "represents vulnerability records for common linux distributions",
"properties": {
"Vulnerability": {
"type": "object",
"properties": {
"CVSS": {
"type": "array",
"items": [
{
"type": "object",
"properties": {
"base_metrics": {
"type": "object",
"properties": {
"base_score": {
"type": "number"
},
"base_severity": {
"type": "string"
},
"exploitability_score": {
"type": "number"
},
"impact_score": {
"type": "number"
}
},
"required": [
"base_score",
"base_severity",
"exploitability_score",
"impact_score"
]
},
"status": {
"type": "string"
},
"vector_string": {
"type": "string"
},
"version": {
"type": "string"
}
},
"required": [
"base_metrics",
"status",
"vector_string",
"version"
]
}
]
},
"Description": {
"type": "string"
},
"FixedIn": {
"type": "array",
"items": [
{
"type": "object",
"properties": {
"Name": {
"type": "string"
},
"NamespaceName": {
"type": "string"
},
"VendorAdvisory": {
"type": "object",
"properties": {
"AdvisorySummary": {
"type": "array",
"items": {}
},
"NoAdvisory": {
"type": "boolean"
}
},
"required": [
"NoAdvisory"
]
},
"Version": {
"type": "string"
},
"VersionFormat": {
"type": "string"
},
"VulnerableRange": {
"type": ["string", "null"]
},
"Module": {
"type": ["string", "null"]
}
},
"required": [
"Name",
"NamespaceName",
"Version",
"VersionFormat"
]
}
]
},
"Link": {
"type": "string"
},
"Metadata": {
"type": "object",
"properties": {
"Issued": {
"type": "string"
},
"RefId": {
"type": "string"
},
"CVE": {
"type": "array",
"items": [
{
"type": "object",
"properties": {
"Name": {
"type": "string"
},
"Link": {
"type": "string"
}
},
"required": [
"Name"
]
}
]
},
"NVD": {
"type": "object",
"properties": {
"CVSSv2": {
"type": "object",
"properties": {
"Score": {
"type": "number"
},
"Vectors": {
"type": "string"
}
},
"required": [
"Score"
]
}
}
}
}
},
"Name": {
"type": "string"
},
"NamespaceName": {
"type": "string"
},
"Severity": {
"type": "string"
}
},
"required": [
"Description",
"FixedIn",
"Link",
"Metadata",
"Name",
"NamespaceName",
"Severity"
]
}
},
"required": [
"Vulnerability"
]
}
4 changes: 2 additions & 2 deletions src/vunnel/providers/mariner/model/generated.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,8 @@ class Meta:
"type": "Attribute",
}
)
criterion: Optional[Criterion] = field(
default=None,
criterion: List[Criterion] = field(
default_factory=list,
metadata={
"type": "Element",
}
Expand Down
Loading

0 comments on commit 5beee99

Please sign in to comment.