feat(issues): poll Gitea for issues a person closed or reopened (#953) (#972)
CI / Check (push) Skipped
CI / Agent integration (push) Skipped
CI / Detect Changes (push) Successful in 4s
CI / Deploy Dashboard (push) Skipped
CI / Deploy MCP (push) Skipped
CI / Deploy Docs (push) Successful in 1m14s
CI / Deploy Agent (push) Successful in 6m58s

The back-sync of #960 only listened to the managed git source's
organisation webhook, which most targets do not have: repositories with a
Gitea issue tracker get no webhook at all. Every GIT_SOURCE_SYNC_MINUTES
(30 by default) the agent now lists the issues of each target that has
Prüfwerk issues, one listing per repository, and compares their state with
its records. For an issue whose state differs it reads the timeline to see
who closed or reopened it; a person's change is carried back exactly as a
webhook delivery is (same rules: an undecided finding is resolved as
"closed in the ticket", a decision already made stays, a CVE issue only
records the close). Changes by the bot user that opened the issue are left
alone. Targets are polled one after the other, so a small Gitea sees one
listing at a time; tenants go through the same entitlement check as the
webhook. Where the webhook delivered a change already, the records match
and the poll does nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit was merged in pull request #972.
This commit is contained in:
sharangandClaude Opus 5.5 committed 2026-11-10 21:31:02 +00:00
1 parent f5ed826b99
commit 692840df59
10 files changed
+620 -15

No files matched your search

+17
View File
@@ -21,6 +21,23 @@ A scan opens issues only for the findings it finds new, so a finding whose issue
For a repository from a managed git source, known vulnerabilities in its dependencies become issues too: one per package and CVE, labelled `cve`. A critical or high CVE opens one, and so does any CVE in CISA's Known Exploited Vulnerabilities catalog (rated at least high). A CVE whose EPSS percentile reaches `CVE_ISSUE_EPSS_PERCENTILE` (default `0.95`) is rated one step higher, so a medium one opens an issue as high. The issue names the KEV entry, the EPSS score with its attribution, and CISA's SSVC exploitation where known. When a complete scan no longer finds the CVE, the issue is closed; when it comes back, it is reopened. A CVE with the VEX status `not_affected` or `fixed` gets no new issue. Its issue that is already open is closed only with `ISSUE_AUTOCLOSE=on`: with a comment naming the status and the justification, at most 20 per target and scan (the rest follow in the next scans). `ISSUE_AUTOCLOSE=dry_run` only logs, per target, how many issues it would close per VEX status, and changes nothing; the default is `off`. When the statement is withdrawn, a closed issue is reopened.
### Closing an issue in Gitea
Closing a Prüfwerk issue in Gitea resolves its finding, if no one has decided
on the finding yet; its history reads "Im Ticket geschlossen von *Gitea
user*" (closed in the ticket by). Reopening the issue reopens the finding. A
decision already made in Prüfwerk (an accepted risk, say) stays. A CVE issue
someone closes stays closed while the scan finds the vulnerability unchanged;
it does not set a VEX status. The next scan confirms a resolved finding or
finds it again and reopens it and its issue.
Prüfwerk checks the state of its Gitea issues every 30 minutes
(`GIT_SOURCE_SYNC_MINUTES`): one listing per repository, and for an issue whose
state changed, its timeline, to see who changed it. Changes Prüfwerk's own bot
user made are left alone. A managed repository whose webhook sends the
**Issues** event gets the change at once. GitHub, GitLab and Jira issues are
not read back.
## Issues List
Open **Tickets** (Issues) in the sidebar to see all tracker issues across your targets.
+6 -3
View File
@@ -38,7 +38,9 @@ of an organisation in that instance automatically:
is reopened in Gitea, the finding is open again. A decision already made in
Prüfwerk (an accepted risk, say) stays when the issue is closed. A CVE
issue someone closes stays closed while the scan finds the vulnerability
unchanged; it does not set a VEX status.
unchanged; it does not set a VEX status. Prüfwerk checks its issues itself
every 30 minutes; with the **Issues** event in the webhook a change arrives
at once.
- **Sync.** Every 30 minutes Prüfwerk compares the organisation's repositories
with its targets, in case a webhook delivery was lost.
@@ -82,8 +84,9 @@ The response carries `webhook_url` and — only the first time, or with
organisation or system webhook in Gitea (type Gitea, `application/json`) for
the **Repository**, **Push** and **Issues** events; the response names them in
`webhook_events`. Prüfwerk cannot create or change the webhook itself (the bot
has no administration rights): a webhook registered before issues synced back
needs the **Issues** event added in Gitea. A repeated `PUT` without `bot_token`
has no administration rights). An older webhook without the **Issues** event
still gets closed and reopened issues across, at the next check (every 30
minutes); with the event added they arrive at once. A repeated `PUT` without `bot_token`
keeps the stored token, and without `rotate_webhook_secret` the secret. `GET`
returns the source without secrets; `DELETE` removes it and archives its
targets.
+7 -4
View File
@@ -42,7 +42,9 @@ Repository-Organisation dieser Instanz automatisch prüfen:
offen. Eine Entscheidung, die schon im Prüfwerk getroffen wurde (etwa ein
akzeptiertes Risiko), bleibt beim Schließen bestehen. Ein CVE-Issue, das
jemand schließt, bleibt geschlossen, solange die Prüfung die Schwachstelle
unverändert findet; einen VEX-Status setzt das nicht.
unverändert findet; einen VEX-Status setzt das nicht. Prüfwerk fragt den
Stand seiner Issues alle 30 Minuten selbst ab; mit dem Ereignis **Issues**
im Webhook kommt eine Änderung sofort an.
- **Abgleich.** Alle 30 Minuten gleicht Prüfwerk die Repository-Liste der
Organisation mit den Prüfobjekten ab, falls ein Webhook verloren ging.
@@ -89,9 +91,10 @@ Die Antwort enthält `webhook_url` und – nur beim ersten Mal oder mit
Organisations- oder System-Webhook (Typ Gitea, `application/json`) mit den
Ereignissen **Repository**, **Push** und **Issues** angelegt; die Antwort
nennt sie in `webhook_events`. Prüfwerk kann den Webhook nicht selbst anlegen
oder ändern (der Bot hat keine Administrationsrechte): Bei einem Webhook, der
vor dem Abgleich der Issues angelegt wurde, muss das Ereignis **Issues** in
Gitea nachgetragen werden. Ein erneuter `PUT` ohne
oder ändern (der Bot hat keine Administrationsrechte). Fehlt einem älteren
Webhook das Ereignis **Issues**, kommen geschlossene und wieder geöffnete
Issues trotzdem an, beim nächsten Abfragen (alle 30 Minuten); nachgetragen
kommen sie sofort. Ein erneuter `PUT` ohne
`bot_token` behält das gespeicherte Token, ohne `rotate_webhook_secret` das
Secret. `GET` liefert die Quelle ohne Geheimnisse, `DELETE` entfernt sie und
archiviert ihre Prüfobjekte.