mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-10-30 07:14:20 +00:00
fix(html): escape the compliance column
This commit is contained in:
3 files changed
+19
-1
No files matched your search
@@ -910,6 +910,23 @@ class TestHTML:
|
||||
assert "•key&<>'"<img" in output_data
|
||||
assert "=value&<>'"<img" in output_data
|
||||
|
||||
def test_transform_escapes_compliance(self):
|
||||
xss_payload = '<img src=x onerror="window.PROWLER_COMPLIANCE_XSS=1">'
|
||||
findings = [
|
||||
generate_finding_output(
|
||||
compliance={f"Framework{xss_payload}-1.0": [xss_payload, "1.1"]},
|
||||
)
|
||||
]
|
||||
|
||||
output_data = HTML(findings).data[0]
|
||||
|
||||
assert xss_payload not in output_data
|
||||
assert (
|
||||
"•Framework<img src=x "
|
||||
"onerror="window.PROWLER_COMPLIANCE_XSS=1">-1.0: "
|
||||
"<img src=x onerror="window.PROWLER_COMPLIANCE_XSS=1">, 1.1"
|
||||
) in output_data
|
||||
|
||||
def test_transform_escapes_metadata_fields(self):
|
||||
finding = generate_finding_output()
|
||||
finding.metadata.Severity = MagicMock(value='<img data-field="severity" src=x>')
|
||||
|
||||
Reference in new issue
Block a user