# Draft admission

> Decide if LexLean MCP takes a draft from an AI model. No file path leaves its folders, and no draft goes over the owner's limits.

Inspired by UOR-Foundation/lexlean-mcp (https://github.com/UOR-Foundation/lexlean-mcp). LexLean MCP serves LexLean to LLM clients and admits each draft's paths and size before the engine reads it. Pattern: Decision table, OMG DMN 1.5, hit policy FIRST. To write one of your own, follow How to build a decision table app (../../guides/decision-table/index.md). The prompt below is data, quoted from the example.

**Figure: What the Draft admission app does.** A request goes in, the rules decide, and the Lean kernel has already proved what the rules promise.

| Step | What happens |
| --- | --- |
| 1. Request | path, files, bytes, repeats |
| 2. 11 rules | the first that matches wins |
| 3. Answer | admitted, path-refused, too-many-files, too-many-bytes, duplicate-path |
| 4. Proved | 5 theorems, 60 tests |

Verified by prismpm verify in the pinned SDK. Fingerprint: a5c81270f90cbae8216819f3671cf3ad4aaf968cb9c344fe44a111906b60f8bc. Acceptance vectors: 60. Claims: 8.

## The prompt

```json
{
  "schema": "prism/prompt/1",
  "pattern": "decisionTable",
  "goal": "Decide if LexLean MCP takes a draft from an AI model. No file path leaves its folders, and no draft goes over the owner's limits.",
  "repository": "UOR-Foundation/lexlean-mcp",
  "app": {
    "name": "lexlean-mcp-draft-admission",
    "title": "Draft admission",
    "purpose": "Decide whether a draft is admitted or which refusal it gets, in the order admitDraft decides: the first path refusal among its rows, too many files, too many content bytes, then a duplicate path.",
    "limits": [
      "It does not read the rows: the path field is the refusal of the first row whose path admitPath refuses, or clean.",
      "The limits are the owner values draft.max_files 256 and draft.max_bytes 8388608 of OWNER-VALUES.md."
    ],
    "fields": [
      {
        "name": "path",
        "kind": "choice",
        "values": [
          "clean",
          "non-utf8",
          "non-nfc",
          "absolute",
          "empty-component",
          "dot-component",
          "dotdot-component",
          "outside-roots",
          "non-lex-tex"
        ],
        "means": "the first row's path refusal in admitPath's order: UTF-8, NFC, relative, no empty, . or .. component, under a source root, .lex.tex suffix; clean when every row passes"
      },
      {
        "name": "files",
        "kind": "number",
        "min": 0,
        "means": "rows in the draft"
      },
      {
        "name": "bytes",
        "kind": "number",
        "min": 0,
        "means": "content bytes of all rows, not counting path bytes"
      },
      {
        "name": "repeats",
        "kind": "number",
        "min": 0,
        "means": "paths that occur more than once among the rows, compared as octets"
      }
    ],
    "outcomes": [
      "admitted",
      "path-refused",
      "too-many-files",
      "too-many-bytes",
      "duplicate-path"
    ],
    "meanings": {
      "admitted": "Verdict.Admitted: the draft reaches LexLean",
      "path-refused": "Verdict.Refused with the row's path refusal, NotUtf8 to NotLexTex",
      "too-many-files": "Verdict.Refused TooManyFiles",
      "too-many-bytes": "Verdict.Refused TooManyBytes",
      "duplicate-path": "Verdict.Refused DuplicatePath"
    },
    "rules": [
      {
        "when": [
          {
            "field": "path",
            "op": "is",
            "value": "non-utf8"
          }
        ],
        "then": "path-refused",
        "why": "src/Admission.lex.tex admitPath: a path that is not UTF-8 is NotUtf8"
      },
      {
        "when": [
          {
            "field": "path",
            "op": "is",
            "value": "non-nfc"
          }
        ],
        "then": "path-refused",
        "why": "Admission.admitPath: a path not in NFC under Unicode 17.0.0 is NotNfc, decided by src/Nfc.lex.tex"
      },
      {
        "when": [
          {
            "field": "path",
            "op": "is",
            "value": "absolute"
          }
        ],
        "then": "path-refused",
        "why": "Admission.admitPath: an absolute path is AbsolutePath"
      },
      {
        "when": [
          {
            "field": "path",
            "op": "is",
            "value": "empty-component"
          }
        ],
        "then": "path-refused",
        "why": "Admission.classifyBits: an empty component is EmptyComponent"
      },
      {
        "when": [
          {
            "field": "path",
            "op": "is",
            "value": "dot-component"
          }
        ],
        "then": "path-refused",
        "why": "Admission.classifyBits: a . component is DotComponent"
      },
      {
        "when": [
          {
            "field": "path",
            "op": "is",
            "value": "dotdot-component"
          }
        ],
        "then": "path-refused",
        "why": "Admission.classifyBits: a .. component is DotDotComponent (admittedPathHasNoDotDot)"
      },
      {
        "when": [
          {
            "field": "path",
            "op": "is",
            "value": "outside-roots"
          }
        ],
        "then": "path-refused",
        "why": "Admission.rootsStage: a path under no source root is OutsideRoots"
      },
      {
        "when": [
          {
            "field": "path",
            "op": "is",
            "value": "non-lex-tex"
          }
        ],
        "then": "path-refused",
        "why": "Admission.hasSuffix: a path without the .lex.tex suffix is NotLexTex"
      },
      {
        "when": [
          {
            "field": "files",
            "op": ">",
            "value": 256
          }
        ],
        "then": "too-many-files",
        "why": "Admission.filesStage: more rows than draft.max_files (OwnerValues.draftMaxFiles 256) is TooManyFiles"
      },
      {
        "when": [
          {
            "field": "bytes",
            "op": ">",
            "value": 8388608
          }
        ],
        "then": "too-many-bytes",
        "why": "Admission.bytesStage: more content bytes than draft.max_bytes (OwnerValues.draftMaxBytes 8388608) is TooManyBytes"
      },
      {
        "when": [
          {
            "field": "repeats",
            "op": ">=",
            "value": 1
          }
        ],
        "then": "duplicate-path",
        "why": "Admission.admitDraft: the duplicate scan runs last, on a draft the limits admit, and a repeated path is DuplicatePath"
      }
    ],
    "otherwise": "admitted",
    "otherwiseWhy": "Admission.admitDraft: every row's path is admitted, the draft is within both limits and no path repeats",
    "properties": [
      {
        "kind": "never",
        "when": [
          {
            "field": "path",
            "op": "is",
            "value": "dotdot-component"
          }
        ],
        "then": "admitted",
        "why": "Admission.admittedPathHasNoDotDot: an admitted path has no .. component"
      },
      {
        "kind": "never",
        "when": [
          {
            "field": "path",
            "op": "is",
            "value": "outside-roots"
          }
        ],
        "then": "admitted",
        "why": "risk R5 (path escape): no path outside the source roots is admitted"
      },
      {
        "kind": "never",
        "when": [
          {
            "field": "files",
            "op": ">",
            "value": 256
          }
        ],
        "then": "admitted",
        "why": "Admission: an admitted draft never has more rows than max_files"
      },
      {
        "kind": "never",
        "when": [
          {
            "field": "bytes",
            "op": ">",
            "value": 8388608
          }
        ],
        "then": "admitted",
        "why": "Admission: an admitted draft never has more content bytes than max_bytes"
      },
      {
        "kind": "never",
        "when": [
          {
            "field": "path",
            "op": "is",
            "value": "clean"
          },
          {
            "field": "files",
            "op": ">",
            "value": 256
          }
        ],
        "then": "duplicate-path",
        "why": "the duplicate scan runs only on a draft the limits admit"
      }
    ],
    "examples": [
      {
        "request": "clean 3 4200 0",
        "response": "admitted"
      },
      {
        "request": "dotdot-component 3 4200 0",
        "response": "path-refused"
      },
      {
        "request": "outside-roots 1 10 0",
        "response": "path-refused"
      },
      {
        "request": "clean 257 4200 0",
        "response": "too-many-files"
      },
      {
        "request": "clean 148 8388609 0",
        "response": "too-many-bytes"
      },
      {
        "request": "clean 148 5413010 1",
        "response": "duplicate-path"
      },
      {
        "request": "non-nfc 300 9000000 2",
        "response": "path-refused"
      },
      {
        "request": "clean 256 8388608 0",
        "response": "admitted"
      },
      {
        "request": "clean 3",
        "response": "invalid"
      }
    ]
  },
  "stakeholders": [
    {
      "name": "LLM client",
      "text": "Submits drafts of LexLean modules through the MCP tools and needs each refusal to name what to fix.",
      "concerns": [
        "Correct answers",
        "Refused malformed requests"
      ]
    },
    {
      "name": "Server owner",
      "text": "Runs LexLean MCP on loopback and needs no draft to escape the source roots or exceed the owner-set limits.",
      "concerns": [
        "No path escapes the roots",
        "Proved guarantees"
      ]
    }
  ],
  "concerns": [
    {
      "name": "No path escapes the roots",
      "text": "No admitted draft has an absolute path, a .. component or a path outside the source roots.",
      "model": "security"
    }
  ],
  "components": [
    {
      "name": "LexLean MCP gateway",
      "text": "The gateway that serves the LexLean tools over MCP and admits a draft before the engine reads it.",
      "kind": "service"
    },
    {
      "name": "LexLean engine",
      "text": "LexLean v0.4.0, which checks, snapshots, formats and builds an admitted draft.",
      "kind": "externalSystem"
    },
    {
      "name": "Draft store",
      "text": "The store of lexlean-mcp/store/1, which keeps drafts for store.draft_retention.",
      "kind": "database"
    }
  ],
  "threats": [
    {
      "name": "Path escape",
      "text": "A draft row names ../ or an absolute path to write or read outside the source roots (risk R5).",
      "stride": "elevationOfPrivilege",
      "asset": "request",
      "likelihood": "high",
      "impact": "critical",
      "control": {
        "name": "Path admission",
        "text": "Absolute paths, .. components and paths outside the roots are refused, proved for every request.",
        "evidence": [
          {
            "kind": "proof",
            "reference": "LexleanMcpDraftAdmissionProofs::inv001Holds"
          },
          {
            "kind": "proof",
            "reference": "LexleanMcpDraftAdmissionProofs::inv002Holds"
          },
          {
            "kind": "gate",
            "reference": "lexlean-mcp crates/nfc-oracle admitRun SM-01"
          }
        ]
      }
    },
    {
      "name": "Oversized draft",
      "text": "A draft with very many rows or bytes exhausts the engine or the store.",
      "stride": "denialOfService",
      "asset": "request",
      "likelihood": "medium",
      "impact": "major",
      "control": {
        "name": "Owner-set limits",
        "text": "More than 256 rows or 8388608 content bytes is refused before the engine sees the draft.",
        "evidence": [
          {
            "kind": "proof",
            "reference": "LexleanMcpDraftAdmissionProofs::inv003Holds"
          },
          {
            "kind": "proof",
            "reference": "LexleanMcpDraftAdmissionProofs::inv004Holds"
          },
          {
            "kind": "review",
            "reference": "lexlean-mcp OWNER-VALUES.md OV-03"
          }
        ]
      }
    },
    {
      "name": "Look-alike path",
      "text": "Two paths that look the same but differ in Unicode normalization name two files a reviewer reads as one.",
      "stride": "spoofing",
      "asset": "source",
      "likelihood": "low",
      "impact": "major",
      "control": {
        "name": "NFC required",
        "text": "A path not in NFC under Unicode 17.0.0 is refused, so equal-looking paths compare as equal octets.",
        "evidence": [
          {
            "kind": "gate",
            "reference": "lexlean-mcp crates/nfc-oracle NF-01 to NF-15"
          }
        ]
      }
    },
    {
      "name": "Symbolic link escape",
      "text": "A row's path is clean but resolves through a symbolic link outside the roots once materialized.",
      "stride": "elevationOfPrivilege",
      "asset": "source",
      "likelihood": "low",
      "impact": "major",
      "accepted": "The symlink clause of control K5 is pending until materialization (issue 9) builds it; path admission is pure and sees no file system."
    }
  ],
  "quality": [
    {
      "characteristic": "Security",
      "subcharacteristic": "Resistance",
      "requirement": "No escaping path admitted",
      "text": "No request whose path is absolute, has a .. component or is outside the roots is admitted.",
      "measure": "Escaping admissions",
      "measureText": "Acceptance vectors answered admitted with path absolute, dotdot-component or outside-roots.",
      "threshold": 0
    },
    {
      "characteristic": "Functional suitability",
      "subcharacteristic": "Functional correctness",
      "requirement": "Every verdict matches admitDraft",
      "text": "Each vector answers the verdict admitDraftRun gives.",
      "measure": "Vectors that disagree",
      "measureText": "Acceptance vectors whose replayed verdict differs from the expected one.",
      "threshold": 0
    }
  ],
  "journeys": [
    {
      "stakeholder": "LLM client",
      "steps": [
        "REQ-002",
        "REQ-009",
        "REQ-011",
        "otherwise"
      ]
    },
    {
      "stakeholder": "Server owner",
      "steps": [
        "REQ-006",
        "REQ-007",
        "INV-001",
        "INV-002",
        "refuse"
      ]
    }
  ],
  "license": "MIT OR Apache-2.0",
  "axioms": {}
}
```

## Claims

- LM-01: The app never answers admitted when path is dotdot-component
- LM-02: The app never answers admitted when path is outside-roots
- LM-03: The app never answers admitted when files is above 256
- LM-04: The app never answers admitted when bytes is above 8388608
- LM-05: The app never answers duplicate-path when path is clean and files is above 256
- LM-06: The architecture description declares every stakeholder, concern, component, edge, viewpoint and view it references
- LM-07: The ISO/IEC 25010 quality model numbers every characteristic, subcharacteristic, requirement and measure, and every parent it names is declared
- LM-08: Every compliance obligation is numbered in order and names its evidence

## Pattern

Decision table: OMG DMN 1.5, hit policy FIRST. The rules are tried in order, and the first one that matches gives the answer. If none matches, the default answer applies. This is a DMN decision table with the FIRST hit policy.

| Pattern | Standard | Answers |
| --- | --- | --- |
| Decision table | OMG DMN 1.5, hit policy FIRST | admitted, path-refused, too-many-files, too-many-bytes, duplicate-path |

**Figure: Rules for each answer.** Each bar counts the rules that give one answer. When no rule matches, the answer is admitted.

|  | rules |
| --- | --- |
| admitted | 0 |
| path-refused | 8 |
| too-many-files | 1 |
| too-many-bytes | 1 |
| duplicate-path | 1 |

## Behavior

A request is path, files, bytes, repeats, separated by spaces. The first rule that matches decides. If none matches, the answer is admitted. A request over 112 bytes, or in any other form, is answered invalid.

| Rule | When | Answer | Why |
| --- | --- | --- | --- |
| REQ-001 | path is non-utf8 | path-refused | src/Admission.lex.tex admitPath: a path that is not UTF-8 is NotUtf8 |
| REQ-002 | path is non-nfc | path-refused | Admission.admitPath: a path not in NFC under Unicode 17.0.0 is NotNfc, decided by src/Nfc.lex.tex |
| REQ-003 | path is absolute | path-refused | Admission.admitPath: an absolute path is AbsolutePath |
| REQ-004 | path is empty-component | path-refused | Admission.classifyBits: an empty component is EmptyComponent |
| REQ-005 | path is dot-component | path-refused | Admission.classifyBits: a . component is DotComponent |
| REQ-006 | path is dotdot-component | path-refused | Admission.classifyBits: a .. component is DotDotComponent (admittedPathHasNoDotDot) |
| REQ-007 | path is outside-roots | path-refused | Admission.rootsStage: a path under no source root is OutsideRoots |
| REQ-008 | path is non-lex-tex | path-refused | Admission.hasSuffix: a path without the .lex.tex suffix is NotLexTex |
| REQ-009 | files is above 256 | too-many-files | Admission.filesStage: more rows than draft.max\_files (OwnerValues.draftMaxFiles 256) is TooManyFiles |
| REQ-010 | bytes is above 8388608 | too-many-bytes | Admission.bytesStage: more content bytes than draft.max\_bytes (OwnerValues.draftMaxBytes 8388608) is TooManyBytes |
| REQ-011 | repeats is at least 1 | duplicate-path | Admission.admitDraft: the duplicate scan runs last, on a draft the limits admit, and a repeated path is DuplicatePath |
| otherwise | no rule matches | admitted | Admission.admitDraft: every row's path is admitted, the draft is within both limits and no path repeats |

## Properties Lean proves

Each property is a theorem about the same definitions the app is built from. It is proved for every request, not only the tested ones.

| Property | Statement | Theorem | Why |
| --- | --- | --- | --- |
| INV-001 | It never answers admitted when path is dotdot-component. | LexleanMcpDraftAdmissionProofs::inv001Holds | Admission.admittedPathHasNoDotDot: an admitted path has no .. component |
| INV-002 | It never answers admitted when path is outside-roots. | LexleanMcpDraftAdmissionProofs::inv002Holds | risk R5 (path escape): no path outside the source roots is admitted |
| INV-003 | It never answers admitted when files is above 256. | LexleanMcpDraftAdmissionProofs::inv003Holds | Admission: an admitted draft never has more rows than max\_files |
| INV-004 | It never answers admitted when bytes is above 8388608. | LexleanMcpDraftAdmissionProofs::inv004Holds | Admission: an admitted draft never has more content bytes than max\_bytes |
| INV-005 | It never answers duplicate-path when path is clean and files is above 256. | LexleanMcpDraftAdmissionProofs::inv005Holds | the duplicate scan runs only on a draft the limits admit |

## Architecture

Stakeholders and the concerns each one views the app through (ISO/IEC/IEEE 42010).

| Stakeholder | Who they are | Concerns |
| --- | --- | --- |
| LLM client | Submits drafts of LexLean modules through the MCP tools and needs each refusal to name what to fix. | Correct answers, Refused malformed requests |
| Server owner | Runs LexLean MCP on loopback and needs no draft to escape the source roots or exceed the owner-set limits. | No path escapes the roots, Proved guarantees |
| Verifier | Anyone who loads the holo, checks its fingerprint and replays its acceptance vectors before trusting an answer. | Integrity of the published app, Refused malformed requests, Proved guarantees |

## Concerns

What the stakeholders care about, and the model each is viewed in.

| Concern | What it means | Model |
| --- | --- | --- |
| Correct answers | Every well-formed request is answered by the first rule that matches it, or admitted when none does, as the spec states. | quality |
| Integrity of the published app | What a visitor runs is the holo the build verified, with its fingerprint and signed provenance beside it. | security |
| No path escapes the roots | No admitted draft has an absolute path, a .. component or a path outside the source roots. | security |
| Proved guarantees | Each of the 5 properties of the spec holds for every request, proved by the Lean kernel. | quality |
| Refused malformed requests | A request that is not the 4 fields in order, or is longer than 112 bytes, is answered invalid and never guessed. | security |

## Components

9 components and 13 edges between them.

| Component | Kind | What it is |
| --- | --- | --- |
| Browser | externalSystem | The visitor's web browser, which loads the page and runs the Draft admission guest. |
| Draft admission guest | service | The Core-Wasm guest built from the model: it answers one request of at most 112 bytes with one answer of at most 64. |
| Draft admission page | staticSite | The page the template publishes: the holo, its fingerprint, its provenance and its acceptance vectors. |
| Draft store | database | The store of lexlean-mcp/store/1, which keeps drafts for store.draft\_retention. |
| GitHub Pages | externalSystem | Serves the page and the holo from the repository Pages workflow. |
| LexLean engine | externalSystem | LexLean v0.4.0, which checks, snapshots, formats and builds an admitted draft. |
| LexLean MCP gateway | service | The gateway that serves the LexLean tools over MCP and admits a draft before the engine reads it. |
| Prism build | cliAdapter | prismpm verify in the SDK image prismpm.lock pins: it checks every theorem, builds the guest and replays every vector. |
| Source repository | externalSystem | The repository that holds the prompt, the model and its gate. |

## Design views

The SDK checks each view against the system model and draws it as OPL and PlantUML.

| View | Diagram | Viewpoint |
| --- | --- | --- |
| Deciding a Draft admission request | opmObjectProcess | LLM client: Correct answers |
| Components of Draft admission | umlComponent | Verifier: Integrity of the published app |
| Answering a Draft admission request | umlSequence | LLM client: Correct answers |
| States of the Draft admission guest | umlStateMachine | LLM client: Refused malformed requests |

## Features and journeys

18 features. Each names the definitions that do the work and the tests that accept it. Each stakeholder has one journey.

| Feature | Calls | Accepted by |
| --- | --- | --- |
| When path is non-utf8, the answer is path-refused. | LexleanMcpDraftAdmission::rule1, LexleanMcpDraftAdmission::judge | LexleanMcpDraftAdmission::application |
| When path is non-nfc, the answer is path-refused. | LexleanMcpDraftAdmission::rule2, LexleanMcpDraftAdmission::judge | LexleanMcpDraftAdmission::application |
| When path is absolute, the answer is path-refused. | LexleanMcpDraftAdmission::rule3, LexleanMcpDraftAdmission::judge | LexleanMcpDraftAdmission::application |
| When path is empty-component, the answer is path-refused. | LexleanMcpDraftAdmission::rule4, LexleanMcpDraftAdmission::judge | LexleanMcpDraftAdmission::application |
| When path is dot-component, the answer is path-refused. | LexleanMcpDraftAdmission::rule5, LexleanMcpDraftAdmission::judge | LexleanMcpDraftAdmission::application |
| When path is dotdot-component, the answer is path-refused. | LexleanMcpDraftAdmission::rule6, LexleanMcpDraftAdmission::judge | LexleanMcpDraftAdmission::application |
| When path is outside-roots, the answer is path-refused. | LexleanMcpDraftAdmission::rule7, LexleanMcpDraftAdmission::judge | LexleanMcpDraftAdmission::application |
| When path is non-lex-tex, the answer is path-refused. | LexleanMcpDraftAdmission::rule8, LexleanMcpDraftAdmission::judge | LexleanMcpDraftAdmission::application |
| When files is above 256, the answer is too-many-files. | LexleanMcpDraftAdmission::rule9, LexleanMcpDraftAdmission::judge | LexleanMcpDraftAdmission::application |
| When bytes is above 8388608, the answer is too-many-bytes. | LexleanMcpDraftAdmission::rule10, LexleanMcpDraftAdmission::judge | LexleanMcpDraftAdmission::application |
| When repeats is at least 1, the answer is duplicate-path. | LexleanMcpDraftAdmission::rule11, LexleanMcpDraftAdmission::judge | LexleanMcpDraftAdmission::application |
| When no rule matches, the answer is admitted. | LexleanMcpDraftAdmission::judge | LexleanMcpDraftAdmission::application |
| A request that is not path, files, bytes, repeats in order, separated by single spaces, or is over 112 bytes, is answered invalid. | LexleanMcpDraftAdmission::dispatch, LexleanMcpDraftAdmission::decodeField1 | LexleanMcpDraftAdmission::application |
| It never answers admitted when path is dotdot-component. | LexleanMcpDraftAdmission::judge | LexleanMcpDraftAdmissionProofs::inv001Holds |
| It never answers admitted when path is outside-roots. | LexleanMcpDraftAdmission::judge | LexleanMcpDraftAdmissionProofs::inv002Holds |
| It never answers admitted when files is above 256. | LexleanMcpDraftAdmission::judge | LexleanMcpDraftAdmissionProofs::inv003Holds |
| It never answers admitted when bytes is above 8388608. | LexleanMcpDraftAdmission::judge | LexleanMcpDraftAdmissionProofs::inv004Holds |
| It never answers duplicate-path when path is clean and files is above 256. | LexleanMcpDraftAdmission::judge | LexleanMcpDraftAdmissionProofs::inv005Holds |

## Journeys

The ordered features each stakeholder takes.

| Stakeholder | Steps |
| --- | --- |
| LLM client | REQ-002 → REQ-009 → REQ-011 → otherwise |
| Server owner | REQ-006 → REQ-007 → INV-001 → INV-002 → refuse |
| Verifier | refuse → INV-001 → INV-002 → INV-003 → INV-004 → INV-005 |

## Security and threat model

15 threats against 4 assets. Each has a STRIDE category, and either a control with evidence or a risk that is accepted on purpose.

| Threat | STRIDE | Asset | Risk | Answered by |
| --- | --- | --- | --- | --- |
| Answer that breaks INV-001 | repudiation | Answer | medium likelihood, critical impact | Proof of INV-001: proof LexleanMcpDraftAdmissionProofs::inv001Holds |
| Answer that breaks INV-002 | repudiation | Answer | medium likelihood, critical impact | Proof of INV-002: proof LexleanMcpDraftAdmissionProofs::inv002Holds |
| Answer that breaks INV-003 | repudiation | Answer | medium likelihood, critical impact | Proof of INV-003: proof LexleanMcpDraftAdmissionProofs::inv003Holds |
| Answer that breaks INV-004 | repudiation | Answer | medium likelihood, critical impact | Proof of INV-004: proof LexleanMcpDraftAdmissionProofs::inv004Holds |
| Answer that breaks INV-005 | repudiation | Answer | medium likelihood, critical impact | Proof of INV-005: proof LexleanMcpDraftAdmissionProofs::inv005Holds |
| Granted capability | informationDisclosure | Answer | low likelihood, major impact | No capability granted: gate prism-code check refuses an ungranted guest import |
| Look-alike path | spoofing | Model source | low likelihood, major impact | NFC required: gate lexlean-mcp crates/nfc-oracle NF-01 to NF-15 |
| Malformed request | tampering | Request bytes | high likelihood, major impact | Strict decoder: gate malformed-request acceptance vectors, replayed in the compiled guest by prismpm verify |
| Oversized draft | denialOfService | Request bytes | medium likelihood, major impact | Owner-set limits: proof LexleanMcpDraftAdmissionProofs::inv003Holds; proof LexleanMcpDraftAdmissionProofs::inv004Holds; review lexlean-mcp OWNER-VALUES.md OV-03 |
| Oversized request | denialOfService | Request bytes | medium likelihood, minor impact | Bounded request: gate acceptance vectors at the request bound, one byte over it, and at the guest allocation bound, replayed by prismpm verify |
| Path escape | elevationOfPrivilege | Request bytes | high likelihood, critical impact | Path admission: proof LexleanMcpDraftAdmissionProofs::inv001Holds; proof LexleanMcpDraftAdmissionProofs::inv002Holds; gate lexlean-mcp crates/nfc-oracle admitRun SM-01 |
| Substituted holo | spoofing | Published holo | low likelihood, critical impact | Fingerprint and provenance: gate actions/attest-build-provenance in the pages workflow; gate prism-code check of the holo identities in the page |
| Substituted host | spoofing | Published holo | low likelihood, critical impact | accepted: A page cannot defend against its own host. The holo carries signed build provenance a visitor can check, and the app can be rebuilt from its prompt. |
| Symbolic link escape | elevationOfPrivilege | Model source | low likelihood, major impact | accepted: The symlink clause of control K5 is pending until materialization (issue 9) builds it; path admission is pure and sees no file system. |
| Tampered model | tampering | Model source | low likelihood, major impact | Regenerated from the prompt: gate prismpm verify in the SDK image prismpm.lock pins; review app/prompt.json |

## Quality

ISO/IEC 25010:2023 requirements. Each has a measure and a threshold that a theorem pins.

| Requirement | Characteristic | Measure | Threshold |
| --- | --- | --- | --- |
| Bounded allocation: The guest allocates at most 224 bytes for one request. | Performance efficiency: Resource utilization | Guest allocation bytes | 224 |
| Bounded request: A request over 112 bytes is refused before any field is read. | Performance efficiency: Time behaviour | Request bytes read | 112 |
| Every property proved: All 5 properties are theorems the Lean kernel checks. | Security: Integrity | Unproved properties | 0 |
| Every request answered: Every request gets an answer: a rule, admitted otherwise, or invalid. | Functional suitability: Functional completeness | Unanswered requests | 0 |
| Every vector replays: All 60 acceptance vectors replay in the compiled guest, the shortest 0 bytes long. | Reliability: Faultlessness | Failed vectors | 0 |
| Every verdict matches admitDraft: Each vector answers the verdict admitDraftRun gives. | Functional suitability: Functional correctness | Vectors that disagree | 0 |
| Examples answered as stated: Every one of the 9 examples of the spec is answered as it states. | Functional suitability: Functional correctness | Example mismatches | 0 |
| No escaping path admitted: No request whose path is absolute, has a .. component or is outside the roots is admitted. | Security: Resistance | Escaping admissions | 0 |

## Compliance

One obligation per standard, each naming its evidence.

| Standard | Subject | Evidence |
| --- | --- | --- |
| ISO/IEC/IEEE 42010:2022 | Architecture description | Architecture::architectureDescriptionHolds |
| ISO/PAS 19450:2015 and OMG UML 2.5.1 | Design views | Design::viewOpmDecide, Design::viewUmlComponents, Design::viewUmlRequest, Design::viewUmlStates |
| ISO/IEC 25010:2023 | Product quality | Quality::qualityModelHolds |
| ISO/IEC 27034-1:2011 and ISO/IEC 27005:2022 | Application security and risk | Security::controlSet |
| OMG DMN 1.5, hit policy FIRST | Decision table | LexleanMcpDraftAdmission::judge |
| OpenSpec | Requirements | LexleanMcpDraftAdmission::application |
| SPDX MIT OR Apache-2.0 | Licensing | LexleanMcpDraftAdmission::application |

## Rendered design views

Written by the SDK from the design records when it verified the app.

### design/Design.viewOpmDecide.opl

```
View: Design::viewOpmDecide
Title: Deciding a Draft admission request
Viewpoint: Architecture::viewpointLLMClientCorrectAnswers
Notation: ISO/PAS 19450:2015 OPM, Prism OPL profile

componentBrowser is an object.
componentDraftAdmissionGuest is an object.
componentDraftAdmissionGuest can be stateDeciding or stateIdle.
processDecide is a process.
processEncodeAnswer is a process.
processJudge is a process.
processParseRequest is a process.
componentDraftAdmissionGuest handles processDecide.
processParseRequest requires componentBrowser.
processEncodeAnswer affects componentBrowser.
processJudge invokes processEncodeAnswer.
processParseRequest invokes processJudge.
processDecide zooms into processParseRequest, processJudge, and processEncodeAnswer, in that sequence.

```

### design/Design.viewUmlComponents.puml

```
@startuml
' UML 2.5.1 component diagram
' view: Design::viewUmlComponents
' viewpoint: Architecture::viewpointVerifierIntegrityOfThePublishedApp
title Components of Draft admission
component "componentBrowser" as c0
component "componentDraftAdmissionGuest" as c1
component "componentDraftAdmissionPage" as c2
component "componentDraftStore" as c3
component "componentGitHubPages" as c4
component "componentLexLeanEngine" as c5
component "componentLexLeanMCPGateway" as c6
component "componentPrismBuild" as c7
component "componentSourceRepository" as c8
c0 --> c1 : edgeBrowserToDraftAdmissionGuest
c1 --> c0 : edgeDraftAdmissionGuestToBrowser
c1 --> c3 : edgeDraftAdmissionGuestToDraftStore
c1 --> c5 : edgeDraftAdmissionGuestToLexLeanEngine
c1 --> c6 : edgeDraftAdmissionGuestToLexLeanMCPGateway
c2 --> c4 : edgeDraftAdmissionPageToGitHubPages
c3 --> c1 : edgeDraftStoreToDraftAdmissionGuest
c4 --> c0 : edgeGitHubPagesToBrowser
c5 --> c1 : edgeLexLeanEngineToDraftAdmissionGuest
c6 --> c1 : edgeLexLeanMCPGatewayToDraftAdmissionGuest
c7 --> c1 : edgePrismBuildToDraftAdmissionGuest
c7 --> c2 : edgePrismBuildToDraftAdmissionPage
c8 --> c7 : edgeSourceRepositoryToPrismBuild
@enduml

```

### design/Design.viewUmlRequest.puml

```
@startuml
' UML 2.5.1 sequence diagram
' view: Design::viewUmlRequest
' viewpoint: Architecture::viewpointLLMClientCorrectAnswers
title Answering a Draft admission request
participant "componentBrowser" as p0
participant "componentDraftAdmissionGuest" as p1
p0 -> p1 : processDecide
p1 --> p0 : processDecide
@enduml

```

### design/Design.viewUmlStates.puml

```
@startuml
' UML 2.5.1 state machine diagram
' view: Design::viewUmlStates
' viewpoint: Architecture::viewpointLLMClientRefusedMalformedRequests
title States of the Draft admission guest
state "stateAnsweredAdmitted" as s0
state "stateAnsweredDuplicatePath" as s1
state "stateAnsweredPathRefused" as s2
state "stateAnsweredTooManyBytes" as s3
state "stateAnsweredTooManyFiles" as s4
state "stateDeciding" as s5
state "stateIdle" as s6
state "stateRefused" as s7
[*] --> s6
s6 --> s5 : processParseRequest
s6 --> s7 : processParseRequest
s5 --> s2 : processRule1
s5 --> s2 : processRule2
s5 --> s2 : processRule3
s5 --> s2 : processRule4
s5 --> s2 : processRule5
s5 --> s2 : processRule6
s5 --> s2 : processRule7
s5 --> s2 : processRule8
s5 --> s4 : processRule9
s5 --> s3 : processRule10
s5 --> s1 : processRule11
s5 --> s0 : processOtherwise
s0 --> s6 : processEncodeAnswer
s2 --> s6 : processEncodeAnswer
s4 --> s6 : processEncodeAnswer
s3 --> s6 : processEncodeAnswer
s1 --> s6 : processEncodeAnswer
s7 --> s6 : processEncodeAnswer
@enduml

```

## Prism source

Every file the builder wrote, laid out as a repository created from UOR-Foundation/template; the download prism-lexlean-mcp-draft-admission.zip has them all.

- app/src/Architecture.lex.tex (434 lines)
- app/src/Compliance.lex.tex (56 lines)
- app/src/Design.lex.tex (710 lines)
- app/src/Features.lex.tex (193 lines)
- app/src/Quality.lex.tex (375 lines)
- app/src/Security.lex.tex (677 lines)
- app/src/LexleanMcpDraftAdmission.lex.tex (298 lines)
- app/src/LexleanMcpDraftAdmissionProofs.lex.tex (234 lines)
- app/lexlean.toml (43 lines)
- app/prompt.json (462 lines)
- model/ids.toml (71 lines)
- features/suites/lexlean\_mcp\_draft\_admission.feature (50 lines)
- crates/conformance/tests/lexlean\_mcp\_draft\_admission.rs (142 lines)
- site/app.json (126 lines)
- openspec/specs/lexlean-mcp-draft-admission/spec.md (270 lines)
