Skip to content

Write a trust-boundary design doc for the template and extension APIs #603

Closed

Description

@JuroOravec

The problem

To know whether you can pass request data into a Citry API, you read the security page, the docstring, and often the code. The threat-model list in docs/design/security-hardening.md names the actors (template author, app developer, extension author, HTTP client, and others) but not what each can supply to each API. And each reviewer who does the security pass for a change, which CLAUDE.md calls Mechanism 7, works that answer out again.

A trust boundary is the place where a value changes from something only the template author writes to something request data can supply. This issue asks for one design doc that lists those places for every API.

What the doc covers

One table per area of the API: template syntax ({{ }}, attributes, c-bind, <c-element>, <c-raw>, Markup), component data (js_data, css_data, State), Events actions, extension hooks, and routes. For each input, one row with:

  • Who first supplies it: the template author, the app's Python code, or data from a request or storage. A value the app only passes along counts as its original source.
  • What the browser does with it: shows it as text, parses it as markup, applies it as CSS, runs it, or navigates to it.
  • What checks it: the one function that escapes or checks the value, and every path that calls it (with and without Vue, through extensions, from a cached render).
  • What the docs say: whether the API page calls the input author-only, and where.

Keeping the doc accurate

  • The doc lives under docs/design/ and is linked from section 2 of security-hardening.md and from CLAUDE.md.
  • A table row changes in the same pull request as the API it describes, and the security pass checks that.
  • Decide the cheapest way to catch a missing row, for example a list of the functions that write to the page, checked against the table by a test that runs in the fast profile (the quick set of checks that scripts/check.py runs while you work). State the cost before adding it.

Undecided trust levels

An API whose trust level is not yet decided gets the row "undecided" and a link to an issue. The doc does not guess, because a guess in a trust table reads as a promise. A suspected hole in a released version does not go in a public issue or row: report it as SECURITY.md describes.

Done when

  • The doc exists, covers the areas above, and has a row for every public API that writes to the page. If no list of those APIs exists yet, building one is part of this work.
  • security-hardening.md section 2 and CLAUDE.md link to it.
  • The way a missing row is caught is chosen, with its cost, and added or declined with a reason.

Activity

  1. added
    documentation
    on Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions