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) Canceled after 6m28s
Git tokens, tracker tokens, webhook secrets and pentest passwords were stored
in plain text and returned by the API. The old crypto helper fell back to
plain text when no key was set.
- `secrets::SecretBox`: AES-256-GCM under `SECRETS_ENCRYPTION_KEY`, with sealed
values stored as `enc:v1:…`. With no key it refuses to seal instead of
storing plain text. The key is required when APP_ENV is hardened, and a
malformed key stops startup in every environment. It replaces
`pentest/crypto.rs`.
- `compliance_core::models::Credentials` lists each record's credential fields
once. The agent seals them before a write and redacts them from every target,
DAST target and pentest-session response, including the MCP pentest tools.
- `PATCH /targets/{id}`: a credential left out keeps its stored value, an
empty string clears it, and a new one is sealed. A client echoing a redacted
record back therefore cannot erase a token.
- Pentest sessions are sealed before the first insert. Previously they were
inserted in plain text and encrypted afterwards.
- On startup the agent seals credentials that were stored in plain text.
- Webhook receivers fail closed: a target without a usable secret gets 401
instead of unsigned acceptance. GitLab tokens are compared in constant time.
New targets no longer get a webhook secret at creation; issuing one comes
back with the webhook work.
Part 1 of #260 (agent). Dashboard session hardening, the open redirect and
the webhook proxy follow in a separate PR.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
91 lines
3.5 KiB
Markdown
91 lines
3.5 KiB
Markdown
# Webhooks & PR Reviews
|
|
|
|
Webhooks let Prüfwerk respond to events in your Git repositories automatically. When configured, pushes to your repository trigger scans, and pull requests receive automated security reviews.
|
|
|
|
## What Webhooks Enable
|
|
|
|
- **Automatic scans on push** -- every time code is pushed to your default branch, a scan is triggered automatically
|
|
- **PR security reviews** -- when a pull request is opened or updated, Prüfwerk scans the changes and posts a review comment summarizing any security findings in the diff
|
|
|
|
::: warning Not available yet
|
|
Prüfwerk does not issue webhook secrets yet, and it rejects every webhook
|
|
delivery for a repository that has no secret, so webhooks cannot be set up in
|
|
this release. Scans run on their schedule or when you start them. The setup
|
|
below applies once webhook secrets can be issued again.
|
|
:::
|
|
|
|
## Finding the Webhook URL and Secret
|
|
|
|
Each repository gets its own webhook URL and secret. Prüfwerk stores the
|
|
secret encrypted and never returns it from the API.
|
|
|
|
## Setting Up Webhooks
|
|
|
|
### Gitea
|
|
|
|
1. Go to your repository in Gitea
|
|
2. Navigate to **Settings > Webhooks > Add Webhook > Gitea**
|
|
3. Set the **Target URL** to the webhook URL from Prüfwerk
|
|
4. Set the **Secret** to the webhook secret from Prüfwerk
|
|
5. Under **Trigger On**, select:
|
|
- **Push Events** -- for automatic scans on push
|
|
- **Pull Request Events** -- for PR security reviews
|
|
6. Set the content type to `application/json`
|
|
7. Click **Add Webhook**
|
|
|
|
### GitHub
|
|
|
|
1. Go to your repository on GitHub
|
|
2. Navigate to **Settings > Webhooks > Add webhook**
|
|
3. Set the **Payload URL** to the webhook URL from Prüfwerk
|
|
4. Set the **Content type** to `application/json`
|
|
5. Set the **Secret** to the webhook secret from Prüfwerk
|
|
6. Under **Which events would you like to trigger this webhook?**, select **Let me select individual events**, then check:
|
|
- **Pushes** -- for automatic scans on push
|
|
- **Pull requests** -- for PR security reviews
|
|
7. Click **Add webhook**
|
|
|
|
### GitLab
|
|
|
|
1. Go to your project in GitLab
|
|
2. Navigate to **Settings > Webhooks**
|
|
3. Set the **URL** to the webhook URL from Prüfwerk
|
|
4. Set the **Secret token** to the webhook secret from Prüfwerk
|
|
5. Under **Trigger**, check:
|
|
- **Push events** -- for automatic scans on push
|
|
- **Merge request events** -- for PR security reviews
|
|
6. Click **Add webhook**
|
|
|
|
## PR Review Flow
|
|
|
|
When a pull request (or merge request) is opened or updated, the following happens:
|
|
|
|
1. Your Git provider sends a webhook event to Prüfwerk
|
|
2. Prüfwerk checks out the PR branch and runs a targeted scan on the changed files
|
|
3. Findings specific to the changes in the PR are identified
|
|
4. Prüfwerk posts a review comment on the PR summarizing:
|
|
- Number of new findings introduced by the changes
|
|
- Severity breakdown
|
|
- Details for each finding including file, line, and remediation guidance
|
|
|
|
This gives developers immediate security feedback in their pull request workflow, before code is merged.
|
|
|
|
::: tip
|
|
PR reviews focus only on changes introduced in the pull request, not the entire codebase. This keeps reviews relevant and actionable.
|
|
:::
|
|
|
|
## Events to Select
|
|
|
|
Here is a summary of which events to enable for each feature:
|
|
|
|
| Feature | Gitea | GitHub | GitLab |
|
|
|---------|-------|--------|--------|
|
|
| Scan on push | Push Events | Pushes | Push events |
|
|
| PR reviews | Pull Request Events | Pull requests | Merge request events |
|
|
|
|
You can enable one or both depending on your workflow.
|
|
|
|
::: warning
|
|
Make sure the webhook secret matches exactly between your Git provider and Prüfwerk. Requests with an invalid signature are rejected.
|
|
:::
|