Forge security alerts — read and dismiss a repository's alerts through the server
A bot that judges a repository's security posture (ADR-177; the posture bot bots/security-posture, persona Yellow Card) reads the alerts the repository's own scanners already published, and dismisses the false ones. It never holds a token that can do either. The bot asks the server through two operations of the publish surface. The server answers with a GitHub App token it mints for that one call, narrowed to the one repository and the one permission, and applies its own dismissal policy first.
Why through the server: a dismissal hides an alert. An agent in the pod reads alert texts written by whoever can publish an advisory or a SARIF result. A token in the pod would let an injected instruction dismiss anything, so no run token ever carries security_events or vulnerability_alerts.
The grant
A bot declares the scope in its manifest:
forge:
token_scopes:
security_alerts: write # read: the read alone; write: the read and the dismissalOnly a repo-bound schedule of such a bot is minted the capabilities, at the tick (scheduledRunGrant):
| scope level | grant capabilities | launch vars |
|---|---|---|
read | security_alerts_read | forge_security_alerts_url |
write | security_alerts_read, security_alerts_dismiss | forge_security_alerts_url, forge_dismiss_alerts_url |
The bearer is the run's forge_publish_token, sent as X-Iterion-Run. The grant is bound to the schedule row, its repo integration and its repository, and to no pull request. A pull-request, API or board launch never carries these capabilities. The operator kill switch forge_publish_mutations (set to anything but true) strips the dismissal and keeps the read.
A manifest cannot switch dismissals on: security_alerts_mode and security_alerts_max_dismissals are reserved names, and an invocation default_vars naming either fails manifest parsing, in ANY manifest, whatever scope it declares. Provisioning carries a row's vars across versions, so a default stamped by an earlier version would otherwise switch dismissals on when a later version adds the scope. A bot's own mode var (dry_run, enforce) is its own and never the server's authority.
Admission: refused before the run starts
At the tick, before launching a bot that declares the scope, the server checks that the surface can serve it. A refusal is typed on the schedule's last error, as a launch-gate denial is:
| code | when |
|---|---|
security_alerts_no_integration | the schedule row names no repo integration |
security_alerts_unsupported | the connection is GitLab, Forgejo, or a GitHub OAuth/PAT connection: only a GitHub App connection can mint a narrowed per-call token |
security_alerts_permission_missing | the installation does not grant what the row's mode needs: read for dry_run, read and write for enforce. An unknown grant (none recorded, none reported live) is refused, not attempted |
security_alerts_credential_unavailable | the probe mint failed for another reason (the repository left the installation, the App key is unreadable) |
The check is a real mint, narrowed to the repository, after the stored grant and, failing that, the installation's live grant has been read.
Reading: POST /api/v1/forge/security-alerts
{"run_id": "<run id>", "repo": "owner/name", "kind": "alerts", "source": "code_scanning",
"states": ["open"], "updated_since": "2026-11-24T00:00:00Z", "max_pages": 50}| kind | what | fields |
|---|---|---|
alerts | one family's alerts on the default branch, newest-updated first | source (code_scanning or dependabot), states (open by default; fixed, dismissed, auto_dismissed), updated_since (a cursor), max_pages |
alert | one alert of the default branch: a code-scanning alert with no instance on it is refused security_alerts_alert_not_on_default_branch (422), judged on its instance list, not its latest instance's ref | source, number |
analyses | the code-scanning uploads on the default branch, newest first | created_since (default 30 days back, at most a year) |
It is a POST because the run is checked: the body names run_id, and the run must hold this very grant, be trusted, belong to the grant's team and still be running. Alerts are read on the default branch only (ADR-177 §2). The request takes no ref, and an unknown field is refused.
A read is complete or it is refused. The server walks GitHub's Link pagination to the end. A page the forge did not serve, a next link off the forge's API host, or a walk past max_pages (default 50, at most 500) answers security_alerts_incomplete_read (502), never a partial list. A posture reader takes an absent alert for a resolved one, so a partial list would report resolutions that did not happen. A vanished alert is reconciled by reading the terminal states (fixed, dismissed), never assumed fixed.
The answer carries alerts (always present on a success, possibly empty), count, and read_at. Each alert is normalized:
security_severityis the security rating (critical,high,medium,low), read from a code-scanning rule'ssecurity_severity_level, never from its lintseverity. It is empty when the producer published none, and never defaulted.- a Dependabot alert carries its
package(ecosystem, name, manifest, scope, vulnerable range, first patched version) and its advisory ids.
| code | status | meaning |
|---|---|---|
security_alerts_producer_disabled | 422 | the producer is not switched on for the repository (code scanning never set up, Dependabot alerts disabled). A channel fact to report, not a failed read |
security_alerts_incomplete_read | 502 | see above |
security_alerts_permission_missing | 403 | the installation lacks the permission |
security_alerts_rate_limited | 429 | the forge's rate limit, with its wait |
security_alerts_alert_not_found | 404 | kind alert: no such alert |
security_alerts_alert_not_on_default_branch | 422 | kind alert, or a dismissal's re-read: the code-scanning alert has no instance on the default branch (only a pull request's or another branch's analysis found it) |
security_alerts_forge_error | 502 | any other forge answer |
Dismissing: POST /api/v1/forge/dismiss-alerts
{"run_id": "<run id>", "repo": "owner/name", "dismissals": [
{"source": "code_scanning", "number": 17, "reason": "used in tests",
"expected_severity": "high", "note": "only in testdata/"}]}The authority is the schedule row that launched the run, re-read at every call. Its vars must hold security_alerts_mode=enforce. The row must also still be bound to the grant's integration and bot, and be enabled. Anything else refuses the whole request with security_alerts_not_enforce (403), before any forge call: a row back on dry_run, a deleted or disabled row, or a run another row launched. A team admin sets the pin with the schedule routes:
iterion remote api PATCH /api/teams/<team-id>/schedules/<schedule-id> \
--data '{"vars": {"security_alerts_mode": "enforce", "security_alerts_max_dismissals": "25"}}'security_alerts_max_dismissals caps the dismissals one run's grant may make (default 25). An invalid value refuses the request (security_alerts_cap_invalid).
Once admitted, each item gets its own typed result, in request order. The server checks, in order:
The reason is one the server dismisses with:
- code scanning:
false positive,used in tests; - Dependabot:
inaccurate,not_used.
The reasons that accept or defer a risk (
won't fix,tolerable_risk,no_bandwidth,fix_started) are product decisions ADR-177 escalates to a person:security_alerts_reason_refused.- code scanning:
The claim on the grant, recorded before the forge is asked:
- an alert already claimed through this grant:
security_alerts_repeat; - a grant at its cap:
security_alerts_cap_reached.
A refusal decided after the claim and before the dismissal is sent (steps 3 and the mint) releases the claim: the item takes no cap slot and can be retried after a re-triage. A dismissal that was sent keeps its claim, whatever the answer. A release the grant store could not record answers
security_alerts_claim_unreleased, naming the refusal: the item then answerssecurity_alerts_repeatthrough this grant. A grant update retries a write that raced another one (up to 16 times within the store's 3 s deadline), so this takes a store that is failing, not one that is busy.- an alert already claimed through this grant:
The alert, re-read with the per-call token. It must have an instance on the default branch (
security_alerts_alert_not_on_default_branch): a dismissal is matched by fingerprint, so dismissing an alert only a branch found would also hide it once that branch merged. It must be open (security_alerts_not_open). It must carry a security severity (security_alerts_severity_unknown): what the server cannot rate, it does not hide. It must not be critical (security_alerts_severity_critical). And it must still be the severity the bot judged,expected_severity(security_alerts_severity_changed).The dismissal, with a token minted for it alone:
security_events: writefor code scanning,vulnerability_alerts: writefor Dependabot, the one repository. The comment is the server's:Dismissed by iterion bot <bot> (run <url>): <note>, with the note cleaned to one printable line and capped within GitHub's 280 characters.- A forge refusal is
security_alerts_refused_by_forge. - A write whose answer was lost is
security_alerts_unconfirmed: re-read the alert, never dismiss it again.
- A forge refusal is
A critical alert is never dismissed by a bot, whatever its class: operator decision of 2026-12-02 (#3770).
Audit, and the reopen procedure
Every read writes a forge.security_alerts.read audit row. Every dismissal writes two: forge.security_alert.dismiss_attempt before the forge is asked, and forge.security_alert.dismiss after, with the outcome. Both carry the repository, source, number, reason, severity, bot and schedule row:
iterion remote api GET '/api/teams/<team-id>/audit?action=forge.security_alert.dismiss'Reopening a dismissed alert: open it on GitHub (Security → the alert → Reopen), or through the API with a token holding the family's write permission:
gh api -X PATCH repos/<owner>/<repo>/code-scanning/alerts/<n> -f state=open
gh api -X PATCH repos/<owner>/<repo>/dependabot/alerts/<n> -f state=openThen remove the row's security_alerts_mode (or set it to anything but enforce) while the misclassification is looked at. The next run re-reads the alert as open and triages it again.
The App permissions
The surface needs, on the installation, Code scanning alerts and Dependabot alerts. Read serves dry_run. Read and write serves enforce.
- A new App requests them when created with "Allow iterion to read and dismiss code scanning and Dependabot alerts" in the connect wizard (
allow_security_alerts,AppManifestOptions.AllowSecurityAlerts). - An existing App does not get them from a new release. Per App:
- on GitHub, the App's settings → Permissions & events → Repository permissions: set Code scanning alerts and Dependabot alerts to Read and write (or Read-only for
dry_runonly), and save; - an owner of each organization where it is installed approves the pending request (org Settings → GitHub Apps → the App → Review request);
- refresh the recorded grant: the connection's health view, or its refresh route;
- prove one real mint: the next tick of a posture schedule is admitted (no
security_alerts_permission_missingon the schedule), or launch the row early by moving its cron.
- on GitHub, the App's settings → Permissions & events → Repository permissions: set Code scanning alerts and Dependabot alerts to Read and write (or Read-only for
These permissions are never part of the runtime forge token, the management token or any profile minted into a run. They are minted per server call only, and a test pins it (TestSecurityAlerts_NoRunTokenProfileCarriesAnAlertPermission).
GitLab and Forgejo have no security-alert path yet. A posture bot's tick on such a connection is refused security_alerts_unsupported. GitLab's vulnerability report is the next implementation of forge.SecurityAlertClient.
Rollout order
The manifest scope is new: a runner older than the release that knows it refuses the bundle (requires.iterion). Roll the server and the runners on the whole fleet, have the organizations accept the App permissions, and only then serve and enable a bot that declares the scope.
