mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-07-26 11:49:16 +00:00
e660d2a658
Scheduled scan tasks now dispatch a completion alert through the existing notification system: info when every image scanned cleanly, warning when one or more images failed. The alert includes the task name and the run's scanned/cached/failed summary so operators do not need to open the task history.
214 lines
12 KiB
Plaintext
214 lines
12 KiB
Plaintext
---
|
|
title: "Vulnerability Scanning"
|
|
description: "Scan container images for known CVEs, surface severity badges in the Resources Hub, and alert on policy violations."
|
|
---
|
|
|
|
Sencho integrates with [Trivy](https://trivy.dev) to scan container images for known vulnerabilities (CVEs), surface severity badges next to your images, and alert when a scan result exceeds a configured threshold. On-demand scanning is available on every tier; automation, policies, and SBOM generation are Skipper and Admiral.
|
|
|
|
<Frame>
|
|
<img src="/images/vulnerability-scanning/resources-badges.png" alt="Resources Hub showing vulnerability severity badges next to image tags" />
|
|
</Frame>
|
|
|
|
## Prerequisites
|
|
|
|
The Trivy CLI must be available on the machine running Sencho. Trivy is not bundled with the Sencho Docker image; see [Installing Trivy](/operations/trivy-setup) for mount and installation options. Sencho checks for Trivy on startup and hides scanning UI when the binary is not available.
|
|
|
|
## Tier availability
|
|
|
|
| Feature | Community | Skipper | Admiral |
|
|
|---------|:---------:|:-------:|:-------:|
|
|
| On-demand image scanning | ✓ | ✓ | ✓ |
|
|
| Severity badges in the Resources Hub | ✓ | ✓ | ✓ |
|
|
| Scan results drawer with vulnerability table | ✓ | ✓ | ✓ |
|
|
| Post-deploy automated scanning | ✓ | ✓ | ✓ |
|
|
| Scheduled fleet scans (all images on a node) | | ✓ | ✓ |
|
|
| Scan policies (warning and critical alerts) | | ✓ | ✓ |
|
|
| SBOM generation (SPDX, CycloneDX) | | ✓ | ✓ |
|
|
| Scan history and comparison | | ✓ | ✓ |
|
|
|
|
## On-demand scanning
|
|
|
|
Navigate to the **Resources** tab and open the **Images** panel. When Trivy is available, every image row shows a shield icon alongside the delete action.
|
|
|
|
1. Click the shield icon on any image row to start a scan.
|
|
2. The row shows a loading spinner while Trivy runs. Most scans finish in 10 to 60 seconds depending on image size and whether the Trivy database is already cached.
|
|
3. When the scan completes, a severity badge appears next to the image status (e.g. `CRITICAL`, `HIGH`, `MEDIUM`, `LOW`, or `CLEAN`).
|
|
4. Click the badge to open the scan results drawer.
|
|
|
|
<Frame>
|
|
<img src="/images/vulnerability-scanning/scan-results.png" alt="Vulnerability scan results drawer showing CVE table with severity, package, and fix columns" />
|
|
</Frame>
|
|
|
|
### Reading severity badges
|
|
|
|
Hovering over a severity badge reveals the breakdown of vulnerabilities by severity and the timestamp of the last scan. The badge color reflects the highest severity found:
|
|
|
|
| Badge | Meaning |
|
|
|-------|---------|
|
|
| **CRITICAL** (red) | At least one vulnerability with a CVSS score of 9.0 or higher |
|
|
| **HIGH** (amber) | At least one high-severity vulnerability |
|
|
| **MEDIUM** (blue) | Only medium and lower vulnerabilities |
|
|
| **LOW** (muted) | Only low-severity vulnerabilities |
|
|
| **CLEAN** (green) | Scan completed with zero findings |
|
|
|
|
Scan results are cached by image digest. If the same digest is scanned again within 24 hours, Sencho returns the cached result instantly instead of re-running Trivy.
|
|
|
|
## The scan results drawer
|
|
|
|
The drawer shows a full breakdown of the most recent scan for an image:
|
|
|
|
- **Summary**: counts per severity (critical, high, medium, low), total vulnerabilities, how many have a fix available, the Trivy version used, and when the scan ran.
|
|
- **Filter tabs**: narrow the table to a specific severity.
|
|
- **Vulnerability table**: paginated list of every CVE found, including:
|
|
- **CVE ID** (linked to the upstream advisory)
|
|
- **Package** name and installed version
|
|
- **Severity** badge
|
|
- **Fixed version** with a green indicator if a fix is available
|
|
|
|
### Actions
|
|
|
|
From the drawer header you can:
|
|
|
|
- **Re-scan**: kick off a fresh scan, ignoring the digest cache.
|
|
- **Download SBOM**: export a Software Bill of Materials in SPDX JSON or CycloneDX format (Skipper and Admiral).
|
|
- **Export CSV**: export the full vulnerability list for offline review.
|
|
|
|
## Post-deploy automated scanning
|
|
|
|
When Trivy is available, Sencho automatically scans every deployed image in the background after a successful deploy. This applies to all deploy paths:
|
|
|
|
- Stack deploy and redeploy
|
|
- Stack update
|
|
- Template deploy from the App Store
|
|
- Git source apply
|
|
- Git source create
|
|
|
|
The deploy itself is never blocked by scanning; scans run asynchronously and surface their results via the severity badges in the Resources Hub. If high or critical vulnerabilities are found, an alert is dispatched through your configured [notification channels](/features/alerts-notifications).
|
|
|
|
### Opting out per deployment
|
|
|
|
The App Store deploy sheet includes an **Scan images for vulnerabilities after deploy** toggle (enabled by default). Uncheck it to skip the post-deploy scan for that single deployment. This does not disable scan policies globally; it simply opts this deployment out of scanning.
|
|
|
|
<Frame>
|
|
<img src="/images/vulnerability-scanning/app-store-toggle.png" alt="App Store deploy sheet showing the auto-scan checkbox enabled by default" />
|
|
</Frame>
|
|
|
|
## Scheduled fleet scans
|
|
|
|
<Note>
|
|
Scheduled scans require a **Skipper** or **Admiral** license.
|
|
</Note>
|
|
|
|
You can run recurring scans of every image on a node through the standard [Scheduled Operations](/features/scheduled-operations) system. Create a new scheduled task with action **Scan** and a cron expression. The scheduler iterates every image on the target node with a short delay between scans and records the result in the task's run history.
|
|
|
|
Use scheduled scans to keep CVE badges fresh even for images that are rarely redeployed: nightly (`0 3 * * *`) is a good default for most fleets.
|
|
|
|
### Completion notifications
|
|
|
|
When a scheduled scan finishes, Sencho dispatches an alert through your configured [notification channels](/features/alerts-notifications). The alert includes the task name and a summary of scanned, cached, and failed images:
|
|
|
|
- **Info** when every image scanned successfully.
|
|
- **Warning** when one or more images in the run failed to scan.
|
|
|
|
Failures are typically transient (registry timeouts, missing credentials) and do not stop the rest of the run from completing. Check the task's run history for the detailed output.
|
|
|
|
## Scan policies
|
|
|
|
<Note>
|
|
Scan policies require a **Skipper** or **Admiral** license.
|
|
</Note>
|
|
|
|
Policies let you define severity thresholds that the post-deploy scanner evaluates against. When a deploy's scan exceeds a policy's threshold, Sencho dispatches an alert. The policy's **Block on deploy** toggle controls the alert severity: warning when off, critical when on.
|
|
|
|
<Frame>
|
|
<img src="/images/vulnerability-scanning/security-settings.png" alt="Security section of Settings showing the scan policies list with add policy button" />
|
|
</Frame>
|
|
|
|
### Creating a policy
|
|
|
|
Go to **Settings → Security** and click **Add Policy**.
|
|
|
|
| Field | Description |
|
|
|-------|-------------|
|
|
| **Name** | A descriptive label (e.g. "Production critical block"). |
|
|
| **Stack pattern** | Optional glob against stack names (e.g. `prod-*`). Leave empty to match every stack. |
|
|
| **Max severity** | The threshold. If a scan finds any vulnerability at or above this severity, the policy fires. |
|
|
| **Block on deploy** | When enabled, policy violations are dispatched as critical (error) alerts. When disabled, they are dispatched as warnings. |
|
|
| **Enabled** | Disabled policies are skipped during evaluation. |
|
|
|
|
### Policy scoping
|
|
|
|
When multiple policies match a deploy, Sencho picks the most specific one:
|
|
|
|
1. Policies scoped to a specific node win over global policies.
|
|
2. Policies with a stack pattern win over wildcard policies.
|
|
3. Disabled policies are never applied.
|
|
|
|
Only one policy is evaluated per deploy; use a single tight pattern rather than overlapping policies for clarity.
|
|
|
|
## SBOM generation
|
|
|
|
<Note>
|
|
SBOM generation requires a **Skipper** or **Admiral** license.
|
|
</Note>
|
|
|
|
A Software Bill of Materials (SBOM) is a machine-readable inventory of every package present in a container image. SBOMs are required by an increasing number of security frameworks (SLSA, Executive Order 14028, EU Cyber Resilience Act) and are useful for offline compliance reviews.
|
|
|
|
From the scan results drawer, click **Download SBOM** and choose a format:
|
|
|
|
| Format | Use case |
|
|
|--------|----------|
|
|
| **SPDX JSON** | Widely supported, best for tooling integration. |
|
|
| **CycloneDX** | Richer dependency metadata, better for supply-chain analysis. |
|
|
|
|
The download starts immediately and uses the image's digest (when available) in the filename.
|
|
|
|
## Scan history
|
|
|
|
Every scan Sencho runs is stored with its full vulnerability detail. Scan records are automatically pruned after 90 days to keep the database compact. The history is used to power:
|
|
|
|
- **Digest caching**: skip re-scanning an image that has already been scanned within 24 hours.
|
|
- **Trend badges**: surface whether the latest scan added or resolved vulnerabilities compared to the previous scan for the same image.
|
|
|
|
## How it works
|
|
|
|
1. On startup, Sencho looks for the `trivy` binary on `PATH` and caches its availability.
|
|
2. When a scan is triggered, Sencho resolves the image digest via Docker and checks the 24-hour cache. If a completed scan exists for that digest, it is returned instantly.
|
|
3. Otherwise, Sencho spawns `trivy image --format json --quiet <image-ref>` and parses the JSON output into the vulnerability database.
|
|
4. Private registry credentials are forwarded automatically by writing a temporary `DOCKER_CONFIG` for the Trivy subprocess, then deleting it when the scan completes.
|
|
5. Scan status, counts per severity, and the full vulnerability list are persisted for display in the drawer and for policy evaluation.
|
|
|
|
## Troubleshooting
|
|
|
|
### Scan button is not visible
|
|
|
|
Sencho hides scanning UI when the Trivy binary is not detected. Check **Settings → Support** for the Trivy availability status, then follow [Installing Trivy](/operations/trivy-setup) if it is missing.
|
|
|
|
### Scans time out
|
|
|
|
The default scan timeout is 5 minutes. Very large images (2+ GB) over a slow connection may exceed this; pre-pulling the image to the host speeds up the scan significantly because Trivy works against the local image store.
|
|
|
|
### Private registry images fail to scan
|
|
|
|
Sencho forwards the same registry credentials configured under **Settings → Registries** to Trivy during a scan. If a pull works in Sencho but a scan fails, make sure the image has been pulled at least once (Trivy can then work against the cached local image).
|
|
|
|
### Badge is out of date after an image update
|
|
|
|
Post-deploy scanning only runs on deploy actions. For long-running images that aren't redeployed, schedule a recurring scan (Skipper+) or click the shield icon in the Resources Hub to re-scan on demand.
|
|
|
|
### A scan shows "in progress" for a long time
|
|
|
|
Scans have a 5-minute internal timeout. The scheduler also sweeps every tick and marks any scan that has been `in progress` for more than 15 minutes as failed, so the UI always recovers on its own. Wait for the sweep to run, then click the shield icon again to start a fresh scan.
|
|
|
|
### Trivy is not detected after installing it
|
|
|
|
Sencho re-checks for the Trivy binary every ten minutes from the scheduler. Install Trivy on the host, wait for the next window, and the scanning UI lights up automatically.
|
|
|
|
### Collecting diagnostic logs for support
|
|
|
|
Enable **Developer Mode** under **Settings → Developer** and trigger the failing scan again. The backend logs verbose `[Trivy:diag]` entries covering detection timing, cache hits, Trivy invocation, and parse statistics. Attach these lines when filing a support issue. Turn Developer Mode off once you have captured the output.
|
|
|
|
### Post-deploy scan failure notifications
|
|
|
|
When a post-deploy scan fails for a specific image (for example because Trivy could not resolve a private registry pull), Sencho dispatches a warning-level alert through your configured notification channels. The deploy itself is never blocked by a scan failure.
|