Files
pruefwerk/docs/guide/repositories.md
T
sharang 2cbd98e5c0
CI / Check (push) Skipped
CI / Detect Changes (push) Successful in 3s
CI / Deploy Docs (push) Successful in 1m12s
CI / Deploy Dashboard (push) Successful in 5m33s
CI / Deploy MCP (push) Successful in 4m11s
CI / Deploy Agent (push) Successful in 7m27s
feat(git): bounded clones, Git LFS made visible, app build output left out (#450)
2026-10-05 14:05:19 +00:00

237 lines
12 KiB
Markdown

# Adding Targets
A target (*Prüfobjekt*) is a product or component that Prüfwerk scans: a
firmware, a PLC program or an application. It holds one or more artifacts
(*Artefakte*): the git repository or uploaded files the scans work on. Findings,
the SBOM and the CRA status all belong to a target.
## The Targets List
**Prüfobjekte** (Targets) in the sidebar lists all targets:
| Column | Description |
|--------|-------------|
| **Name** | The target's name, with its type beneath. A click on the row or the name opens the target's page. |
| **Letzte Prüfung** (Last scan) | Status of the last scan and how long ago it was; for a running scan also its current step. **Noch nicht geprüft** before the first scan. |
| **CRA-Stand** (CRA status) | A bar showing how the target stands against the 40 CRA Annex I requirements. |
| **Befunde** (Findings) | The number of findings; a click opens the findings list filtered to this target. |
| *(actions)* | **Prüfung starten** (Run scan) |
The list refreshes on its own while a scan is running. **+ Prüfobjekt anlegen**
above the list opens the wizard. An empty list also offers the demo targets
(see [Demo-Prüfobjekte](/guide/demo-targets)).
## Adding a Target
Click **Neues Prüfobjekt** in the sidebar (or **+ Prüfobjekt anlegen** on the
**Prüfobjekte** page). The wizard **Prüfobjekt anlegen** has four steps:
**Typ**, **Artefakte**, **Prüfen**, **Fertig**.
### 1. Typ (Target type)
Enter a **Name** and answer **Um welche Art von Software handelt es sich?**
(What kind of software is this?).
Under **Maschine und Gerät** (Machine and device):
| Type | For |
|---|---|
| **SPS / PLC** | CODESYS, PLCopen XML, Structured Text (IEC 61131-3) |
| **Firmware — ohne Betriebssystem** | Microcontroller without an operating system, e.g. STM32 with HAL |
| **Firmware — RTOS** | FreeRTOS, Zephyr and other real-time operating systems |
| **Embedded Linux / Yocto** | BSP + image |
Under **Weitere Software** (Other software): **Backend / API**,
**Webanwendung**, **Desktop-Anwendung**, **Android-App**, **iOS-App**.
### 2. Artefakte (Artifacts)
Under **Artefakte hinzufügen**, choose the **Art** (kind) of each artifact:
| Kind | How to add it |
|---|---|
| **Git-Repository** | Enter the HTTPS address under **Referenz (URL / Pfad / Text)** and, if needed, the **Branch**. For a private repository also fill in **Zugangstoken (nur für private Repositories)** and, if your host needs it, **Benutzername (optional)**. Then **+ Hinzufügen**. |
| **Quellcode-Archiv (zip, tar, tar.gz)** | Choose the **Datei** and click **+ Datei hinzufügen**. |
| **SPS-Projekt** | Choose the file and its **Format**: PLCopen XML, Structured Text or Project archive (`.projectarchive`), then **+ Datei hinzufügen**. The format is preselected from the file name. |
| **Firmware-Image** | Choose the file and click **+ Datei hinzufügen**. Images are not unpacked yet; scan the firmware's sources to get findings and components. |
| **Mobile-Paket (APK/IPA)** | Choose the file and click **+ Datei hinzufügen**. App packages are not analysed yet. |
| **Container-Image**, **Beschreibung (Text)** | Enter the reference or text under **Referenz (URL / Pfad / Text)**. |
| **Live-URL** | The address of a running device or web interface. Not available in a deployment that scans source code only. |
A target can have several artifacts, for example the firmware and the PLC
program of one machine. Files can be up to 512 MB.
**Archives:**
- zip, tar and tar.gz are accepted.
- **Password-protected zip archives** are accepted. After adding the file, enter
its password in the field **Archiv-Passwort (nur bei passwortgeschützten
Archiven)** next to it. If you do not have it at hand, the target is still
created; enter the password later under **Bearbeiten** on the target's page
(the archive shows **Passwort fehlt** until then).
- **7z and RAR archives are refused** when uploaded: "7z- und RAR-Archive werden
nicht unterstützt. Bitte als zip, tar oder tar.gz hochladen."
For a PLC project, the wizard explains which files to use; see
[SPS / PLC (CODESYS)](/guide/plc).
### 3. Prüfen (Review)
The step shows the name, type and artifacts once more. Click
**Anlegen und prüfen** (Create and scan): Prüfwerk creates the target, uploads
the files and starts the first scan.
### 4. Fertig (Done)
The last step says the target was created and shows the **Erkannter Typ**
(detected type), if detection suggests one. Below it:
- **Fortschritt** -- the running first scan.
- **Anwendbare Prüfungen** -- which scans apply to this target, and why the
others do not.
- **Optionale Prüfungen** -- scans that apply but are off by default because
they touch a running device. Not shown where only source code is scanned.
**Zu den Befunden**, **Zu den Prüfobjekten** and **Weiteres Prüfobjekt
anlegen** lead on.
If a file did not arrive, the wizard says **Hochladen fehlgeschlagen** and does
not start the scan; add the file again under **Bearbeiten** on the target's page.
## Private Repositories
**Public repositories** can be cloned using an HTTPS URL with no additional setup.
**Private repositories** are cloned over HTTPS with a token you supply. Enter the
repository's HTTPS URL and a read-only token in **Zugangstoken (nur für private
Repositories)**. The token is stored encrypted and never shown again.
### Creating a Token
1. Create a read-only token in your Git hosting provider, scoped to the repository you are onboarding:
- **GitHub**: Settings > Developer settings > Personal access tokens (fine-grained), repository access limited to that repository, *Contents: Read-only*
- **GitLab**: Repository Settings > Repository > Deploy tokens, scope `read_repository`
- **Gitea**: Settings > Applications > Access tokens, scope `read:repository`
2. Add the repository in Prüfwerk with its **HTTPS** URL
3. Paste the token into **Zugangstoken (nur für private Repositories)**
::: warning SSH URLs are not supported
`ssh://…` and `git@host:org/repo.git` URLs are rejected. Each tenant's token belongs to that tenant only; there is no shared platform deploy key, and adding one would mean every tenant's clones authenticating as the same identity. Per-tenant SSH keys are planned for a later release.
:::
::: tip
Scope the token to a single repository and to read-only access. That is the smallest credential that lets Prüfwerk clone your code.
:::
## Git Submodules
Yes: repositories with submodules are scanned **including their submodules**.
Firmware projects usually pull their HAL, RTOS or network stack in as
submodules, and without them the scan would miss code your product ships.
- **Checked out automatically.** After cloning, Prüfwerk checks out every
submodule listed in `.gitmodules`, and their submodules, up to **three
levels** deep. Relative URLs (`../lib.git`) are resolved against the
repository's own URL, as git does.
- **Same rules as the repository.** Each submodule URL must be HTTPS and on a
publicly reachable host. SSH URLs (`git@host:…`, `ssh://…`) are refused.
- **Your token stays on your host.** The repository's token is only sent to
submodules on the **same host** as the repository. Submodules elsewhere
(for example public GitHub projects) are fetched without credentials, so
a private submodule on another host cannot be fetched.
- **Nothing is skipped silently.** A submodule that is refused or cannot be
fetched is left out, and the scan run lists it under **Nicht
ausgeführt** (Not run) with its name and the reason.
- **Third-party code.** Vendor directories (for example `Middlewares/`,
`Drivers/`, `CMSIS/`, `third_party/`) and well-known libraries such as
FreeRTOS, lwIP, Mbed TLS or wolfSSL are left out of the static code
analysis, since that is not your code. They still appear in the
software bill of materials and are checked for known vulnerabilities.
A repository with many submodules can take several minutes to clone the first
time. While it does, the scan shows **Projekt erkennen · Submodule holen**.
Later scans reuse the checkout and only fetch what changed.
::: tip SSH submodule URLs
If your `.gitmodules` uses SSH URLs, change them to their HTTPS form, e.g.
`git@github.com:org/lib.git` becomes `https://github.com/org/lib.git`.
:::
## Large Repositories and Git LFS
A clone or fetch may take up to **30 minutes** and download up to **4 GB**.
A repository beyond that ends the scan with a message saying which limit it
hit; the operator can raise both (`GIT_CLONE_TIMEOUT_SECS`,
`GIT_CLONE_MAX_MB`). The full history is cloned, so the secret scan also finds
secrets in earlier commits.
Files kept in **Git LFS** (`filter=lfs` in `.gitattributes`) are not
downloaded: they are usually binary assets (graphics, 3D models, libraries)
that the scanners do not read. The scan run lists the LFS patterns under
**Nicht ausgeführt** as **Git-LFS-Dateien**, so it stays visible that their
content was not checked.
## The Target's Page
A click on a target in the **Prüfobjekte** list opens its page. At the top are
its name, type and artifacts, and the buttons:
- **Prüfung starten** (Run scan) -- starts a scan now.
- **Nachweispaket herunterladen** (Download evidence pack) -- a ZIP with the
OSCAL assessment (CRA Annex I), the SBOM (CycloneDX, SPDX), the findings
(JSON, CSV), the CVE alerts and a manifest with SHA-256 checksums.
- **Bearbeiten** (Edit) -- see below.
- **Löschen** (Delete) -- see below.
Below them:
- **CRA-Stand** -- the target's standing against the CRA; **Stand je
Anforderung** opens the status of each requirement.
- **Stückliste** -- the number of components and of known vulnerabilities (CVE).
- **Offene Befunde** -- the most severe open findings; **Alle Befunde dieses
Prüfobjekts** opens the full list.
- **Prüfläufe** -- the scan runs, see [Prüfungen](/guide/scanning).
- **Prüfumfang** (What is checked) -- the applicable scans and the
**Erkannte Merkmale** (detected facts) about the code.
- **Befunde aus manuellen Tests** -- findings from penetration tests or DAST
runs, entered by hand or imported; see
[Befunde aus manuellen Tests](/guide/manual-findings).
## Editing a Target
**Bearbeiten** on the target's page opens **Prüfobjekt bearbeiten**. There you
can:
- change the **Name** and the **Typ**;
- add artifacts (for a repository with its **Branch**) or remove them;
- set a new access token (**Neues Token (leer lassen, um es zu behalten)**) or
remove it (**Token entfernen**);
- enter or change the password of a password-protected archive;
- upload another file under **Datei hinzufügen**: an archive (zip, tar, tar.gz),
a PLC project or a firmware image. It is uploaded at once and checked by the
next scan.
Click **Speichern** (Save) to keep the changes. Changes take effect with the next
scan.
## Connecting an Issue Tracker
New findings can be created as issues in GitHub, GitLab, Gitea or Jira. The
dashboard has no settings for this yet: the tracker is configured per target
through the API, with `PATCH /api/v1/targets/{id}` and a
`scan_config.issue_tracker` object with `tracker_type` (`github`, `gitlab`,
`gitea` or `jira`), `owner`, `repo` and `token`. The token is stored encrypted
and never returned. Created issues appear under **Tickets** in the sidebar and
on each finding's page under **Verknüpftes Ticket**. See
[Issues & Tracking](/guide/issues).
## Deleting a Target
**Löschen** on the target's page asks for confirmation: "Damit werden das
Prüfobjekt und seine Befunde, SBOM-Einträge, Prüfläufe und CVE-Warnungen
endgültig entfernt." (This permanently removes the target and its findings,
SBOM entries, scan runs and CVE alerts.) Its uploaded files, tracker-issue
records and code graph are removed too.
This cannot be undone.