Files
pruefwerk/.env.example
T
Sharang ParnerkarandClaude Opus 5.5 3e17163a6e
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 10m4s
feat(cve): the daily monitor re-checks NVD/CPE-only components incrementally
The CVE monitor asked only OSV, so Yocto recipes, header-detected embedded
libraries and the CODESYS runtime were re-matched in NVD only by a scan.
A new NVD pass (pipeline/nvd_monitor.rs) reads NVD's lastMod listing
(lastModStartDate/lastModEndDate, windows of at most 120 days, 500 CVEs per
page, one listing for all tenants) and matches the changed CVEs locally with
the scan's rules (virtualMatchString semantics, marker, version range).

- Cursor in the admin DB (done_until + open window/startIndex/total): a run
  stopped by its 10-minute budget, an NVD or a database error continues
  there; a listing that shrinks while paged is re-read from earlier.
- Paced with nvd_cpe::request_interval (0.6 s with NVD_API_KEY, 6 s
  without), reusing the nvd_cpe client (fetch with retries, factored out).
- Matches become the scan's CveAlert (purl, cvss, repo_id), stored with
  $setOnInsert on (cve_id, repo_id) (vex_lifecycle::store_monitored, now
  shared with the OSV pass), VEX attached, notify_new_cves, and CVE issues
  for new alerts via the shared CveIssueSync (incomplete: closes nothing).
- One INFO line per tenant with counts; NVD_MONITOR=off turns it off
  (default on).

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

189 lines
8.4 KiB
Bash

# MongoDB
MONGODB_URI=mongodb://root:example@localhost:27017/compliance_scanner?authSource=admin
MONGODB_DATABASE=compliance_scanner
# LiteLLM
LITELLM_URL=http://localhost:4000
LITELLM_API_KEY=
LITELLM_MODEL=gpt-4o
# GitHub
GITHUB_TOKEN=
GITHUB_WEBHOOK_SECRET=
# GitLab
GITLAB_URL=https://gitlab.com
GITLAB_TOKEN=
GITLAB_WEBHOOK_SECRET=
# Jira
JIRA_URL=https://your-org.atlassian.net
JIRA_EMAIL=
JIRA_API_TOKEN=
JIRA_PROJECT_KEY=
# SearXNG
SEARXNG_URL=http://localhost:8888
# NVD
NVD_API_KEY=
# The CVE monitor re-checks components only NVD knows (Yocto recipes, embedded
# libraries, CODESYS runtime) by NVD's changed CVEs; on by default.
# NVD_MONITOR=off
# Agent
AGENT_PORT=3001
# Port of the separate webhook listener (Git push / PR events).
WEBHOOK_PORT=3002
# Scans (and PR reviews) running at once across all tenants; each is a clone
# plus semgrep and syft. Requests for a target already being scanned coalesce
# into one follow-up instead of running in parallel.
SCAN_CONCURRENCY=2
SCAN_SCHEDULE=0 0 */6 * * *
CVE_MONITOR_SCHEDULE=0 0 0 * * *
# Managed git sources (#439): hosts a tenant's Gitea may be on (anchored regex),
# minutes between syncs of the org's repositories, and the public origin of the
# webhook server for the webhook URL the platform API returns.
# GIT_SOURCE_HOST_PATTERN=^[a-z0-9-]+\.code(-stage)?\.breakpilot\.com$
# GIT_SOURCE_SYNC_MINUTES=30
# WEBHOOK_PUBLIC_URL=https://pruefwerk-hooks.example.com
# Grouping (#464): more than this many low/info findings of one scanner's rule
# in one repository become one finding listing every place (`off`: never).
# Per scanner as `scanner=N` or `scanner=off`; the severities that are grouped.
# FINDING_GROUP_THRESHOLD=5
# FINDING_GROUP_SCANNERS=mobsfscan=5,gitleaks=off
# FINDING_GROUP_SEVERITIES=low,info
# Issue catch-up (Gitea only): after a scan's own issues, open medium+ findings
# that never got an issue are linked to their existing issue or get a new one,
# at most 20 new per target and scan. off (default) | dry_run (log counts only) | on
# ISSUE_CATCHUP=off
# Closing CVE issues a VEX statement settles (not_affected or fixed), with a
# comment, at most 20 per target and scan; no new issue is opened for such a
# CVE either way. off (default) | dry_run (log counts per VEX status) | on
# ISSUE_AUTOCLOSE=off
GIT_CLONE_BASE_PATH=/tmp/compliance-scanner/repos
# NuGet licenses (#467): look up licenses the tree's .nuspec files do not give
# on api.nuget.org (package id and version only; never for ids a nuget.config
# routes to another feed). Set to false to keep the lookup offline.
NUGET_LICENSE_LOOKUP=true
# Dynamic PLC testing — ephemeral soft-PLC provisioning (#183). Off unless
# enabled; requires the agent container to have Docker access (socket mount).
# When on, a PLC/SPS target with control logic but no reachable device gets its
# logic instantiated on a throwaway OpenPLC, probed, then torn down.
PLC_RUNTIME_ENABLED=0
PLC_RUNTIME_IMAGE=repo.breakpilot.com/pruefwerk/openplc:latest
PLC_RUNTIME_NETWORK=certifai
PLC_RUNTIME_MEMORY=512m
PLC_RUNTIME_CPUS=0.5
PLC_RUNTIME_MAX_LIFETIME_SECS=180
PLC_RUNTIME_OPENPLC_USER=openplc
PLC_RUNTIME_OPENPLC_PASSWORD=openplc
# Werkbank runner API (/api/v1/werkbank/jobs/*, /api/v1/werkbank/artifacts/*).
# Mounted when this static token is set OR a tenant registry is configured
# (runners then present portal-issued `bp_…` API keys with scope
# werkbank:runner, verified via the registry). Unset + no registry = not mounted.
WERKBANK_RUNNER_TOKEN=
# Breakpilot Platform (PRODUCT_INTEGRATION_SPEC 2.0)
# Deployment environment: dev (default) | staging | production.
# Anything but dev is HARDENED: the agent, dashboard and MCP server refuse to
# start unless auth is fully configured, instead of quietly serving
# unauthenticated as the `dev` tenant. Required in staging/production:
# KEYCLOAK_URL, KEYCLOAK_REALM, KEYCLOAK_AUDIENCE, CORS_ALLOWED_ORIGINS,
# TENANT_REGISTRY_URL, TENANT_REGISTRY_CLIENT_ID/_SECRET,
# PLATFORM_ALLOWED_CLIENTS, SECRETS_ENCRYPTION_KEY (+ MCP_PORT for
# compliance-mcp, DASHBOARD_SESSION_KEY for the dashboard).
APP_ENV=dev
# 64 hex characters (32 bytes) that seal tenant credentials (git and tracker
# tokens, webhook secrets) at rest. Generate with `openssl rand -hex 32`. Without
# it the agent refuses to store a credential. Changing it makes every stored
# credential unreadable, so keep it with the database backups.
SECRETS_ENCRYPTION_KEY=
# Catalog key this deployment serves; used for entitlement checks, usage
# events and the platform handshake.
PRODUCT_KEY=pruefwerk
# Tenant registry: entitlement authority (POST /v1/internal/entitlements/check,
# cached ≤60 s, fail-closed), tenant list for the scheduler, API-key verify.
# Unset = claims-only mode (dev).
TENANT_REGISTRY_URL=
# client_credentials for the registry (Keycloak client `pruefwerk-svc-<env>`).
TENANT_REGISTRY_CLIENT_ID=
TENANT_REGISTRY_CLIENT_SECRET=
# JWT audience that user/service tokens must carry (scope `pruefwerk-audience`).
# Default `pruefwerk`; an empty string disables audience validation — dev only,
# rejected at startup when APP_ENV is staging/production.
KEYCLOAK_AUDIENCE=pruefwerk
# Browser origins allowed by CORS (csv). Unset = permissive — dev only,
# rejected at startup when APP_ENV is staging/production.
CORS_ALLOWED_ORIGINS=https://app-stage.breakpilot.com,https://pruefwerk-stage.breakpilot.com
# Keycloak client ids (azp) allowed on /api/v1/platform/* with a service token.
# The built-in default (tenant-registry-svc-{stage,prod},portal-svc-{stage,prod})
# applies in dev only; staging/production must name its own clients.
PLATFORM_ALLOWED_CLIENTS=
# Dashboard
DASHBOARD_PORT=8080
AGENT_API_URL=http://localhost:3001
# 128 hex characters (64 bytes): half signs the session cookie, half seals the
# session records in Mongo (they hold the user's Keycloak tokens). Generate
# with `openssl rand -hex 64`. Required in staging/production; unset in dev
# means sessions end when the dashboard restarts.
DASHBOARD_SESSION_KEY=
# The platform portal, for the sidebar's "Zur Plattform" link to the user's
# workspace (<PORTAL_URL>/<tenant_slug>/dashboard). Staging:
# https://app-stage.breakpilot.com, production: https://app.breakpilot.com.
# Unset hides the link.
# PORTAL_URL=
# The docs site the sidebar links to. Default /docs/ (the docs container on
# the dashboard host); production uses https://docs.breakpilot.com/pruefwerk/.
# DOCS_URL=
# MCP Server
MCP_ENDPOINT_URL=http://localhost:8090
# Absolute health URL for the default MCP server card. Set it where an ingress
# routes /mcp/* to a server that serves /health at its own root (staging:
# https://pruefwerk-stage.breakpilot.com/mcp/health). Derived from
# MCP_ENDPOINT_URL when unset.
# MCP_HEALTH_URL=
# Keycloak (required for authentication)
KEYCLOAK_URL=http://localhost:8080
KEYCLOAK_REALM=compliance
KEYCLOAK_CLIENT_ID=compliance-dashboard
REDIRECT_URI=http://localhost:8080/auth/callback
APP_URL=http://localhost:8080
# Control mapping (OSCAL catalog from breakpilot-compliance)
# Unset BREAKPILOT_BASE_URL to run snapshot-only: the image ships a CRA catalog
# snapshot, so findings still carry control_refs without the backend. The
# master-controls catalog is DB-derived and not shipped — turn the semantic pass
# off when running snapshot-only.
# BREAKPILOT_BASE_URL=https://api-dev.breakpilot.ai
# BREAKPILOT_TOKEN=
BREAKPILOT_SNAPSHOT_DIR=/data/compliance-scanner/oscal
# BREAKPILOT_SEMANTIC_MAPPING=false
# BREAKPILOT_GROUNDED_CHECKS=true
# Execute code from the repositories being scanned, or fetch from hosts they
# name? A few stages do: cargo clippy compiles the repo (build.rs, proc
# macros), ESLint runs from the repo's own node_modules, pip-compile builds
# sdists (setup.py), the firmware reproducible build shells out to Nix with
# sandbox=false, and npm / cargo lockfile generation and cargo metadata fetch
# whatever the manifests name (#330). They are OFF unless this is set, and a
# staging/production APP_ENV ignores it — the agent holds every tenant's data.
# Without them, commit a lockfile; firmware SBOMs come from an imported
# Firmwerk bundle.
# PW_ALLOW_UNTRUSTED_CODE_EXEC=1
# Deployment feature flags (comma list). `source_only` = static analysis only:
# the scan pipeline skips DAST, pentest, the ICS probe and the ephemeral PLC
# runtime (recorded as skipped stages, not failures), and the dashboard hides
# those actions. Staging runs with it until that infrastructure is deployed.
# PW_FEATURES=source_only
# OpenTelemetry (optional - omit to disable)
# OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
# OTEL_SERVICE_NAME=compliance-agent