Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
mutation-server-protocol
Advanced tools
Schema validation for the mutation server protocol (MSP).
The Mutation Server Protocol (MSP) provides endpoints for IDEs to run mutation testing and report the progress.
[!NOTE]
Inspired by the Language Server Protocol
This document describes the 0.1 version of the mutation server protocol.
The base protocol exchanges JSON-RPC 2.0 messages between the client and the server via a socket connection. The server must answer each request from the client with a response. The server may also send notifications to the client. The protocol is designed to be language agnostic and can be used with any programming language.
The mutation server must:
{"port": 1234 }
.The client parses this message and connects to the server.
The protocol may support additional inter-process communication (IPC) methods, such as standard input/output (stdio), pipes, and sockets.
[!TIP] Locations are reported as part of the messages are always 1-based. The first line in a file is 1, and the first column in a line is 1.
Content-Length: ...\r\n
\r\n
{
"jsonrpc": "2.0",
"id": 1,
"method": "discover",
"params": {
...
}
}
The message above is a request to the server or from the server to the client. Each message contains a Content-Length
header that specifies the length of the content part. The message is encoded as UTF-8.
The discover
and mutationTest
methods accept file paths as an array of strings. A path that ends with /
indicates a directory.
Each path can specify exactly which code blocks to mutate/discover using a mutation range. This can be done by postfixing your file with :startLine[:startColumn]-endLine[:endColumn]
. Some examples:
"src/app.js:1-11"
"src/app.js:5:4-6:4"
"src/util/"
The MSP defines the following methods:
discover
: Discovers mutants in the given file paths.mutationTest
: The method to start a mutation test run.The configure
method is used to configure the server. The server must respond with a ConfigureResult
message.
export interface ConfigureParams {
/**
* The (relative or absolute) path to mutation testing framework's config file to load.
*/
configFilePath?: string;
}
export interface ConfigureResult {
/**
* The mutation testing server protocol major version that the client supports (major)
* For example, "1"
*/
version: string;
}
The discover
method is used to discover mutants in the given file paths. The server must respond with a DiscoverResult
message.
The DiscoveredMutant
type is a subset of the MutantResult
type. The MutantResult
is the type that can be found in the mutation testing report schema.
type DiscoverParams = {
/**
* The files to run discovery on, or undefined to discover all files in the current project.
* A file ending with a `/` indicates a directory. Each path can specify exactly which code blocks to mutate/discover using a mutation range.
* This can be done by postfixing your file with `:startLine[:startColumn]-endLine[:endColumn]`.
*/
files?: string[];
};
type DiscoverResult = {
files: DiscoveredFiles;
};
type DiscoveredFiles = Record<string, DiscoveredFile>;
type DiscoveredFile = {
mutants: DiscoveredMutant[];
};
type DiscoveredMutant = {
id: string;
location: Location;
description?: string;
mutatorName: string;
replacement?: string;
};
type Location = {
start: Position;
end: Position;
};
type Position = {
line: number;
column: number;
};
The mutationTest
method starts a mutation test run. The server must respond with a MutationTestResult
message.
Whenever a partial result is in, the server is expected to send a reportMutationTestProgress
notification with the partial result as MutationTestResult
.
[!NOTE] The MutantResult should adhere to the mutation testing report schema
type MutationTestParams = {
/**
* The files to run mutation testing on, or undefined to run mutation testing on all files in the current project.
* A file ending with a `/` indicates a directory. Each path can specify exactly which code blocks to mutate/discover using a mutation range.
* This can be done by postfixing your file with `:startLine[:startColumn]-endLine[:endColumn]`.
*/
files?: string[];
};
type MutationTestResult = {
files: MutantResultFiles;
};
type MutantResultFiles = Record<string, MutantResultFile>;
type MutantResultFile = {
mutants: MutantResult[];
};
type MutantResult = DiscoveredMutant & {
coveredBy?: string[];
duration?: number;
killedBy?: string[];
static?: boolean;
status: MutantStatus;
statusReason?: string;
testsCompleted?: number;
};
type MutantStatus =
| 'Killed'
| 'Survived'
| 'NoCoverage'
| 'Timeout'
| 'CompileError'
| 'RuntimeError';
TODO
FAQs
Schema validation for the mutation server protocol (MSP).
We found that mutation-server-protocol demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.