Home / Docs / Configure a package

[trusted] modules

Release v0.4.0Edition 0.1 and laterU7002U7005

What it does

modules lists the package's trusted modules: the modules that may hold declassification policies, the declared, reviewed places where data may be released to a lower label, such as a customer's note shown only as its length. A module is trusted only when it is listed here and its header says trusted module, so trust is visible both in the manifest and in the code.

Learn more: Releasing data: policies and trusted modules.

una.tomltoml
[package]
name = "shop"
version = "0.1.0"
edition = "0.2"

[labels]
categories = ["Customer"]

[trusted]
modules = ["shop.release"]
src/shop/release.unauna
trusted module shop.release

pub policy note_length
  from confidential[Customer] Text
  to public Nat
  via hundreds
  purpose "show how long a customer's note is without showing it"
  owner support_team

hundreds(note: confidential[Customer] Text) -> public Nat = note.len / 100

Forms

toml
[trusted]
modules = ["<module path>", ...]

An array of module paths, each a module of the package whose header says trusted module. A module path is written as the module's module line writes it, such as shop.release for src/shop/release.una.

Examples

Listing a module whose header is not trusted module is rejected:

una.tomltoml
[package]
name = "shop"
version = "0.1.0"
edition = "0.2"

[trusted]
modules = ["shop"]
src/shop.unauna
-- fails with U7005
module shop

pub price(cents: Int) -> Int = cents

Edge cases

The reverse is rejected too. A header that says trusted module for a module that [trusted] modules does not list:

una.tomltoml
[package]
name = "shop"
version = "0.1.0"
edition = "0.2"
src/shop.unauna
-- fails with U7005
trusted module shop

pub price(cents: Int) -> Int = cents

Each entry is a module path. An entry that is not one, such as "shop/release", is U7002.

Further rules:

Diagnostics

Edition

Trusted modules are the same in editions 0.1 and 0.2. Edition 0.3, a preview, adds boundaries, and a trusted module may not lie inside one. From edition 0.4 trusted modules are written in the trusted section of ita.una, one module path per line (see ita.una).

Normative source