diff --git a/src/interfaces/web/mod.rs b/src/interfaces/web/mod.rs
index 82dbc223..c0ca5eae 100644
--- a/src/interfaces/web/mod.rs
+++ b/src/interfaces/web/mod.rs
@@ -169,10 +169,43 @@ fn csp_hash(script: &str) -> String {
/// Text content of every inline ``, and emit the
+/// wrong hash — the real inline script then fails CSP with `script-src 'self'`.
fn inline_scripts(html: &str) -> Vec<&str> {
let mut scripts = Vec::new();
let mut cursor = 0;
- while let Some(rel) = find_ci(&html[cursor..], "\n",
+ "\n",
+ );
+ let scripts = inline_scripts(html);
+ assert_eq!(scripts, vec!["alert(1);", "boot();"]);
+ }
+
+ #[test]
+ fn unterminated_comment_bails_out_gracefully() {
+ // Malformed input: `