Dynamic IFC Theorems for Free!

Maximilian Algehed, Jean-Philippe Bernardy, Catalin Hritcu

Abstract

Information Flow Control (IFC) libraries provide a powerful mechanism for ensuring data confidentiality and integrity within general-purpose programming languages. However, formally verifying the security properties of these libraries—specifically noninterference—has traditionally been an arduous task, often resulting in massive proof scripts that fail to account for the interaction between the library and the host language's type system. This paper demonstrates that by leveraging the principle of parametricity (the "theorems for free" paradigm) within the dependently typed language Agda, security proofs for dynamic IFC libraries can be made significantly more concise, modular, and robust. By implementing libraries like LIO and Faceted Values in Agda, the authors reduced proof complexity by an order of magnitude while providing the first formal bridge between library implementation and type abstraction.

Introduction

Information Flow Control (IFC) is a security paradigm that tracks the flow of sensitive information through a system to prevent unauthorized leakage. In recent years, the "IFC as a library" approach has gained popularity, allowing developers to integrate security enforcement into existing languages like Haskell without requiring custom compilers. These libraries typically use a combination of runtime checks (dynamic IFC) and type-level abstractions to isolate sensitive data.

Despite their utility, a significant "soundness gap" persists. Proving that these libraries are truly secure—meaning they satisfy noninterference (where secret inputs cannot influence public outputs)—is notoriously difficult. Previous efforts to mechanize these proofs using assistants like Coq often treated the library as a standalone calculus, ignoring the crucial role the host language's type system plays in enforcing boundaries. These proofs were often monolithic, exceeding 3,000 lines of code for even simplified versions of libraries like LIO (Label-based Information Flow Control).

Bridging the Gap with Parametricity

The core contribution of this work is the realization that the security of dynamic IFC libraries is fundamentally rooted in static type abstraction. The authors leverage Parametricity, a deep result in type theory which asserts that well-typed programs must behave uniformly across different types.

Methodology

The research team implemented two primary styles of dynamic IFC—LIO (sequential label tracking) and Faceted Values (multi-view values based on privilege)—directly in Agda. Their approach followed four key steps:

  1. Type Abstraction: The library's internal state and sensitive data are hidden behind an abstract interface (a record type). This ensures that any client program is restricted to interacting with data only through the library’s verified API.
  2. Logical Relations: The authors defined "relational interpretations" for types. In this context, two values are considered "related" if an observer at a specific security clearance cannot distinguish between them.
  3. The "Free" Theorem: Because Agda’s underlying logic supports parametricity, the authors did not need to prove the "fundamental lemma" of logical relations from scratch. Instead, they only had to prove that the library's primitive operations (such as bind or label) preserve these relations.
  4. Automated Security: Once the primitives are proven to respect the security relation, the overarching security properties—noninterference and transparency—follow automatically from the host language's type system.

Key Insights

Static Roots of Dynamic Security

A counter-intuitive finding of this research is that even though dynamic IFC relies on runtime label checks, the guarantee that a user cannot bypass these checks is provided by the static type system. Type abstraction acts as the "watertight seal" that prevents malicious or accidental leakage.

Transparency for Free

Beyond noninterference, the authors demonstrated that transparency—the property ensuring that the addition of IFC does not alter the behavior of programs that were already secure—can also be derived using the same parametricity techniques. This provides a unified framework for proving the two most critical properties of any security library.

Results and Impact

The shift to a parametricity-based approach yielded a dramatic reduction in proof effort and an increase in system coverage:

  • Efficiency: The mechanized proof for the LIO library was reduced from over 3,000 lines of Coq to approximately 360 lines of Agda. This order-of-magnitude improvement makes security proofs more maintainable and easier to audit.
  • Feature Coverage: The new proofs successfully cover complex features that previous efforts struggled with, such as the ability to recover from IFC-specific exceptions and standard user-thrown exceptions.
  • Formal Rigor: This work provides the first formal proof that explicitly accounts for the role of type abstraction in dynamic IFC, closing the gap between theoretical calculi and practical library implementations.

Limitations and Future Directions

While the results are a significant step forward, several challenges remain for real-world application:

  • Termination Channels: Agda is a "total" language where all programs terminate. In "partial" languages like Haskell, non-termination can be used as a side channel to leak information. Future work will need to address monadic representations of non-termination.
  • Side Effects: Extending these "free" theorems to cover complex side effects such as mutable state, concurrency, and I/O remains a complex theoretical challenge.
  • Language Complexity: Applying these results to production Haskell is difficult because Haskell includes "escape hatches" like unsafePerformIO that can break type abstraction. Ensuring the integrity of the abstraction barrier in such environments requires further engineering.

Conclusion

By reframing dynamic IFC security as a consequence of type abstraction and parametricity, this work simplifies the verification of security libraries. It demonstrates that with the right theoretical tools, we can achieve robust, mechanized security guarantees with a fraction of the traditional effort, moving us closer to a world where security "comes for free."

Summary updated

BibTeX
@inproceedings{algehed2020dynamic,
  author = {Maximilian Algehed and Jean-Philippe Bernardy and Catalin Hritcu},
  title = {{Dynamic IFC Theorems for Free!}},
  booktitle = {CSF},
  year = {2020},
  doi = {10.1109/csf51468.2021.00005},
}
Figure