Skip to content

Commit 90a4e26

Browse files
authored
feat: add layered analysis support (#7)
1 parent b5e3ea4 commit 90a4e26

17 files changed

+673
-162
lines changed

Diff for: Cargo.lock

+45-46
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "sysdig-lsp"
3-
version = "0.4.1"
3+
version = "0.5.0"
44
edition = "2024"
55
authors = [ "Sysdig Inc." ]
66
readme = "README.md"

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ helping you detect vulnerabilities and misconfigurations earlier in the developm
2020
| Scan base image in Dockerfile | Supported | [Supported](./docs/features/scan_base_image.md) (0.1.0+) |
2121
| Code lens support | Supported | [Supported](./docs/features/code_lens.md) (0.2.0+) |
2222
| Build and Scan Dockerfile | Supported | [Supported](./docs/features/build_and_scan.md) (0.4.0+) |
23-
| Layered image analysis | Supported | In roadmap |
23+
| Layered image analysis | Supported | [Supported](./docs/features/layered_analysis.md) (0.5.0+)|
2424
| Docker-compose image analysis | Supported | In roadmap |
2525
| K8s Manifest image analysis | Supported | In roadmap |
2626
| Infrastructure-as-code analysis | Supported | In roadmap |

Diff for: docs/features/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,8 @@ Sysdig LSP provides tools to integrate container security checks into your devel
1414
- Builds and scans the entire final Dockerfile image used in production.
1515
- Supports multi-stage Dockerfiles, analyzing final stage and explicitly copied artifacts from intermediate stages.
1616

17+
## [Layered Analysis](./layered_analysis.md)
18+
- Scans each Dockerfile layer individually for precise vulnerability identification.
19+
- Supports detailed analysis in single-stage and multi-stage Dockerfiles.
20+
1721
See the linked documents for more details.

Diff for: docs/features/layered_analysis.gif

2.44 MB
Loading

Diff for: docs/features/layered_analysis.md

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Layered Analysis
2+
3+
Sysdig LSP provides Layered Analysis to scan each layer created by your Dockerfile instructions individually.
4+
This helps you quickly identify and remediate vulnerabilities introduced at specific steps, optimizing your container security.
5+
6+
> [!IMPORTANT]
7+
> In multi-stage Dockerfiles, layers of the final runtime stage are analyzed individually.
8+
> Intermediate stages are only considered if their layers or artifacts are explicitly copied into the final runtime stage.
9+
10+
![Sysdig LSP performing Layered Analysis](./layered_analysis.gif)
11+
12+
## Examples
13+
14+
### Single-stage Dockerfile (fully analyzed)
15+
16+
```dockerfile
17+
FROM ubuntu:22.04
18+
RUN apt-get update && apt-get install -y python3
19+
COPY ./app /app
20+
RUN pip install -r /app/requirements.txt
21+
```
22+
In this Dockerfile, Sysdig LSP individually scans each layer, identifying exactly which step introduces vulnerabilities.
23+
24+
### Multi-stage Dockerfile (layer-focused analysis)
25+
26+
```dockerfile
27+
# Intermediate build stage (layers scanned only if copied)
28+
FROM node:18-alpine AS build
29+
RUN npm install && npm run build
30+
31+
# Final runtime stage (all layers analyzed individually)
32+
FROM nginx:alpine
33+
COPY --from=build /dist /usr/share/nginx/html
34+
RUN apk add --no-cache curl
35+
```
36+
Here, Sysdig LSP individually scans every layer of the final runtime stage (`nginx:alpine`). Layers from the intermediate stage (`node:18-alpine`) are scanned only if their artifacts are explicitly copied to the final stage.

Diff for: flake.lock

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)