larxius commited on
Commit
0f4790c
·
verified ·
1 Parent(s): f793ed8

Update backend/utils/pdf_generator.py

Browse files
Files changed (1) hide show
  1. backend/utils/pdf_generator.py +81 -39
backend/utils/pdf_generator.py CHANGED
@@ -1057,58 +1057,100 @@ def generate_scan_pdf(scan, vulnerabilities):
1057
  # Legal Disclaimer & Confidentiality Notice
1058
  elements.append(PageBreak())
1059
 
1060
- disclaimer_title_style = ParagraphStyle(
1061
- 'DisclaimerTitleStyle',
1062
- parent=styles['Heading3'],
1063
- fontSize=11,
1064
- leading=14,
1065
  textColor=colors.HexColor("#0F172A"),
1066
- spaceAfter=6
1067
  )
1068
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1069
  disclaimer_body_style = ParagraphStyle(
1070
  'DisclaimerBodyStyle',
1071
  parent=styles['Normal'],
1072
- fontSize=8,
1073
- leading=10.5,
1074
  textColor=colors.HexColor("#334155"),
1075
- alignment=4
 
1076
  )
1077
 
1078
- disclaimer_heading = Paragraph("<b>Legal Disclaimer, Scope Boundaries & Limitation of Liability</b>", disclaimer_title_style)
1079
- disclaimer_body = (
1080
- "<b>1. Nature of Automated Security Assessment (\"AS-IS\" Provision)</b><br/>"
1081
- "This vulnerability assessment report is completely system-generated by the LarShield automated engine. "
1082
- "Automated security scanning tools inspect web applications, APIs, network services, and infrastructure against known vulnerability signatures, heuristic patterns, and behavioral anomalies. "
1083
- "Due to the dynamic and evolving nature of security threats, automated assessments may contain false positives (incorrectly identified flaws), false negatives (undetected vulnerabilities), or incomplete contextual findings. "
1084
- "This document is provided strictly on an <b>\"AS-IS\" and \"AS-AVAILABLE\" basis</b> without warranties or guarantees of any kind, whether express, implied, statutory, or otherwise, including but not limited to implied warranties of merchantability, fitness for a particular purpose, non-infringement, or absolute system security.<br/><br/>"
1085
- "<b>2. Point-in-Time Evaluation & Scope Limitations</b><br/>"
1086
- "The findings, CVSS scoring, and risk calculations presented herein reflect a strict point-in-time snapshot of the target environment at the exact timestamp of scan execution. "
1087
- "Application updates, server configuration changes, firewall rule modifications, third-party component updates, or emerging zero-day exploits occurring after scan execution may fundamentally alter the target security posture. "
1088
- "LarShield makes no representation or warranty that target systems are completely immune to cyberattacks, unauthorized intrusion, data breaches, or operational disruptions.<br/><br/>"
1089
- "<b>3. Authorization & Compliance Verification</b><br/>"
1090
- "By initiating or scheduling security assessments using the LarShield platform, the requesting user or organization explicitly warrants and certifies that they possess full, legally verifiable authorization from all relevant infrastructure, network, and application owners to conduct security assessments against designated target endpoints. "
1091
- "LarShield disclaims all legal liability resulting from unauthorized scanning, misconfigured target inputs, or scans conducted against assets without explicit consent.<br/><br/>"
1092
- "<b>4. Strict Limitation of Liability</b><br/>"
1093
- "To the maximum extent permitted under applicable laws, under no circumstances shall LarShield, its parent company, operators, developers, officers, affiliates, or service providers be held liable for any direct, indirect, incidental, special, punitive, exemplary, or consequential damages whatsoever (including, without limitation, loss of business revenue, commercial profit, operational downtime, data corruption, unauthorized data access, regulatory fines, or third-party claims) arising out of or in connection with the use of, reliance upon, or inability to use this report or any security patch, configuration change, or remediation advice contained within.<br/><br/>"
1094
- "<b>5. Remediation & Patching Responsibility</b><br/>"
1095
- "All remediation guidance, code recommendations, and security configuration changes outlined in this report are advisory only. "
1096
- "Target system administrators and security personnel are solely responsible for thoroughly validating, testing, and reviewing any remediation steps in a non-production staging environment prior to production deployment. "
1097
- "LarShield assumes no responsibility for application breakage, service outage, or system instability resulting from remediation actions taken based on this report.<br/><br/>"
1098
- "<b>6. Proprietary Confidentiality Notice</b><br/>"
1099
- "This report contains sensitive, proprietary vulnerability intelligence regarding the client organization's digital assets. "
1100
- "Unauthorized distribution, public exposure, or reproduction of this document without prior written authorization from both the client organization and LarShield is strictly prohibited."
1101
- )
1102
- disclaimer_table = Table([[disclaimer_heading], [Paragraph(disclaimer_body, disclaimer_body_style)]], colWidths=[460])
1103
- disclaimer_table.setStyle(TableStyle([
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1104
  ('BACKGROUND', (0,0), (-1,-1), colors.HexColor("#F8FAFC")),
1105
- ('GRID', (0,0), (-1,-1), 0.5, colors.HexColor("#CBD5E1")),
1106
  ('TOPPADDING', (0,0), (-1,-1), 10),
1107
  ('BOTTOMPADDING', (0,0), (-1,-1), 10),
1108
- ('LEFTPADDING', (0,0), (-1,-1), 12),
1109
- ('RIGHTPADDING', (0,0), (-1,-1), 12),
1110
  ]))
