The extension automatically detects a KasperskyOS project in the open workspace and starts. The detection parameter is the presence of the .vscode/kos_project.json file or einit directory in the workspace. If the extension has not automatically activated in the directory but you are certain that it is a KasperskyOS project, run the command KOS: Activate extension in this directory. This command activates the extension and creates an empty .vscode/kos_project.json file in the project directory. To cancel manual activation, delete this file.
After startup, the extension adds the buttons listed in the article titled Buttons in the lower panel to the lower panel of the Visual Studio Code editor.
Functions that provide buttons can also be called from the command line of the code editor, which can be opened by pressing F1. All commands have the KOS: prefix.
Working with a basic KasperskyOS image
The extension lets you avoid having to completely build a KasperskyOS-based solution after making changes to application code. Instead, you can use the following scenario:
CMake commands of the kpa library to pack a program into a KPA package.Working with a solution security policy description
The extension lets you do the following:
"Go to Definition") when creating PSL files.The functionality for working with PSL is not supported if Ginger templating is used in the PSL file.
To create a basic security policy description:
KOS: Generate policy file for current project.Grant all permissions: create a basic solution security policy description that allows all interactions between different processes of any class and between these processes and the KasperskyOS kernel, and that also allows any process to initialize the startup of processes.Grant necessary permissions: create a basic solution security policy description that allows all interactions between different processes of any class and between these processes and the KasperskyOS kernel, and that also determines the necessary permissions for initializing the startup of processes based on the init.yaml.in file within the project.To use the created security policy in a KasperskyOS-based solution, you must specify it in the SECURITY_PSL parameter when calling the CMake commands build_kos_hw_image()/build_kos_qemu_image() in the CMakeLists.txt file for building the Einit program.
These policies can be used only as stubs during the early stages of development of a KasperskyOS-based solution so that the Kaspersky Security Module does not manage interactions. It would be unacceptable to apply such policies in a real-world KasperskyOS-based solution.
Running tests
After the extension is activated, the Testing tab (
) appears on the side panel of Visual Studio Code. When you select the Testing tab, the code editor window displays a tree of tests created using the Google Test library and found in files in the test/ directory.
To run the tests, tap the
button. All detected tests are run by default. However, you can select specific tests on the tabs containing the source code of the tests, or you can select specific groups of tests by selecting them from the tree of all tests. You can only run tests that are added to CMakeLists.txt files for building programs using the generate_kos_test() CMake command from the test_generator CMake library included in the SDK.
The test results and log files are located in the directory <build_directory>/bin/tests/output.
Starting solution security policy tests
The extension lets you run solution security policy tests for a project if they were created based on the solution security policy description.
To build and run solution security policy tests:
CMake commands for building solution security policy tests have been added to one of the CMakeLists.txt files of the project.
button in the lower panel.
and select the target named kos-qemu-image-PalTest<N>-sim (N refers to the PSL file index within the list of PSL files containing solution security policy tests).