Skip to content
Open
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
11 changes: 7 additions & 4 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
!content_templates/**
!mitre_attack/data/parsed/**

!client/out/
!client/out/**/*.js
!server/out/
!server/out/**/*.js
!out/**/*.js

Expand All @@ -30,10 +32,11 @@
!client/templates/shared/**
!client/templates/styles/**

!client/webview/out/
!client/webview/out/**
!client/webview/node_modules/monaco-editor/min/vs/**
!client/webview/node_modules/@vscode/codicons/dist
!client/webview/node_modules/@vscode/codicons/dist/**

!client/node_modules/prettier/package.json
!client/node_modules/prettier/*.{js,cjs,mjs}
!client/node_modules/prettier/plugins/yaml.mjs
!node_modules/
!node_modules/prettier/
!node_modules/prettier/**
40 changes: 40 additions & 0 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,46 @@ Expansion options:
You can easily get a ready-made development environment for XP if you use the [VSCode XP Workspace](https://github.com/Security-Experts-Community/vscode-xp-workspace) project. Everything in it is collected in a single Docker container, and editing occurs through the web version of VSCode.
Details in the project repository.

### macOS Hybrid Mode

On macOS, the extension runs locally in normal VS Code: UI, tree views, editors, language features, webviews, commands and knowledgebase file access stay on the host filesystem. Only operations that require `xp-kbt`, `siemj`, `normalizer-cli` or build tools are executed inside a Docker container.

The backend can be any Docker container that has XP tools installed. [vscode-xp-workspace](https://github.com/g4n8g/vscode-xp-workspace) is a ready-made preset, but it is not required. The container must bind mount the same knowledgebase directory that is opened in local VS Code, for example:

- host: `/Users/alice/Work/knowledgebase`
- container: `/workspaces/knowledgebase`

When the extension starts in local macOS VS Code, it offers to configure the container backend. The wizard selects the local knowledgebase path, checks Docker, selects a running container or creates a new tools container, detects the container mount path, detects or asks for the KBT path, and saves settings. If xp-kbt is not found in the selected container, the wizard can download the latest `vxcontrol/xp-kbt` release, let you choose one of the recent releases, or use a manually entered KBT path. A new container is created from `mcr.microsoft.com/dotnet/sdk:8.0`, bind mounts the selected knowledgebase at `/workspaces/knowledgebase`, and then continues through the same KBT installation step.

If the automatic notification was dismissed or you want to rerun setup later, use the `XP: Configure macOS Container Backend` command from the Command Palette.

Temporary extension artifacts are stored in `tmp/xp-output` inside the local knowledgebase by default. Inside the container, the matching path is `xpConfig.docker.outputDirectoryPath`, which defaults to `/workspaces/knowledgebase/tmp/xp-output`.

Relevant settings:

- `xpConfig.toolExecutionMode`: `auto`, `local`, or `docker`
- `xpConfig.docker.containerName`
- `xpConfig.docker.workspaceHostPath`
- `xpConfig.docker.workspaceContainerPath`
- `xpConfig.docker.kbtBaseDirectory`
- `xpConfig.docker.outputDirectoryPath`
- `xpConfig.lspServerExecutablePath`
- `xpConfig.formatterExecutablePath`
- `xpConfig.macos.showContainerSetupPrompt`

While the container is being created and KBT is being installed, the extension writes detailed progress to the `eXtraction and Processing` output channel. The setup notification includes a direct action to open that output.

On local macOS, the legacy in-extension LSP is disabled. If you want definition lookup, hover, diagnostics and other language-server features, set `xpConfig.lspServerExecutablePath` to a native macOS `evt-xp-language-server` binary. Formatting can also use a native macOS binary via `xpConfig.formatterExecutablePath`. If that formatter path is empty, formatting falls back to Docker in Docker tool mode.

Troubleshooting:

- Docker not installed: install and start Docker Desktop.
- Container not running: start a container with XP tools, choose an already running container in the wizard, or rerun the setup wizard and choose to create a new container.
- Path mapping failed: check that `workspaceHostPath` points to the local knowledgebase and `workspaceContainerPath` matches the bind mount in the container.
- Tool not found in container: run the setup wizard again and choose `Download latest xp-kbt`, `Choose xp-kbt version`, or check `xpConfig.docker.kbtBaseDirectory`.
- Native LSP starts but reports schema warnings: run a build flow that generates the table schema, for example a normalization or correlation test/build that includes schema generation, and then restart or reload the extension if needed.
- Native LSP is not required on macOS: if you do not have a native `evt-xp-language-server`, leave `xpConfig.lspServerExecutablePath` empty. Docker-backed build/test operations will continue to work without LSP features.

## Event normalization

To write correlation rules, in general, you will need event normalization formulas. In our [open expertise repository](https://github.com/Security-Experts-Community/open-xp-rules) you can find basic normalization formulas. In the future there will be other types of rules in the XP language created by the community.
Expand Down
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,46 @@
Вы можете легко получить готовое окружение для разработки на XP, если воспользуетесь проектом [VSCode XP Workspace](https://github.com/Security-Experts-Community/vscode-xp-workspace). В нём всё собрано в единый Docker-контейнер, а редактирование происходит через веб-версию VSCode.
Подробности в репозитории проекта.

### Гибридный режим macOS

На macOS расширение запускается локально в обычном VS Code: UI, tree view, редакторы, language features, webviews, команды VS Code и чтение файлов knowledgebase остаются на файловой системе хоста. Только операции, которым нужны `xp-kbt`, `siemj`, `normalizer-cli` или build tools, выполняются внутри Docker-контейнера.

Backend может быть любым Docker-контейнером, в котором установлены XP tools. [vscode-xp-workspace](https://github.com/g4n8g/vscode-xp-workspace) остаётся готовым preset-примером, но не является обязательной зависимостью. Контейнер должен видеть ту же knowledgebase через bind mount, например:

- host: `/Users/alice/Work/knowledgebase`
- container: `/workspaces/knowledgebase`

При запуске в локальном VS Code на macOS расширение предлагает настроить контейнерный backend. Wizard выбирает локальный путь к knowledgebase, проверяет Docker, выбирает запущенный контейнер или создаёт новый tools-контейнер, определяет container mount path, определяет или запрашивает путь к KBT и сохраняет настройки. Если xp-kbt не найден в выбранном контейнере, wizard может скачать latest release `vxcontrol/xp-kbt`, дать выбрать одну из доступных версий релизов или использовать вручную введённый путь к KBT. Новый контейнер создаётся на базе `mcr.microsoft.com/dotnet/sdk:8.0`, монтирует выбранную knowledgebase в `/workspaces/knowledgebase` и после создания проходит тот же шаг установки KBT.

Если автоматическое уведомление было скрыто или настройку нужно повторить позже, используйте команду `XP: Настроить контейнерный backend для macOS` из палитры команд.

Временные артефакты расширения по умолчанию сохраняются в `tmp/xp-output` внутри локальной knowledgebase. В контейнере этому пути соответствует `xpConfig.docker.outputDirectoryPath`, по умолчанию `/workspaces/knowledgebase/tmp/xp-output`.

Основные настройки:

- `xpConfig.toolExecutionMode`: `auto`, `local` или `docker`
- `xpConfig.docker.containerName`
- `xpConfig.docker.workspaceHostPath`
- `xpConfig.docker.workspaceContainerPath`
- `xpConfig.docker.kbtBaseDirectory`
- `xpConfig.docker.outputDirectoryPath`
- `xpConfig.lspServerExecutablePath`
- `xpConfig.formatterExecutablePath`
- `xpConfig.macos.showContainerSetupPrompt`

Во время создания контейнера и установки KBT расширение пишет подробный прогресс в канал вывода `eXtraction and Processing`. Из уведомления setup wizard можно сразу открыть этот канал через ссылку на output.

На локальной macOS legacy LSP, встроенный в расширение, отключён. Если нужны переход к определению, hover, diagnostics и другие возможности language server, укажите в `xpConfig.lspServerExecutablePath` путь до нативного macOS-бинарника `evt-xp-language-server`. Форматирование тоже может использовать нативный macOS-бинарник через `xpConfig.formatterExecutablePath`. Если путь к форматтеру пустой, то в Docker-режиме форматирование будет выполняться через контейнер.

Troubleshooting:

- Docker not installed: установите и запустите Docker Desktop.
- Container not running: запустите контейнер с XP tools, выберите уже запущенный контейнер в wizard или повторите setup wizard и выберите создание нового контейнера.
- Path mapping failed: проверьте, что `workspaceHostPath` указывает на локальную knowledgebase, а `workspaceContainerPath` совпадает с bind mount в контейнере.
- Tool not found in container: запустите setup wizard ещё раз и выберите `Download latest xp-kbt`, `Choose xp-kbt version`, либо проверьте `xpConfig.docker.kbtBaseDirectory`.
- Native LSP starts but reports schema warnings: запустите сценарий сборки, который генерирует table schema, например сборку/тест, включающий генерацию схемы, а затем при необходимости перезапустите или перезагрузите расширение.
- Native LSP на macOS не обязателен: если у вас нет нативного `evt-xp-language-server`, оставьте `xpConfig.lspServerExecutablePath` пустым. Docker-операции сборки и тестирования продолжат работать и без LSP-функций.

## Нормализация событий

Для написания правил корреляции, в общем случае, Вам потребуются формулы нормализации событий. В нашем [открытом репозитории с экспертизой](https://github.com/Security-Experts-Community/open-xp-rules) вы сможете найти базовые формулы нормализации. В будущем там появятся другие виды правил на языке XP, созданные сообществом.
Expand Down
91 changes: 0 additions & 91 deletions client/src/ext/contextMenuExtension.ts

This file was deleted.

Loading