1111
- elements.append(KeepTogether(disclaimer_table))
 
 
1112
  elements.append(Spacer(1, 15))
1113
 
1114
  return elements
 
1057
  # Legal Disclaimer & Confidentiality Notice
1058
  elements.append(PageBreak())
1059
 
1060
+ disclaimer_header_style = ParagraphStyle(
1061
+ 'DisclaimerHeaderStyle',
1062
+ parent=styles['Heading2'],
1063
+ fontSize=12,
1064
+ leading=15,
1065
  textColor=colors.HexColor("#0F172A"),
1066
+ spaceAfter=0
1067
  )
1068
 
1069
+ disclaimer_sub_style = ParagraphStyle(
1070
+ 'DisclaimerSubStyle',
1071
+ parent=styles['Normal'],
1072
+ fontSize=8,
1073
+ leading=10,
1074
+ textColor=colors.HexColor("#64748B"),
1075
+ spaceAfter=0
1076
+ )
1077
+
1078
+ disclaimer_item_title = ParagraphStyle(
1079
+ 'DisclaimerItemTitle',
1080
+ parent=styles['Normal'],
1081
+ fontSize=9.5,
1082
+ leading=12.5,
1083
+ textColor=colors.HexColor("#0F172A"),
1084
+ spaceBefore=5,
1085
+ spaceAfter=2
1086
+ )
1087
+
1088
  disclaimer_body_style = ParagraphStyle(
1089
  'DisclaimerBodyStyle',
1090
  parent=styles['Normal'],
1091
+ fontSize=8.5,
1092
+ leading=11.5,
1093
  textColor=colors.HexColor("#334155"),
1094
+ alignment=4,
1095
+ spaceAfter=4
1096
  )
1097
 
