Type-Driven Repair for Information Flow Security

Nadia Polikarpova, Jean Yang, Shachar Itzhaky, Armando Solar-LezamaarXiv 2016

Abstract

Modern web applications must enforce complex, data-dependent security policies to protect sensitive information. Traditional manual enforcement is error-prone, leading to frequent data leaks. We present Lifty (Liquid Information Flow TYpes), a domain-specific language that leverages liquid types to not only verify but also automatically repair information flow security leaks. By treating type errors as synthesis specifications, Lifty generates provably correct patches that redact sensitive data according to specified policies, significantly reducing the burden on developers.

Introduction

Web applications today handle a vast array of sensitive data, from social media interactions to protected health records. Developers are tasked with implementing intricate security policies that dictate who can see what data under which conditions. The standard approach involves manually inserting security checks throughout the codebase. However, this "strewing" of checks is notoriously fragile and often results in inadvertent information leaks.

While Dynamic Information Flow Control (IFC) can catch these errors at runtime, it often incurs significant performance costs and can lead to application crashes in production. Static IFC systems offer better performance but typically demand complex manual proofs or extensive annotations from developers, hindering their adoption in standard engineering workflows. Lifty addresses these challenges by bridging the gap between ease of use and rigorous security through automated verification and repair.

Methodology: The Lifty Framework

Lifty introduces a novel approach to information flow security by leveraging "liquid types"—an expressive type system where types are refined with logical predicates.

Liquid Types and the TIO Monad

In Lifty, security labels are represented as logical predicates within liquid types (e.g., an integer refined to be greater than zero). To track sensitive computations, Lifty utilizes a specialized TIO monad. This monad maintains two critical labels: the data the computation is authorized to read and the destination where it is permitted to write (output).

Automatic Leak Repair

The standout feature of Lifty is its ability to automatically repair programs that fail type-checking. Rather than treating a type error as a terminal failure, Lifty uses it as a formal specification for a fix.

The Lifty workflow: from policy and program to automated patch synthesis.

The repair process follows a three-step pipeline:

  1. Localization: Using Constrained Horn Clauses (CHCs), Lifty identifies the specific input action causing the leak.
  2. Inference: It determines the "expected type," representing the weakest security policy required for safety.
  3. Synthesis: A type-driven synthesis engine (Synquid) generates a "leak patch." This patch typically wraps sensitive data in a policy check, providing a safe "redacted" value (e.g., an empty list or default string) if the check fails.

A key insight of this approach is "functionally oblivious repair." By focusing on making the code safe—often by returning default values upon policy violation—rather than preserving every complex functional property, Lifty keeps the search space for patches manageable and efficient.

Evaluation and Results

The effectiveness of Lifty was evaluated using a suite of microbenchmarks and three comprehensive case studies.

Benchmarks and Case Studies

The microbenchmarks included nine programs modeling common real-world leak patterns, such as implicit flows and search leaks. The case studies focused on representative applications:

  • Conference Management System: Based on the EDAS and HotCRP platforms.
  • Gradr: A course management system for student grades.
  • HealthWeb: A health information portal with HIPAA-like policies.
The EDAS Conference and Journal Management System, which served as a basis for one of Lifty's primary case studies.

Key Findings

Lifty successfully repaired all leaks across both microbenchmarks and case studies. Notably, the engine could generate necessary security checks even when the original program contained none. Performance was a highlight; for the larger case studies, Lifty generated all required patches within 30 to 60 seconds. The liquid type approach also proved capable of handling "self-referential" policies, where access rules depend on the data itself (e.g., author-only visibility).

Discussion and Future Work

Lifty demonstrates that decoupling security policy from application logic is not only possible but highly effective. By allowing programmers to write logic as if data were public and then automatically injecting security infrastructure, Lifty simplifies secure development.

However, some limitations remain. Lifty's reasoning is currently constrained by the underlying SMT solver's theories, limiting its ability to handle non-linear mathematics or arbitrary recursive functions. Additionally, the current prototype models database interactions by retrieving fields individually; scaling to complex SQL-like queries is a priority for future research. Finally, the automated patches are conservative and may occasionally be more restrictive than a human-authored fix.

Despite these challenges, Lifty represents a significant step toward automated, provably secure software engineering.

Summary updated

BibTeX
@misc{polikarpova2016type,
  author = {Nadia Polikarpova and Jean Yang and Shachar Itzhaky and Armando Solar-Lezama},
  title = {{Type-Driven Repair for Information Flow Security}},
  year = {2016},
  eprint = {1607.03445},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1607.03445},
}
Figure