Check a Model in a Pipeline
A build can ask one question about a model before it ships what the model describes: does it pass? The answer comes from the model itself, so a pipeline needs no rules of its own.
curl -s -H "authorization: Bearer $FORGE_API_KEY" \ "https://forge.example.com/api/models/$MODEL_ID/check"{ "modelId": "0196f0a0-0000-7000-8000-0000000000c1", "modelName": "Customer Billing Portal", "revision": 7, "passed": false, "failures": [ "Threat THR-0005 is open at high with no planned control on track (open threats at high or above fail)", "Control CTL-0008 is planned and past its due date 2026-10-31" ], "errors": [ { "message": "policy: threat THR-0005 is open at high with no planned control on track (open threats at high or above fail)", "path": null }, { "message": "policy: control CTL-0008 is planned and past its due date 2026-10-31", "path": null } ], "warnings": [], "review": { "signedOffRevision": 6, "signedOffOutcome": "assessed", "publishedRevision": 6, "reassessmentNeeded": false, "approved": false }, "engine": { "version": "0.20.0" }, "checkedAt": "2026-11-28T21:40:00+00:00"}The answer is always 200 for a model the caller can see. Read passed; failures gives each reason as one sentence, ready for a build log.
What Passes
Section titled “What Passes”A revision passes when the engine’s strict policy finds nothing. The policy travels in the model’s own settings.policy, over these defaults:
| Rule | Fails when |
|---|---|
| Open threats | A threat that is identified, investigating or open is rated high or above and has no planned control on track. |
| Treatment decisions | An open threat has no decision to mitigate, accept, avoid or transfer. |
| Overdue controls | A proposed, planned or in-progress control is past its due date. |
| Requirements | An approved, implemented or verified requirement has no control. |
| Suggestions | Any element is still marked as a suggestion, such as one read from a file by Import From Another Tool and not confirmed. |
| Accepted risks | An accepted threat is past the date its acceptance was to be reviewed. |
Two rules are off unless the model turns them on: every flow has a data classification, and every verified control has evidence.
The revision checked is the model’s current valid revision. To check another, add ?revision=7. A revision the engine found errors in does not pass, and says so.
What the engine says of a revision is kept for an hour (Worker:CheckCacheMinutes on an instance you run), so a pipeline that checks the same revision again is answered at once. A new revision, or a new engine release, is checked afresh, and whether the revision is the approved one is read on every call.
Ask for the Approved Revision
Section titled “Ask for the Approved Revision”Add approved=true when the build must ship only what was approved:
curl -s -H "authorization: Bearer $FORGE_API_KEY" \ "https://forge.example.com/api/models/$MODEL_ID/check?approved=true"The revision must then also be the one an approver published, with no later change waiting for reassessment. A newer revision that nobody has approved fails with “Revision 8 is not the approved one: revision 7 is published.”
The Key
Section titled “The Key”Use a service account with the auditor role: it reads, and can change nothing. Keep its API key in the pipeline’s secret store. A key sees only the models its account may see; a restricted model it may not see answers 404, like an id that does not exist. Each check of a restricted model is recorded in the activity log.
The check reads. It changes nothing in the model or its review.
In a Pipeline
Section titled “In a Pipeline”Each of these fails the job when the model does not pass, and prints why.
GitHub Actions
- name: Threat model check env: FORGE_API_KEY: ${{ secrets.FORGE_API_KEY }} run: | answer=$(curl -sS --fail-with-body -H "authorization: Bearer $FORGE_API_KEY" \ "https://forge.example.com/api/models/${{ vars.FORGE_MODEL_ID }}/check?approved=true") echo "$answer" | jq -r '"Revision \(.revision) of \(.modelName)", (.failures[] | " - \(.)")' echo "$answer" | jq -e '.passed' > /dev/nullGitLab CI
threat-model: stage: test image: alpine:3 before_script: - apk add --no-cache curl jq script: - 'answer=$(curl -sS --fail-with-body -H "authorization: Bearer $FORGE_API_KEY" "https://forge.example.com/api/models/$FORGE_MODEL_ID/check?approved=true")' - echo "$answer" | jq -r '.failures[] | " - \(.)"' - echo "$answer" | jq -e '.passed' > /dev/nullPowerShell (Azure Pipelines, Jenkins on Windows)
$answer = Invoke-RestMethod -Headers @{ authorization = "Bearer $env:FORGE_API_KEY" } ` -Uri "https://forge.example.com/api/models/$env:FORGE_MODEL_ID/check?approved=true"$answer.failures | ForEach-Object { Write-Host " - $_" }if (-not $answer.passed) { exit 1 }--fail-with-body and Invoke-RestMethod stop the job on any answer that is not 200: a key that was revoked (401), a model the key may not see (404), or a model with no valid revision at all (409).
What to Know
Section titled “What to Know”- The model’s ID is in the address of its page:
/models/{id}. - A model that passes today can fail tomorrow with no change to it: a control’s due date passes, or an accepted risk reaches its review date. That is the point of asking at each build.
- To let a build through while a finding is worked on, change the model, not the pipeline: plan a control with a date, record the decision, or set the policy in the model’s settings. The change is a revision, with a name and a date on it.
- Limits: a key may call 600 times a minute. See Errors and Limits.