Filament: Denning-Style Information Flow Control for Rust
Filament is a Denning-style static information-flow control library for Rust that achieves fine-grained security enforcement without compiler modifications by leveraging type inference for explicit flows, a lightweight `pc_block!` construct for implicit flows, and specialized macros for seamless library interoperability, all while offering a more permissive programming model than existing solutions like Cocoon.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine you are running a high-security bank. You have two types of money: Public Cash (everyone can see and touch) and Secret Gold (only the vault manager can handle).
In the world of computer programming, this is called Information Flow Control (IFC). The goal is to make sure "Secret Gold" never accidentally leaks into the "Public Cash" register, and that no one can use the Secret Gold to influence public decisions in a sneaky way.
For a long time, building a system to do this in modern programming languages (like Rust) was like trying to build a new bank vault inside a moving train. You either had to:
- Stop the train and rebuild the engine (modify the compiler), which is expensive and slow.
- Put the gold in a tiny, rigid box that you can only open in specific rooms (a "block-level" approach), which makes doing normal banking tasks incredibly frustrating and restrictive.
Filament is a new tool that solves this problem without stopping the train or building a rigid box. It's like giving every single coin a magical, invisible tag that the bank's security system can read instantly, without needing to rebuild the whole bank.
Here is how Filament works, using some everyday analogies:
1. The Problem with the Old Way (Cocoon)
Before Filament, there was a tool called Cocoon. Imagine Cocoon is like a "Secret Room" policy.
- If you want to touch the Secret Gold, you must step into a Secret Room.
- Inside the room, you can't talk to anyone outside, you can't change the furniture (side effects), and you can only bring out what you brought in.
- The Annoyance: If you just wanted to do a simple math problem with the gold, you had to carry it into the room, do the math, and carry it back out. If you wanted to use a tool from the public lobby (a third-party library), you had to strip the gold of its "Secret" tag, use the tool, and hope you remembered to put the tag back on. If you forgot, the gold leaked!
2. The Filament Solution: "Smart Tags"
Filament changes the game. Instead of putting the gold in a room, it puts a smart, invisible tag on every single piece of data.
- The "Label" (The Tag): Every piece of data in your program has a security level (Public, Secret, Top Secret).
- The "Flow" (The Traffic Rules): The system automatically checks: "Can this Secret Gold flow into this Public slot?" If the answer is no, the program refuses to run.
- The Magic: It does this using Type Inference. Think of it like a smart assistant who knows the rules so well that you don't have to write them down for every single step. You just say, "This is Secret," and the system figures out the rest.
3. Three Cool Tricks Filament Uses
A. The "PC Block" (The Traffic Light)
Sometimes, a decision depends on a secret.
- Example: "If the Secret Gold amount is over $1,000, turn on the Red Light."
- In the old way, the whole room had to be a "Secret Room" because the decision was secret.
- Filament's Trick: It uses a special construct called
pc_block!. It's like a Traffic Light that changes color based on the secret.- If the light is Red (Secret), the system says, "Okay, anything you do right now must also be Secret."
- Once the decision is made and the light turns Green (Public), the system relaxes. You don't need a whole room; you just need to be careful at the exact moment the light is red. This saves a massive amount of hassle.
B. The "Magic Wrapper" (fcall! and mcall!)
Programmers often use tools built by others (like a calculator app or a database). These tools don't know about Secret Gold; they only know about regular numbers.
- The Old Way: You had to strip the Secret Gold tag, give the number to the tool, and then desperately try to remember to put the tag back on. If you forgot, the gold was gone.
- Filament's Trick: It uses
fcall!andmcall!macros. Think of these as Magic Gloves.- You put the Secret Gold in the glove.
- You hand the glove to the tool.
- The tool does its work.
- When the tool is done, the Magic Gloves automatically put the Secret Gold tag back on the result. You never have to worry about forgetting to re-label it.
C. The "No-Compiler-Needed" Promise
The biggest win is that Filament works with standard Rust. You don't need to hire a team of engineers to rebuild your compiler. It's a library you just add to your project, like adding a plugin to a video game.
4. Why This Matters
The paper tested Filament on real-world apps (like a Battleship game, a Spotify client, and a secure email system).
- Less Work: Programmers had to write fewer "security notes" (annotations) compared to the old way.
- More Freedom: It didn't force them to use "escape hatches" (cheats) to get things done.
- Speed: It didn't slow down the computer. In fact, it was almost as fast as writing code without any security checks at all.
The Bottom Line
Filament is like upgrading a bank's security from "Lock the whole building" to "Give every employee a smart badge."
- The badge knows exactly where you are allowed to go.
- It doesn't stop you from doing your job.
- It doesn't require rebuilding the bank.
- And most importantly, it makes sure the Secret Gold stays secret, even when you are using tools from the public lobby.
It brings high-level, military-grade security to everyday programming, making it practical, easy to use, and safe.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.