Home / Learn

Release v0.4.0

17 Information flow

Page 1 of 11

The shipping-notice service of chapter 12 prints customers' email addresses in its log. Nothing stopped it: the address is a Text like any other. In Una you can say how sensitive a value is with a label, such as secret[PII], and the checker follows that label through every computation, every branch and every call. Labeled data reaches a log, a file or a service only if that place accepts its label. This chapter labels data, shows where the checker stops it, and releases what may legitimately go out through a declared policy.

What you'll build

The dispatch step of chapter 12, with the customers' names and addresses labeled as personal data. The mail service may receive them. The log may not, so it shows each address masked, through a policy that a reviewer can find in one place:

Output
sent     A-1001 to r***@example.invalid
sent     A-1002 to t***@example.invalid
skipped  A-1003: no customer has the id C-99
skipped  A-1004: customer C-21 asked for no notices
skipped  A-1005: the mail service did not answer; retry later

You will learn to:

  • label data with a level, such as confidential or secret, and a category, such as PII;
  • predict the label of a result, including one decided by a branch;
  • see which places accept which labels, and why data from outside is labeled;
  • recognize data without keeping it, with a keyed hash, a Hashed;
  • release data on purpose with a policy in a trusted module;
  • read the U4xxx diagnostics and repair them without weakening the guarantee.

Download this chapter's packages: each step is a package under steps/, and the chapter's program is day-to-day/; run una check . and una run . in one.

Why it works this way

Many leaks of personal data are not attacks. A developer adds a debug line, an error message includes the request, a log line prints a whole record. Each change is small, and nothing in the language says that the value it prints came from a customer's record three calls away.

Una checks the flow of data as part of the type system:

  1. A label says how sensitive a value is. It is part of the type: secret[PII] Text is a text that is secret and personal. A type without a label is public.
  2. A result carries the labels of what it was computed from. That includes values chosen by a branch on labeled data, since the choice reveals the condition.
  3. Every place data leaves is a sink with a ceiling. The console accepts public data. An operation of your own accepts what its accepts clause says. The checker proves, at every call, that the data is at or below the ceiling.
  4. Lowering a label takes a policy. A policy names what it releases, to what label, through which function, for what purpose and with which owner. It lives in a trusted module, which una.toml lists, and the build report lists every call.

What the checker guarantees is called noninterference, and it has a precise scope. An observer who sees only what reaches public places, such as the console, sees the same output from two runs whose labeled inputs differ, unless a policy released something. Timing, termination and resource use, among others, are outside that model (What the checker promises).

Key idea

Labeled data leaves a program only through a place that accepts its label, or through a policy that a reviewer can read. The checker does not trust names, comments or intentions: it follows the data.

View the Markdown

Next:17.1 Labels and how they follow data