diff --git a/MANIFEST.in b/MANIFEST.in index 9d4baf9..f24ff03 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,5 +1,6 @@ include LICENSE include README.md +include *.html include requirements.txt include .env.example recursive-include testfiles * diff --git a/config.py b/config.py index b17bf95..e1ac81f 100644 --- a/config.py +++ b/config.py @@ -38,7 +38,9 @@ BASE_DIR = os.path.abspath(os.path.dirname(__file__)) -RESULTS_DIR = os.path.join(BASE_DIR, "results") +# RESULTS_DIR = os.path.join(BASE_DIR, "results") +print("CURRENT WORKING DIRECTORY IS: ", os.getcwd()) +RESULTS_DIR = os.path.join(os.getcwd(), "results") os.makedirs(os.path.dirname(RESULTS_DIR), exist_ok=True) @@ -101,4 +103,460 @@ docker_score_prompt = PromptTemplate( input_variables=["results"], template=docker_score_template -) \ No newline at end of file +) + +# report_template.py + +html_template = """ + + +
+ + +{{SCAN_MODE_TITLE}}
+{self._escape_html(dockerfile_output[:2000])}'
+ if len(dockerfile_output) > 2000:
+ dockerfile_content += 'Output truncated for display...
' + + template_vars['DOCKERFILE_SECTION'] = f""" +Total vulnerabilities: {len(vulnerabilities)}
+ """ + + template_vars['VULNERABILITY_SUMMARY'] = severity_html + + # Detailed vulnerabilities table + if vulnerabilities: + table_html = """ +| ID | +Severity | +Package | +Version | +Title | +CVSS | +Status | +
|---|---|---|---|---|---|---|
| {self._escape_html(vuln.get('VulnerabilityID', 'N/A'))} | +{vuln.get('Severity', 'N/A')} | +{self._escape_html(vuln.get('PkgName', 'N/A'))} | +{self._escape_html(vuln.get('InstalledVersion', 'N/A'))} | +{self._escape_html((vuln.get('Title', '')[:80] + '...') if len(vuln.get('Title', '')) > 80 else vuln.get('Title', 'N/A'))} | +{cvss_score} | +{status} | +
Showing 50 of {len(vulnerabilities)} vulnerabilities. See CSV/JSON for complete list.
' + + table_html += '{{SCAN_MODE_TITLE}}
+{{SCAN_MODE_TITLE}}
+