Content PolicyFiducia Example

Clipboard Guard

Inspects clipboard content crossing domain boundaries against a configurable policy. Forbidden keywords ("TOP SECRET", "CLASSIFIED", "SCI") are rejected; approved content is forwarded with full audit logging. Unlike a data diode, the guard makes content-based decisions.

Architecture
  Managed Cross-Domain Clipboard
  ==============================

  +-----------+    high_to_guard    +-----------+    guard_to_low   +-----------+
  |  domain   | ------ ch1 ------>  | clipboard |  --- ch2 -------> |  domain   |
  |   HIGH    |                     |   guard   |    (if approved)  |    LOW    |
  | pri = 100 |                     | pri = 200 |                   | pri = 100 |
  +-----------+                     +-----------+                   +-----------+
                                    (TRUSTED)
                                    Policy: reject
                                    "TOP SECRET"
                                    "CLASSIFIED"
                                    "SCI"
3
Protection Domains
2
Memory Regions
2
Channels
Policy
Content-based

seL4 Microkit + C

The clipboard guard is implemented as a trusted protection domain that reads clipboard items from HIGH, applies keyword scanning, and forwards only approved content to LOW.

System Descriptionclipboard_guard.system
<memory_region name="high_to_guard" size="0x1_000" />
<memory_region name="guard_to_low" size="0x1_000" />

<protection_domain name="domain_high" priority="100">
    <map mr="high_to_guard" vaddr="0x4_000_000" perms="rw" />
</protection_domain>

<protection_domain name="clipboard_guard" priority="200">
    <map mr="high_to_guard" vaddr="0x4_000_000" perms="rw" />
    <map mr="guard_to_low" vaddr="0x5_000_000" perms="rw" />
</protection_domain>

<protection_domain name="domain_low" priority="100">
    <map mr="guard_to_low" vaddr="0x4_000_000" perms="rw" />
</protection_domain>

<channel>
    <end pd="domain_high" id="1" />
    <end pd="clipboard_guard" id="1" />
</channel>
<channel>
    <end pd="clipboard_guard" id="2" />
    <end pd="domain_low" id="1" />
</channel>
Policy Enforcementclipboard_guard.c
static int policy_check(const char *msg, int len) {
    for (int k = 0; k < NUM_FORBIDDEN; k++) {
        if (clip_strstr(msg, len, forbidden_keywords[k]))
            return k;  /* Forbidden keyword found */
    }
    return -1;  /* Content is clean */
}

void notified(microkit_channel ch) {
    if (ch == CH_HIGH) {
        int len = clip_buf_read(in_buf, msg, 255);
        int forbidden_idx = policy_check(msg, len);

        if (forbidden_idx >= 0) {
            rejected_count++;
            /* REJECTED: contains forbidden keyword */
        } else {
            approved_count++;
            clip_buf_write(out_buf, msg, len);
            microkit_notify(CH_LOW);
            /* APPROVED: forwarded to LOW paste buffer */
        }
    }
}
Full C implementation with Makefile and QEMU runner available on request. Contact alex.potanin@anu.edu.au
VS
Fiducia Specification

Content policy as guarded choice.

The guard's approve/reject decision is a guarded choice in its process. A C event checks the item against the keyword policy and sets ok; the process then either forwards the item to LOW or logs and drops it.

System Declarationclipboard.fis
// Clipboard guard: domain_high → clipboard_guard → domain_low.

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

High MemoryRegion high_to_guard(0x1000);
Low  MemoryRegion guard_to_low(0x1000);

ProtectionDomain domain_high(100, 33);
ProtectionDomain clipboard_guard(200);
ProtectionDomain domain_low(100);

Chan h2g = domain_high --> clipboard_guard via high_to_guard<Clip>;
Chan g2l = clipboard_guard --> domain_low via guard_to_low<Clip>;

System = domain_high ||| clipboard_guard ||| domain_low;
Guard Processclipboard_guard.fi
// Checks each item against the keyword policy; only approved
// items cross to Low.
import "include/guard.h" as guard;

ok: bool;   // set by check: the item passed the policy

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

@bind(microkit.notified)
proc Notified() {
    h2g?item -> check.item -> Decide(item);
    Notified();
}

proc Decide(item: Clip) {
        [ok] g2l!item -> Skip
    [] [!ok] reject.item -> Skip;
}

evt load_policy: guard.policy_init();

evt check.|item: Clip|: ok = guard.policy_check(item);

evt reject.|item: Clip|: {
    guard.log_rejected(item);
    dbg("clipboard: BLOCKED by policy");
}

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_low to domain_high; 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 keyword policy).

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