Skip to content

Commit 854b856

Browse files
authored
Merge pull request #170 from RHEcosystemAppEng/vex
feat: add CSAF VEX document generation
2 parents 7ece473 + 075fe57 commit 854b856

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+2922
-55
lines changed

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ dependencies = [
3333
"tree-sitter-languages==1.10.2",
3434
"univers==30.12",
3535
"litellm<=1.75.8",
36+
"csaf-tool==0.3.2",
37+
"jsonschema>=4.0.0,<5.0.0",
3638
]
3739
requires-python = ">=3.11,<3.13"
3840
description = "NVIDIA AI Blueprint: Vulnerability Analysis for Container Security"

src/exploit_iq_commons/utils/dep_tree.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from packaging.specifiers import SpecifierSet
1313
from tqdm import tqdm
1414

15-
import logging
1615
import ast
1716
import json
1817
import zipfile
@@ -180,7 +179,7 @@ def find_all_files(self, root_dir):
180179
try:
181180
full_path.rename(new_path)
182181
except Exception as e:
183-
logging.warning(
182+
logger.warning(
184183
"Rename failed: %s → %s: %s",
185184
full_path, new_path, e
186185
)
@@ -815,7 +814,7 @@ def get_go_mod_graph_tree(manifest_path) -> str:
815814
f"manifest wasn't found at {manifest_path}, error details => "
816815
f"{repr(e)}"
817816
)
818-
logging.error(error_message_exception)
817+
logger.error(error_message_exception)
819818
raise e
820819
return process_object.stdout
821820

src/exploit_iq_commons/utils/js_extended_parser.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
import logging
1716
from typing import Any
1817
from typing import List
1918
from typing import Tuple

src/exploit_iq_commons/utils/source_code_git_loader.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
import logging
1716
import os
1817
import typing
1918
from pathlib import Path

src/vuln_analysis/configs/config-http-nim.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ functions:
118118
cve_justify:
119119
_type: cve_justify
120120
llm_name: justify_llm
121+
cve_generate_vex:
122+
_type: cve_generate_vex
123+
skip: false
124+
vex_format: csaf
121125
cve_http_output:
122126
_type: cve_http_output
123127
url: http://localhost:8080
@@ -213,6 +217,7 @@ workflow:
213217
cve_checklist_name: cve_checklist
214218
cve_agent_executor_name: cve_agent_executor
215219
cve_generate_cvss_name: cve_generate_cvss
220+
cve_generate_vex_name: cve_generate_vex
216221
cve_summarize_name: cve_summarize
217222
cve_justify_name: cve_justify
218223
cve_output_config_name: cve_http_output

src/vuln_analysis/configs/config-http-openai.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ functions:
125125
cve_justify:
126126
_type: cve_justify
127127
llm_name: justify_llm
128+
cve_generate_vex:
129+
_type: cve_generate_vex
130+
skip: false
128131
cve_http_output:
129132
_type: cve_http_output
130133
url: http://localhost:8080
@@ -222,6 +225,7 @@ workflow:
222225
cve_checklist_name: cve_checklist
223226
cve_agent_executor_name: cve_agent_executor
224227
cve_generate_cvss_name: cve_generate_cvss
228+
cve_generate_vex_name: cve_generate_vex
225229
cve_summarize_name: cve_summarize
226230
cve_justify_name: cve_justify
227231
cve_output_config_name: cve_http_output

src/vuln_analysis/configs/config-tracing.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ functions:
128128
cve_justify:
129129
_type: cve_justify
130130
llm_name: justify_llm
131+
cve_generate_vex:
132+
_type: cve_generate_vex
133+
skip: false
131134
cve_file_output:
132135
_type: cve_file_output
133136
file_path: .tmp/output.json
@@ -218,6 +221,7 @@ workflow:
218221
cve_checklist_name: cve_checklist
219222
cve_agent_executor_name: cve_agent_executor
220223
cve_generate_cvss_name: cve_generate_cvss
224+
cve_generate_vex_name: cve_generate_vex
221225
cve_summarize_name: cve_summarize
222226
cve_justify_name: cve_justify
223227
cve_output_config_name: cve_file_output

src/vuln_analysis/configs/config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ functions:
9898
cve_justify:
9999
_type: cve_justify
100100
llm_name: justify_llm
101+
cve_generate_vex:
102+
_type: cve_generate_vex
103+
skip: false
104+
vex_format: csaf
101105
cve_file_output:
102106
_type: cve_file_output
103107
file_path: .tmp/output.json
@@ -186,6 +190,7 @@ workflow:
186190
cve_checklist_name: cve_checklist
187191
cve_agent_executor_name: cve_agent_executor
188192
cve_generate_cvss_name: cve_generate_cvss
193+
cve_generate_vex_name: cve_generate_vex
189194
cve_summarize_name: cve_summarize
190195
cve_justify_name: cve_justify
191196
cve_output_config_name: cve_file_output

