2 min read

Yesterday, Diane Hosfelt, a Research Engineer at Mozilla, shared what she and her team experienced when rewriting Firefox internals in Rust. Taking Quantum CSS as a case study, she touched upon the potential security vulnerabilities that could have been prevented if it was written in Rust from the very beginning.

Why Mozilla decided to rewrite Firefox internal in Rust?

Quantum CSS is a part of Mozilla’s Project Quantum, under which it is rewriting Firefox internals to make it faster. One of the major parts of this project is Servo, an engine designed to provide better concurrency and parallelism. To achieve these goals Mozilla decided to rewrite Servo in Rust, replacing C++. Rust is very similar to C++ in some ways while being different in terms of the abstractions and data structures it uses. It was created by Mozilla keeping concurrency safety in mind. Its type and memory-safe property make programs written in Rust thread-safe.

What type of bugs does Rust prevent?

Overall Rust prevents bugs related to memory, bounds, null/uninitialized variables, or integer by default. Hosfelt mentioned in her blog post, “Due to the overlap between memory safety violations and security-related bugs, we can say that Rust code should result in fewer critical CVEs (Common Vulnerabilities and Exposures).” However, there are some types of bugs that Rust does not address like correctness bugs.

According to Hosfelt, Rust is a good option in the following cases:

  • When your program involves processing of untrusted input safely
  • When you want to use parallelism for better performance
  • When you are integrating isolated components into an existing codebase

You can go through the blog post by Diane Hosfelt on Mozilla’s website.

Read Next

Mozilla shares key takeaways from the Design Tools survey

Mozilla partners with Scroll to understand consumer attitudes for an ad-free experience on the web

Mozilla partners with Ubisoft to Clever-Commit its code, an artificial intelligence assisted assistant