1098
+ header_p1 = Paragraph("<b>Legal Disclaimer, Scope Boundaries & Limitation of Liability</b>", disclaimer_header_style)
1099
+ header_p2 = Paragraph("OFFICIAL SYSTEM-GENERATED VULNERABILITY ASSESSMENT GOVERNANCE NOTICE", disclaimer_sub_style)
1100
+
1101
+ header_table = Table([[header_p1], [Spacer(1, 2)], [header_p2]], colWidths=[532])
1102
+ header_table.setStyle(TableStyle([
1103
+ ('BACKGROUND', (0,0), (-1,-1), colors.HexColor("#F1F5F9")),
1104
+ ('LINELEFT', (0,0), (-1,-1), 4, colors.HexColor("#4F46E5")),
1105
+ ('TOPPADDING', (0,0), (-1,-1), 8),
1106
+ ('BOTTOMPADDING', (0,0), (-1,-1), 8),
1107
+ ('LEFTPADDING', (0,0), (-1,-1), 12),
1108
+ ('RIGHTPADDING', (0,0), (-1,-1), 12),
1109
+ ]))
1110
+
1111
+ disclaimer_items = [
1112
+ ("1. Nature of Automated Security Assessment (\"AS-IS\" Provision)",
1113
+ "This vulnerability assessment report is completely system-generated by the LarShield automated engine. Automated security scanning tools inspect web applications, APIs, network services, and infrastructure against known vulnerability signatures, heuristic patterns, and behavioral anomalies. Due to the dynamic and evolving nature of security threats, automated assessments may contain false positives (incorrectly identified flaws), false negatives (undetected vulnerabilities), or incomplete contextual findings. This document is provided strictly on an <b>\"AS-IS\" and \"AS-AVAILABLE\" basis</b> without warranties or guarantees of any kind, whether express, implied, statutory, or otherwise, including but not limited to implied warranties of merchantability, fitness for a particular purpose, non-infringement, or absolute system security."),
1114
+
1115
+ ("2. Point-in-Time Evaluation & Scope Limitations",
1116
+ "The findings, CVSS scoring, and risk calculations presented herein reflect a strict point-in-time snapshot of the target environment at the exact timestamp of scan execution. Application updates, server configuration changes, firewall rule modifications, third-party component updates, or emerging zero-day exploits occurring after scan execution may fundamentally alter the target security posture. LarShield makes no representation or warranty that target systems are completely immune to cyberattacks, unauthorized intrusion, data breaches, or operational disruptions."),
1117
+
1118
+ ("3. Authorization & Compliance Verification",
1119
+ "By initiating or scheduling security assessments using the LarShield platform, the requesting user or organization explicitly warrants and certifies that they possess full, legally verifiable authorization from all relevant infrastructure, network, and application owners to conduct security assessments against designated target endpoints. LarShield disclaims all legal liability resulting from unauthorized scanning, misconfigured target inputs, or scans conducted against assets without explicit consent."),
1120
+
1121
+ ("4. Strict Limitation of Liability",
1122
+ "To the maximum extent permitted under applicable laws, under no circumstances shall LarShield, its parent company, operators, developers, officers, affiliates, or service providers be held liable for any direct, indirect, incidental, special, punitive, exemplary, or consequential damages whatsoever (including, without limitation, loss of business revenue, commercial profit, operational downtime, data corruption, unauthorized data access, regulatory fines, or third-party claims) arising out of or in connection with the use of, reliance upon, or inability to use this report or any security patch, configuration change, or remediation advice contained within."),
1123
+
1124
+ ("5. Remediation & Patching Responsibility",
1125
+ "All remediation guidance, code recommendations, and security configuration changes outlined in this report are advisory only. Target system administrators and security personnel are solely responsible for thoroughly validating, testing, and reviewing any remediation steps in a non-production staging environment prior to production deployment. LarShield assumes no responsibility for application breakage, service outage, or system instability resulting from remediation actions taken based on this report."),
1126
+
1127
+ ("6. Proprietary Confidentiality Notice",
1128
+ "This report contains sensitive, proprietary vulnerability intelligence regarding the client organization's digital assets. Unauthorized distribution, public exposure, or reproduction of this document without prior written authorization from both the client organization and LarShield is strictly prohibited.")
1129
+ ]
1130
+
1131
+ content_flowables = [header_table, Spacer(1, 10)]
1132
+
1133
+ card_cells = []
1134
+ for idx, (title, body) in enumerate(disclaimer_items):
1135
+ t_p = Paragraph(f"<b>{title}</b>", disclaimer_item_title)
1136
+ b_p = Paragraph(body, disclaimer_body_style)
1137
+ card_cells.append(t_p)
1138
+ card_cells.append(b_p)
1139
+ if idx < len(disclaimer_items) - 1:
1140
+ card_cells.append(Spacer(1, 4))
1141
+
1142
+ disclaimer_card_table = Table([[card_cells]], colWidths=[532])
1143
+ disclaimer_card_table.setStyle(TableStyle([
1144
  ('BACKGROUND', (0,0), (-1,-1), colors.HexColor("#F8FAFC")),
1145
+ ('BOX', (0,0), (-1,-1), 0.75, colors.HexColor("#CBD5E1")),
1146
  ('TOPPADDING', (0,0), (-1,-1), 10),
1147
  ('BOTTOMPADDING', (0,0), (-1,-1), 10),
1148
+ ('LEFTPADDING', (0,0), (-1,-1), 14),
1149
+ ('RIGHTPADDING', (0,0), (-1,-1), 14),
1150
  ]))
1151
+
1152
+ content_flowables.append(disclaimer_card_table)
1153
+ elements.append(KeepTogether(content_flowables))
1154
  elements.append(Spacer(1, 15))
1155
 
1156
  return elements