Latest Threat ResearchGlassWorm Loader Hits Open VSX via Developer Account Compromise.Details
Socket
Book a DemoInstallSign in
Socket

vimagination.zapto.org/justification

Package Overview
Dependencies
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vimagination.zapto.org/justification

Go Modules
Version
v1.0.0
Version published
Created
Source

$$\textcolor{red}{\text{J}}\textcolor{blue}{\text{u}}\textcolor{red}{\text{s}}\textcolor{blue}{\text{tificati}}\textcolor{red}{\text{on}}$$

Justification is a proof-of-concept REST-based JSON validator.

The REST server contains two endpoints as follows:

EndpointDescription
POST /schema/$SCHEMAIDUsed to upload valid JSON schemas to the server.
GET /schema/$SCHEMAIDUsed to retrieve stores JSON schemas from the server.
POST /validate/$SCHEMAIDUsed to validate JSON against a store schema.
Null objects entries will be stripped out of the JSON before validation.

$SCHEMAID can be any combination of alphanumerical characters as well as underscore '_' (ascii 95/0x5f) and hypen '-' (ascii 45/0x2d).

Installation

The following command can be used to install this program:

go install vimagination.zapto.org/justification@v1.0.0

This will download and compile a justification binary into either your $GOPATH/bin or $GOBIN directory.

Running

The following are the parameters accepted by this program:

FlagDefaultDescription
p8080The port on which the justification binary will serve.
d$config/justificationThe directory where schemas will be store and loaded from.

NB: $config refers to the output of os.UserConfigDir.

For example, to run justification on port 1234 and using a temporary directory, you could use the following:

justification -p 1234 -d /tmp/justification-tmp-dir

The server can be stopped by using Ctrl+C (SIGINT).

Tests

The examples directory contains two files, config-schema.json and config.json.

With justification running on its default port, the following command will upload the example schema to the server:

curl http://localhost:8080/schema/config-schema -X POST --data-binary @config-schema.json

...the following can be used to retrieve the saved schema:

curl http://localhost:8080/schema/config-schema

...and the following can be used to check the example JSON file against that saved schema:

curl http://localhost:8080/validate/config-schema -X POST -d @config.json

FAQs

Package last updated on 08 Nov 2022

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