Skip to content

Workflow threat model

github-actions[bot] edited this page Nov 2, 2026 · 2 revisions

threat-model

What it does. Checks that a repository with AI components keeps an OWASP Threat Dragon model, and that the model moves when the AI surface moves. It reads the model files and, on a pull request, the list of changed files. It writes nothing and holds only contents: read.

Why it exists. A prompt, a tool config or a model integration can change with no one asking whether the threat model still holds. Process alone loses that. A red check does not. It pairs with the threat-model step in Scrum Around and Find Out, which requires the model (or a stated reason there is none) before AI-facing work is built; this workflow is the half that checks the file.

The two checks

Check When Fails on
The model Every run Not a v2 model, duplicate ids, a flow to a cell that does not exist, no trust boundary, no flow, no threat, a bad or TBD severity, a bad status, Mitigated with no mitigation text, a stale threatTop; a required-topics entry no threat covers; an Open threat at or above fail-on-open-severity
The change Pull requests, when ai-paths is set A changed file matches ai-paths, no changed file matches model-glob, and the description has no threat-model: n/a - <reason> line

A minimal caller

on:
  push: { branches: [main] }
  pull_request:

jobs:
  threat-model:
    uses: ChiefGyk3D/git-your-ship-together/.github/workflows/threat-model.yml@<sha> # vX.Y.Z
    permissions:
      contents: read
    with:
      ai-paths: |
        prompts/**
        **/mcp*.json
      required-topics: prompt injection, data leakage, tool abuse

Author the model in Threat Dragon (the desktop app or the web app), save it as docs/threat-model/<name>.threat-dragon.json, and commit it. The first run tells you what the file still lacks.

Inputs (10), read from threat-model.yml:

Input Type Default Meaning
model-glob string docs/threat-model/*.threat-dragon.json Threat Dragon model files, space-separated globs relative to the repository root (** crosses directories).
require-model boolean true Fail when no file matches model-glob. Turn it off only while a repository has no AI surface yet and is trying the workflow.
ai-paths string empty Globs, space- or newline-separated, of the files that make up the AI surface (prompts, tool and agent configs, model clients). On a pull request, a change to one needs a model change or a threat-model: n/a - <reason> line in the description. Empty turns the pull request rule off.
required-topics string empty Comma-separated topics (for example prompt injection, data leakage); each must appear, case-insensitively, in the title, type, description or mitigation of some threat in the model. Empty requires none.
fail-on-open-severity string none Fail when a threat with status Open has this severity or higher - High, Medium, Low or none. A model that records an unmitigated High is honest; this input is for a repository that will not ship one.
egress-policy string audit harden-runner egress policy for every job - audit logs outbound connections, block allows only allowed-endpoints. Jobs that hold no secret follow egress-policy-secretless instead (EX-0001).
egress-policy-secretless string block harden-runner egress policy for the jobs that hold no stored secret, no OIDC token and no write-scoped or publish-capable token (read-only contents, a SARIF upload at most), and whose output no privileged job consumes - exactly audit or block. Defaults to block since security exception EX-0001 (GitHub-hosted runners in westus2 broke harden-runner block) was closed on 2026-11-02 after harden-runner v2.22.3 passed on westus2; see docs/security/exceptions/. Every job still has the default read-only job token. Set audit to opt out if the defect recurs. Any other job follows egress-policy. Any other value fails the job.
allowed-endpoints string api.github.com:443 files.pythonhosted.org:443 github.com:443 pypi.org:443 harden-runner allow-list for block, space-separated host:port entries. Wildcards are not supported and a newline-separated list matches nothing. The runner's own infrastructure needs no entry.
extra-allowed-endpoints string empty Appended to allowed-endpoints, for hosts only this repository reaches. Same format.
timeout-minutes number 10 Per-job timeout.

What it refuses to do

It writes nothing, comments on nothing and holds no secret. It also cannot tell that the model is true of the running system or that an edit to it is a good one. The n/a line is written by the pull request's author, so it is a recorded decision for the reviewer to read, not a control the author cannot bypass. Reading the model is still a person's job; this makes skipping it visible.

Why the script is inline

A reusable workflow cannot check out its own repository, so the validator lives in the workflow file. tests/test_threat_model.py extracts that exact text and runs it against models and throwaway git repositories, and a mutation of any rule turns a test red.

Clone this wiki locally