Skip to content

Commit a863cbd

Browse files
committed
Fix escaping capture name in HTML report.
1 parent 6b9a22b commit a863cbd

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
GET http://localhost:8000/evil-headers
22
X-Bar: <script>alert('Hello')</script>
33
HTTP 200
4+
[Captures]
5+
\u{3c}script\u{3e}alert\u{28}\u{22}Hello\u{22}\u{29}\u{3c}\u{2f}script\u{3e}: status

‎packages/hurl/src/report/html/run.rs‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,13 @@ fn get_entry_html(entry: &EntryResult, entry_index: usize, secrets: &[&str]) ->
8888
let mut values = entry
8989
.captures
9090
.iter()
91-
.map(|c| (&c.name, c.value.to_string().redact(secrets).html_escape()))
92-
.collect::<Vec<(&String, String)>>();
91+
.map(|c| {
92+
(
93+
c.name.html_escape(),
94+
c.value.to_string().redact(secrets).html_escape(),
95+
)
96+
})
97+
.collect::<Vec<_>>();
9398
values.sort_by_key(|a| a.0.to_lowercase());
9499
let table = new_table("Captures", &values);
95100
text.push_str(&table);

0 commit comments

Comments
 (0)