Multi-Level SecurityFiducia Example

MLS Email Guard

Manages asymmetric email flow between SECRET and OFFICIAL domains. Downgrade (SECRET→OFFICIAL) is allowed after sanitisation—stripping classified markers and adding downgrade labels. Upgrade (OFFICIAL→SECRET) is always blocked. The guard enforces the policy, not the user.

Architecture
  Asymmetric Multi-Level Security Email
  =====================================

  +-----------+   secret_to_guard   +-----------+  guard_to_official   +-----------+
  |  domain   | ------  ch1 ------> |   mail    | ------- ch2 ------>  |  domain   |
  |  SECRET   |                     |   guard   |                      | OFFICIAL  |
  | pri = 100 | <--- guard_to_   | pri = 200 | <--- official_to_ | pri = 100 |
  +-----------+      secret         +-----------+      guard           +-----------+
                  (unused: upgrade                  (BLOCKED: upgrade
                   not permitted)                    OFFICIAL->SECRET)

  Downgrade:  SECRET -> OFFICIAL    ALLOWED (with sanitisation)
  Upgrade:    OFFICIAL -> SECRET    ALWAYS BLOCKED
3
Protection Domains
4
Memory Regions
2
Channels
Asymmetric
Security Policy
DirectionPolicyAction
SECRET → OFFICIALALLOWEDSanitise: strip "CLASSIFIED:" prefix, add "[DOWNGRADED]" to subject
OFFICIAL → SECRETBLOCKEDRejected unconditionally — no upward flow without accreditation

seL4 Microkit + C

The mail guard uses bidirectional channels but enforces asymmetric policy: it reads from both domains but only forwards in the SECRET→OFFICIAL direction after sanitisation.

System Descriptionmls_email.system
<!-- 4 memory regions for bidirectional mailboxes -->
<memory_region name="secret_to_guard" size="0x1_000" />
<memory_region name="guard_to_secret" size="0x1_000" />
<memory_region name="official_to_guard" size="0x1_000" />
<memory_region name="guard_to_official" size="0x1_000" />

<protection_domain name="domain_secret" priority="100">
    <map mr="secret_to_guard" vaddr="0x4_000_000" perms="rw" />
    <map mr="guard_to_secret" vaddr="0x4_001_000" perms="rw" />
</protection_domain>

<protection_domain name="mail_guard" priority="200">
    <map mr="secret_to_guard"   vaddr="0x4_000_000" perms="rw" />
    <map mr="guard_to_secret"   vaddr="0x4_001_000" perms="rw" />
    <map mr="official_to_guard" vaddr="0x4_002_000" perms="rw" />
    <map mr="guard_to_official" vaddr="0x4_003_000" perms="rw" />
</protection_domain>

<protection_domain name="domain_official" priority="100">
    <map mr="official_to_guard" vaddr="0x4_000_000" perms="rw" />
    <map mr="guard_to_official" vaddr="0x4_001_000" perms="rw" />
</protection_domain>

<!-- Bidirectional channels (policy is asymmetric, not the channels) -->
<channel>
    <end pd="domain_secret" id="1" />
    <end pd="mail_guard" id="1" />
</channel>
<channel>
    <end pd="domain_official" id="1" />
    <end pd="mail_guard" id="2" />
</channel>
Asymmetric Policy Enforcementmail_guard.c
void notified(microkit_channel ch) {
    if (ch == CH_SECRET_GUARD) {
        /* SECRET -> OFFICIAL: downgrade allowed */
        int len = mail_buf_read(secret_in, email, 511);
        len = sanitise_for_downgrade(email, len, 511);
        /* Strips "CLASSIFIED:" prefix, adds "[DOWNGRADED]" */
        mail_buf_write(official_out, email, len);
        microkit_notify(CH_OFFICIAL_GUARD);
    }

    if (ch == CH_OFFICIAL_GUARD) {
        /* OFFICIAL -> SECRET: BLOCKED unconditionally */
        mail_buf_read(official_in, email, 511);
        microkit_dbg_puts("BLOCKED: upward flow not permitted\n");
        /* Message is consumed and discarded */
    }
}
Full C implementation with Makefile and QEMU runner available on request. Contact alex.potanin@anu.edu.au
VS
Fiducia Specification

Downgrade only, by the shape of the system.

SECRET mail reaches OFFICIAL only through the guard, which sanitises every message. The C version reads mail from OFFICIAL and throws it away. In Fiducia there is nothing to throw away: no channel leads from OFFICIAL to the guard or to SECRET, so the upward path does not exist. Adding one back, with the guard also sending to OFFICIAL, is a cycle that fic rejects (WF2).

System Declarationmls_email.fis
// MLS email guard: SECRET mail reaches OFFICIAL only through the guard.

struct Mail {
    length: uint32;
    offset: uint32;
}

High MemoryRegion secret_to_guard(0x1000);
Low  MemoryRegion guard_to_official(0x1000);

ProtectionDomain domain_secret(100, 33);
ProtectionDomain mail_guard(200);
ProtectionDomain domain_official(100);

// Downgrade path only. No channel leads from OFFICIAL to the guard
// or to SECRET, so there is no upward path to block.
Chan s2g = domain_secret --> mail_guard via secret_to_guard<Mail>;
Chan g2o = mail_guard --> domain_official via guard_to_official<Mail>;

System = domain_secret ||| mail_guard ||| domain_official;
Mail Guard Processmail_guard.fi
// Downgrades SECRET mail to OFFICIAL, sanitising each one first.
import "include/guard.h" as guard;

clean: Mail;   // the sanitised copy, written into g2o's ring

@bind(microkit.init)
proc Init() { Skip; }

@bind(microkit.notified)
proc Notified() {
    s2g?mail -> sanitise.mail -> g2o!clean -> Notified();
}

// Strips the "CLASSIFIED:" prefix and marks the mail [DOWNGRADED].
evt sanitise.|mail: Mail|: clean = guard.sanitise_for_downgrade(mail);

What fic checks: each channel's ring is mapped into its two endpoints and nowhere else; a High region is never mapped at Low, so data cannot flow from High to Low through a mapping; every channel is one-way (-->) and the channel graph has no cycle (WF2), so no path leads back from domain_official to domain_secret; and each Notified handler starts with a receive. Labels are checked on mappings, not on values: fic decides where data can go, while what the imported C does to it is the C code's job (here, the sanitiser).

Both files pass fic --check. Install fic or read the language reference.