src/vuln_analysis/configs/openapi/openapi.json

Lines changed: 67 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -944,17 +944,33 @@
944944
},
945945
"justification": {
946946
"$ref": "#/components/schemas/JustificationOutput"
947+
},
948+
"intel_score": {
949+
"type": "integer",
950+
"title": "Intel Score"
951+
},
952+
"cvss": {
953+
"anyOf": [
954+
{
955+
"$ref": "#/components/schemas/CVSSOutput"
956+
},
957+
{
958+
"type": "null"
959+
}
960+
]
947961
}
948962
},
949963
"type": "object",
950964
"required": [
951965
"vuln_id",
952966
"checklist",
953967
"summary",
954-
"justification"
968+
"justification",
969+
"intel_score",
970+
"cvss"
955971
],
956972
"title": "AgentMorpheusEngineOutput",
957-
"description": "Contains all output generated by the main Agent Morpheus LLM Engine for a given vulnerability.\n\n- vuln_id: the ID of the vulnerability being processed by the LLM engine.\n- checklist: a list of ChecklistItemOutput objects, each containing an input and a response from the LLM agent.\n- summary: a short summary of the checklist inputs and responses, generated by an LLM.\n- justification: a JustificationOutput object containing details of the model's justification decision."
973+
"description": "Contains all output generated by the main Agent Morpheus LLM Engine for a given vulnerability.\n\n- vuln_id: the ID of the vulnerability being processed by the LLM engine.\n- checklist: a list of ChecklistItemOutput objects, each containing an input and a response from the LLM agent.\n- summary: a short summary of the checklist inputs and responses, generated by an LLM.\n- justification: a JustificationOutput object containing details of the model's justification decision.\n- intel_score: the intelligence score for the vulnerability.\n- cvss: a CVSSOutput object containing the CVSS score and vector string for the vulnerability."
958974
},
959975
"AgentMorpheusInfo": {
960976
"properties": {
@@ -1054,11 +1070,7 @@
10541070
"$ref": "#/components/schemas/AgentMorpheusInfo"
10551071
},
10561072
"output": {
1057-
"items": {
1058-
"$ref": "#/components/schemas/AgentMorpheusEngineOutput"
1059-
},
1060-
"type": "array",
1061-
"title": "Output"
1073+
"$ref": "#/components/schemas/OutputPayload"
10621074
}
10631075
},
10641076
"type": "object",
@@ -1218,6 +1230,25 @@
12181230
"type": "object",
12191231
"title": "CVSS3"
12201232
},
1233+
"CVSSOutput": {
1234+
"properties": {
1235+
"vector_string": {
1236+
"type": "string",
1237+
"title": "Vector String"
1238+
},
1239+
"score": {
1240+
"type": "string",
1241+
"title": "Score"
1242+
}
1243+
},
1244+
"type": "object",
1245+
"required": [
1246+
"vector_string",
1247+
"score"
1248+
],
1249+
"title": "CVSSOutput",
1250+
"description": "CVSS (Common Vulnerability Scoring System) representing the severity of a vulnerability in reference to an image.\n- vector_string: The CVSS vector string that encodes the metric values used to calculate the score.\n- score: The calculated CVSS base score representing the severity of the vulnerability in the given image."
1251+
},
12211252
"CVSSV3": {
12221253
"properties": {
12231254
"attackComplexity": {
@@ -2492,6 +2523,35 @@
24922523
"type": "object",
24932524
"title": "Note"
24942525
},
2526+
"OutputPayload": {
2527+
"properties": {
2528+
"analysis": {
2529+
"items": {
2530+
"$ref": "#/components/schemas/AgentMorpheusEngineOutput"
2531+
},
2532+
"type": "array",
2533+
"title": "Analysis"
2534+
},
2535+
"vex": {
2536+
"anyOf": [
2537+
{
2538+
"type": "object"
2539+
},
2540+
{
2541+
"type": "null"
2542+
}
2543+
],
2544+
"title": "Vex"
2545+
}
2546+
},
2547+
"type": "object",
2548+
"required": [
2549+
"analysis",
2550+
"vex"
2551+
],
2552+
"title": "OutputPayload",
2553+
"description": "Wrapper for final pipeline results.\n- analysis: per-vulnerability analysis results\n- vex: the vulnerability exploitability exchange document JSON"
2554+
},
24952555
"PackageState": {
24962556
"properties": {
24972557
"product_name": {

0 commit comments

Comments
 (0)