Home / Docs / Diagnostics

U3024: Call into a boundary module from which a release is reachable

Release v0.4.0

A call goes into a boundary module, and a release is reachable from it.

Why Una rejects it

In edition 0.3, a boundary module (ADR 0093) never declassifies. A call into a boundary, from which a release is reachable, is an error: a call of a policy (spec/07 §5), through the callee's body, the functions it calls, the handlers it may run, and the functional arguments granted at the call. The primary span is the call, and the related span is the release.

Releases stay in the trusted modules (spec/07 §6), and a boundary module is never one of them. A vendored library or a plug-in that lowers a label would release information with the consumer's authority, outside the code the consumer trusts.

How to fix it

The repair is to move the release into a trusted module of the consumer, before or after the call into the boundary. una fix never applies one.

The repair at a glance

src/demo/vendor.unadiff
  module demo.vendor

- import demo.release (reveal)
-
- pub count(n: secret Int) -> Int = reveal(n) + 1
+ pub count(n: Int) -> Int = n + 1
src/demo/app.unadiff
  module demo.app

+ import demo.release (reveal)
  import demo.vendor (count)

- pub total(n: secret Int) -> Int = count(n)
+ pub total(n: secret Int) -> Int = count(reveal(n))

Failing example

una.tomltoml
[package]
name = "demo"
version = "0.1.0"
edition = "0.3"

[boundaries]
"demo.vendor" = []

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

pub policy reveal
  from secret Int
  to public Int
  via open
  purpose "count"
  owner ops

open(n: secret Int) -> public Int = n
src/demo/vendor.unauna
module demo.vendor

import demo.release (reveal)

pub count(n: secret Int) -> Int = reveal(n) + 1
src/demo/app.unauna
module demo.app

import demo.vendor (count)

pub total(n: secret Int) -> Int = count(n)

Fixed example

una.tomltoml
[package]
name = "demo"
version = "0.1.0"
edition = "0.3"

[boundaries]
"demo.vendor" = []

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

pub policy reveal
  from secret Int
  to public Int
  via open
  purpose "count"
  owner ops

open(n: secret Int) -> public Int = n
src/demo/vendor.unauna
module demo.vendor

pub count(n: Int) -> Int = n + 1
src/demo/app.unauna
module demo.app

import demo.release (reveal)
import demo.vendor (count)

pub total(n: secret Int) -> Int = count(reveal(n))