Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

diversify-mvn

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

diversify-mvn

Automatically diversify Maven projects using Docker by mutating dependencies versions

  • 0.0.1-alpha
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

diversify-mvn

Creates mutants of a given Maven project by modifying the dependencies versions.
Then build a Docker image using the Dockerfile of the project (should be available at the root of the project) and tries to run it.
If the output of the docker run mutant-image is Exit 0 => Success, otherwise it's a failure.

Installation

From npm

npm i -g diversify-mvn

From source

git clone git@github.com:maxleiko/diversify-mvn.git
cd diversify-mvn
npm install
npm run build
npm link

Usage

diversify-mvn config.json

Config

export interface Config {
  appPath: string; // where to find the Java project to diversify
  versionsCount: number; // the "range" of versions to do mutations on
  engines: Dockerode.DockerOptions[]; // cf. dockerode doc

  pomPath?: string; // default: ''
  outputDir?: string; // default: '.results'
  blacklist?: string[]; // default: []
  mutantsLimit?: number; // default: nbGroups^(versionsCount+1)
  containerOptions?: Dockerode.ContainerCreateOptions; // default: {}
  taskTimeout?: number; // default: 1500
  overwriteContainer?: boolean; // default: false
}

Dockerode.DockerOptions and Dockerode.ContainerCreateOptions come from dockerode

Example:

{
  "appPath": "java-websocket",
  "versionsCount": 2,
  "engines": [
    { "socketPath": "/var/run/docker.sock" },
    { "host": "10.0.0.1", "port": 2375 },
    { "host": "10.0.0.2", "port": 2375 },
    { "host": "10.0.0.3", "port": 2375 }
  ]
}

Blacklist dependencies

Sometimes you do not want some dependencies to be diversified, for that we've introduced "blacklist".
Blacklist is an array of strings:

{
  "blacklist": [
    "groupId:artifactId",
    "allThatGroupId"
  ]
}

In this example, the dependency groupId:artifactId will not be changed by the program, and all the dependencies that have allThatGroupId as groupId will also not be changed.

Debug

DEBUG=diversify-mvn:* diversify-mvn config.json

Operating System diversification with Polyverse.io

If you want to go further into the diversification of your mutants, you can add Polyverse.io to your Docker images. This will replace all the currently installed packages (only Ubuntu, CentOS and Alpine supported) with diversified ones.

To add this layer of diversification, add those lines to your Dockerfile:

Ubuntu

...
RUN curl https://repo.polyverse.io/install.sh | sh -s czcw7pjshny8lzzog8bgiizfr
RUN apt-get update && apt-get -y --allow-change-held-packages install --reinstall $(dpkg --get-selections | awk '{print $1}')
...

Alpine

...
RUN curl https://repo.polyverse.io/install.sh | sh -s czcw7pjshny8lzzog8bgiizfr
RUN sed -n -i '/repo.polyverse.io/p' /etc/apk/repositories && apk upgrade --update-cache --available
...

CentOS

...
RUN curl https://repo.polyverse.io/install.sh | sh -s czcw7pjshny8lzzog8bgiizfr
RUN yum reinstall -y \*
...

FAQs

Package last updated on 25 Apr 2018

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc