From 892451e02655663529dcd5896f96219b4b0b0262 Mon Sep 17 00:00:00 2001
From: "google-labs-jules[bot]"
<161369871+google-labs-jules[bot]@users.noreply.github.com>
Date: Sat, 6 Jun 2026 11:57:21 +0000
Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A1=EF=B8=8F=20Sentinel:=20[HIGH]=20Fi?=
=?UTF-8?q?x=20XSS=20vulnerability=20in=20HTML=20report=20generation?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- Imported `html` module and used `html.escape()` on all dynamic variables in `backend/app/services/report_service.py` before inserting them into HTML via f-strings.
- Applied correct ordering of operations to truncate/format before escaping strings.
- Added test case `backend/tests/test_report_service.py` to ensure `"
+
+ pipeline_result = {
+ "metrics": {"total_frames": 1, "observed_frames": 1, "interpolated_frames": 0},
+ "frames": [{"model_used": "Test", "confidence_class": "high", "gap_category": "none"}],
+ "layer_id": malicious_payload,
+ "data_source": malicious_payload,
+ "status": malicious_payload,
+ "error": malicious_payload,
+ }
+
+ alerts = [
+ {
+ "frame_index": 1,
+ "type": malicious_payload,
+ "severity": "high",
+ "description": malicious_payload
+ }
+ ]
+
+ consistency_issues = [
+ {
+ "frame": 1,
+ "issue": malicious_payload,
+ "severity": "medium",
+ "mad_score": 10.0
+ }
+ ]
+
+ trajectories = [
+ {
+ "id": malicious_payload,
+ "speed": 10.0,
+ "direction_deg": 90.0,
+ "intensity": 5.0
+ }
+ ]
+
+ html = generate_html_report(
+ job_id=malicious_payload,
+ pipeline_result=pipeline_result,
+ trajectories=trajectories,
+ alerts=alerts,
+ consistency_issues=consistency_issues
+ )
+
+ assert "