Files
servo/components/webdriver_server
Euclid Ye 6b79b031fe webdriver: Serialize script String argument correctly to prevent injection attack (#39715)
The previous serialization is problematic when dealing with string
argument with special characters. In addition, it was vulnerable to
injection attack like below:

```rust
let s = r#""); alert(1); //"#;
let args_string = format!("\"{}\"", s);
let script = format!("(function() {{ {}\n}})({})", "/* body */", args_string); 
// script becomes: (function() { /* body */ })(""); alert(1); //")
```

Testing: Added four new tests in
[wdspec](https://web-platform-tests.org/writing-tests/wdspec.html).
Before this PR, we would get "javascript error" for the new tests, and
trigger user prompts. Now it passes. This should also fix some
testdriver tests.

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-10-09 03:18:36 +00:00
..
2025-09-20 03:09:37 +00:00