diff --git a/README.md b/README.md index e9db956..866226a 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,30 @@ # Sysdig LSP -Sysdig LSP is a Language Server Protocol (LSP) implementation that seamlessly integrates vulnerability management into your preferred editor. It scans images defined in Dockerfiles and requires manual configuration. - -For Visual Studio Code users, we highly recommend the [Sysdig VSCode Extension](https://marketplace.visualstudio.com/items?itemName=sysdig.sysdig-vscode-ext). This extension delivers full LSP functionality along with additional features, ensuring an optimal experience. Although the LSP is designed to eventually replace the extension, the extension currently remains the best option for VSCode. - -Repository: [https://github.com/sysdiglabs/sysdig-lsp](https://github.com/sysdiglabs/sysdig-lsp) +**Sysdig LSP** is a Language Server Protocol implementation that integrates vulnerability scanning directly into your editor. +It enables quick scans of Dockerfiles, Docker Compose files, Kubernetes manifests, and Infrastructure-as-Code (IaC) files, +helping you detect vulnerabilities and misconfigurations earlier in the development process. + +> [!NOTE] +> For Visual Studio Code users, we highly recommend the [Sysdig VSCode Extension](https://marketplace.visualstudio.com/items?itemName=sysdig.sysdig-vscode-ext). +> +> This extension currently provides full LSP functionality and additional features for the best experience. +> +> In the future, the extension will internally leverage the Sysdig LSP implementation, ensuring consistent features and a unified experience across all editors. +> +> Repository: [https://github.com/sysdiglabs/sysdig-lsp](https://github.com/sysdiglabs/sysdig-lsp) + +## Features + +| Feature | **[VSCode Extension](https://github.com/sysdiglabs/vscode-extension)** | **Sysdig LSP** | +|---------------------------------|------------------------------------------------------------------------|----------------------------------------------------------| +| Scan base image in Dockerfile | Supported | [Supported](./docs/features/scan_base_image.md) (0.1.0+) | +| Code lens support | Supported | In roadmap | +| Build and Scan Dockerfile | Supported | In roadmap | +| Layered image analysis | Supported | In roadmap | +| Docker-compose image analysis | Supported | In roadmap | +| K8s Manifest image analysis | Supported | In roadmap | +| Infrastructure-as-code analysis | Supported | In roadmap | +| Vulnerability explanation | Supported | In roadmap | ## Build @@ -42,6 +62,28 @@ Sysdig LSP is developed in Rust and can be built using Cargo or Nix (a flake is nix build .#sysdig-lsp ``` +#### Cross-compiling with Nix + +Cross-compilation is made easy with Nix, we have prepared some targets that you can execute to build the binaries as static files. +Not all cross-compilations are supported though: + +| | **Target Linux** | **Target MacOS** | **Target Windows** | +|--------------------|------------------|------------------|--------------------| +| **Host Linux** | ✅ | ❌ | ✅ | +| **Host MacOS** | ✅ | ✅ | ✅ | +| **Host Windows** | ❌ | ❌ | ❌ | + +The following binaries are built: + +- Linux x86_64: `nix build .#sysdig-lsp-linux-amd64` +- Linux aarch64: `nix build .#sysdig-lsp-linux-arm64` +- Darwin x86_64: `nix build .#sysdig-lsp-darwin-amd64` +- Darwin aarch64: `nix build .#sysdig-lsp-darwin-arm64` + +Windows is not yet supported because the Sysdig CLI Scanner is not releasing a .exe for now, but you can still build it with `nix build .#sysdig-lsp-windows-amd64` + +The result of the compilation will be saved in `./result/bin`. + ## Configuration Options Sysdig LSP supports two configuration options for connecting to Sysdig’s services: @@ -95,7 +137,11 @@ Navigate to **Settings > Configure Kate > LSP Client > User Server Settings** an ### JetBrains IDEs -> **Warning:** The configuration for JetBrains IDEs is not definitive. In the future, we plan to develop a dedicated plugin that will automatically manage the LSP and expand its functionalities. In the meantime, you can use the [LSP4IJ](https://plugins.jetbrains.com/plugin/23257-lsp4ij) plugin for initial day-one support. + +> [!WARNING] +> The configuration for JetBrains IDEs is not definitive. +> In the future, we plan to develop a dedicated plugin that will automatically manage the LSP and expand its functionalities. +> In the meantime, you can use the [LSP4IJ](https://plugins.jetbrains.com/plugin/23257-lsp4ij) plugin for initial day-one support. 1. Install the [LSP4IJ](https://plugins.jetbrains.com/plugin/23257-lsp4ij) plugin. 2. Open the LSP Client config (usually near the Terminal), click **New Language Server** and configure: diff --git a/docs/features/README.md b/docs/features/README.md new file mode 100644 index 0000000..9ac2a4d --- /dev/null +++ b/docs/features/README.md @@ -0,0 +1,3 @@ +# Sysdig LSP Features + +- [Scan Base Image](./scan_base_image.md) diff --git a/docs/features/scan_base_image.gif b/docs/features/scan_base_image.gif new file mode 100644 index 0000000..01936c9 Binary files /dev/null and b/docs/features/scan_base_image.gif differ diff --git a/docs/features/scan_base_image.md b/docs/features/scan_base_image.md new file mode 100644 index 0000000..0b92d1d --- /dev/null +++ b/docs/features/scan_base_image.md @@ -0,0 +1,35 @@ +# Scan Base Image + +Sysdig LSP scans the base image defined in your Dockerfile to identify vulnerabilities early in your development workflow. + +> [!IMPORTANT] +> Sysdig LSP analyzes only the final FROM instruction(s), as this specifies the runtime base image for your container. +> +> Intermediate stages defined in multi-stage Dockerfiles (e.g., builder images) are intentionally ignored because they don't +> form part of the final runtime environment. + +![Sysdig LSP executing base image scan in the Helix editor](./scan_base_image.gif) + +## Examples + +### Single-stage Dockerfile (scanned) + +```dockerfile +# Base image used for this Dockerfile +FROM alpine:latest +``` + +### Multi-stage Dockerfile (only the final stage is scanned) + +```dockerfile +# Build stage (ignored by Sysdig LSP) +FROM golang:1.19 AS build +RUN go build -o app main.go + +# Final image (scanned by Sysdig LSP) +FROM alpine:3.17 +COPY --from=build /app /app +ENTRYPOINT ["/app"] +``` + +In this multi-stage Dockerfile, Sysdig LSP scans only the final stage (`alpine:3.17`).