Skip to content

feat: add layered analysis support #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 45 additions & 46 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sysdig-lsp"
version = "0.4.1"
version = "0.5.0"
edition = "2024"
authors = [ "Sysdig Inc." ]
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ helping you detect vulnerabilities and misconfigurations earlier in the developm
| Scan base image in Dockerfile | Supported | [Supported](./docs/features/scan_base_image.md) (0.1.0+) |
| Code lens support | Supported | [Supported](./docs/features/code_lens.md) (0.2.0+) |
| Build and Scan Dockerfile | Supported | [Supported](./docs/features/build_and_scan.md) (0.4.0+) |
| Layered image analysis | Supported | In roadmap |
| Layered image analysis | Supported | [Supported](./docs/features/layered_analysis.md) (0.5.0+)|
| Docker-compose image analysis | Supported | In roadmap |
| K8s Manifest image analysis | Supported | In roadmap |
| Infrastructure-as-code analysis | Supported | In roadmap |
Expand Down
4 changes: 4 additions & 0 deletions docs/features/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,8 @@ Sysdig LSP provides tools to integrate container security checks into your devel
- Builds and scans the entire final Dockerfile image used in production.
- Supports multi-stage Dockerfiles, analyzing final stage and explicitly copied artifacts from intermediate stages.

## [Layered Analysis](./layered_analysis.md)
- Scans each Dockerfile layer individually for precise vulnerability identification.
- Supports detailed analysis in single-stage and multi-stage Dockerfiles.

See the linked documents for more details.
Binary file added docs/features/layered_analysis.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions docs/features/layered_analysis.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Layered Analysis

Sysdig LSP provides Layered Analysis to scan each layer created by your Dockerfile instructions individually.
This helps you quickly identify and remediate vulnerabilities introduced at specific steps, optimizing your container security.

> [!IMPORTANT]
> In multi-stage Dockerfiles, layers of the final runtime stage are analyzed individually.
> Intermediate stages are only considered if their layers or artifacts are explicitly copied into the final runtime stage.

![Sysdig LSP performing Layered Analysis](./layered_analysis.gif)

## Examples

### Single-stage Dockerfile (fully analyzed)

```dockerfile
FROM ubuntu:22.04
RUN apt-get update && apt-get install -y python3
COPY ./app /app
RUN pip install -r /app/requirements.txt
```
In this Dockerfile, Sysdig LSP individually scans each layer, identifying exactly which step introduces vulnerabilities.

### Multi-stage Dockerfile (layer-focused analysis)

```dockerfile
# Intermediate build stage (layers scanned only if copied)
FROM node:18-alpine AS build
RUN npm install && npm run build

# Final runtime stage (all layers analyzed individually)
FROM nginx:alpine
COPY --from=build /dist /usr/share/nginx/html
RUN apk add --no-cache curl
```
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.
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading