Files
pruefwerk/docs/guide/managed-git-en.md
T
Sharang ParnerkarandClaude Opus 5.5 8fff28b2db
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Check (pull_request) Successful in 10m44s
feat(issues): a tracker issue follows its finding's status
#444 opens an issue per finding in the managed repository, but nothing
updated it afterwards. Now, when a finding's status changes, by a person
(single or bulk) or by the scan (#443 closes and reopens), its issue
follows, in the background:
- resolved, false positive (rule or mapping) or ignored: a comment with
  the reason, then closed;
- accepted risk: the comment (with the person's reason) and, on Gitea,
  the new `risk:accepted` label, then closed;
- open, triaged or needs review again: reopened with a comment.

The sync reads the finding's current status when it runs, so a change in
between wins, and does nothing when the issue already matches. Comments
are German then English, like the labels. build_tracker is now a free
function the API can use; TrackerDispatch gains update_issue_status and
add_comment; GiteaTracker gains add_labels.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
2026-10-05 16:02:34 +02:00

81 lines
3.6 KiB
Markdown

---
title: Connecting Managed Git
---
# Connecting Managed Git
With Managed Git, BreakPilot runs a Gitea instance for your company
(`https://<company>.code.breakpilot.com`). Prüfwerk can check every repository
of an organisation in that instance automatically:
- **New repository → new target.** When a repository is created, Prüfwerk
creates a target for it and scans it after the first push.
- **Push to the default branch → scan.** Pushes to other branches and tags do
not start a scan.
- **Repository deleted → target archived.** Findings and evidence are kept;
the target is no longer scanned.
- **Findings as issues.** Findings of severity medium and above become issues
in the repository, with location, CWE, the CRA requirement concerned, the
remediation and a link into Prüfwerk. Prüfwerk creates the labels
`pruefwerk`, `cra:annex-i`, `severity:critical|high|medium|low` and
`risk:accepted` in the repository for them.
- **The issue follows the finding.** When the finding is closed in Prüfwerk —
the scan no longer finds it, or someone marks it resolved, a false alarm or
ignored — Prüfwerk comments on the issue why and closes it. An accepted risk
also gets the label `risk:accepted`, with the reason in the comment. When
the finding comes back (the scan finds it again, or it is reopened), the
issue is reopened.
- **Sync.** Every 30 minutes Prüfwerk compares the organisation's repositories
with its targets, in case a webhook delivery was lost.
BreakPilot sets the connection up during provisioning; there is nothing for you
to configure. IT administrators can read it through the API
(`GET /api/v1/git-source`); a view in the interface will follow.
::: tip Deleted a target?
A target that belongs to a repository of the connected organisation is created
again by the next sync. To exclude a repository, move it to another
organisation.
:::
## The bot user's rights
Prüfwerk acts in Gitea as the bot user **`pruefwerk`** — never as an
administrator:
- The bot is a member of a dedicated team of the organisation (e.g.
"Prüfwerk") that has only the units **Code: Read** and **Issues: Write**. No
administration, no write access to code, no wiki, release or package rights.
- Its access token has only the scopes `read:organization` (repository list),
`read:repository` (clone) and `write:issue` (issues, comments and labels).
- Prüfwerk stores the token encrypted and never returns it.
Removing the bot from the team ends its access immediately.
## For operations (BreakPilot)
The platform configures the source through the platform API (service token,
like the other `/api/v1/platform/*` calls):
```http
PUT /api/v1/platform/tenants/{tenant_id}/git-source
{ "base_url": "https://kunde.code.breakpilot.com", "org": "kunde",
"bot_token": "<the bot's token>" }
```
The response carries `webhook_url` and — only the first time, or with
`"rotate_webhook_secret": true` — `webhook_secret`. With these, register an
organisation or system webhook in Gitea (type Gitea, `application/json`) for
the **Repository** and **Push** events. 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.
Agent environment: `GIT_SOURCE_HOST_PATTERN` (allowed hosts, default
`^[a-z0-9-]+\.code(-stage)?\.breakpilot\.com$`), `GIT_SOURCE_SYNC_MINUTES`
(default 30), `WEBHOOK_PUBLIC_URL` (public origin of the webhook server, for
`webhook_url`). The Gitea instance's `[webhook] ALLOWED_HOST_LIST` must allow
the Prüfwerk host.
[Deutsche Fassung](./managed-git)