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

inspecjs

Package Overview
Dependencies
Maintainers
1
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

inspecjs - npm Package Compare versions

Comparing version 0.2.3 to 0.3.0

2

dist/fileparse.js

@@ -34,6 +34,4 @@ "use strict";

}
// 1.*
// ...
throw "Unable to convert inspec json output. Please verify it's from an up-to-date version of the program!";
}
exports.convertFile = convertFile;

52

dist/nist.d.ts

@@ -8,6 +8,12 @@ /**

*/
import { ControlStatus, HDFControl } from "./compat-wrappers";
import { ControlStatus } from "./compat-wrappers";
export declare type NistFamilyDescription = [string, string, number];
/** All a control in a nist hash really needs is a status */
interface NistControlRequirements {
fixed_nist_tags: string[];
status: ControlStatus;
}
export declare type ControlGroupStatus = ControlStatus | "Empty";
export declare type NistCategory = {
/** Holds all of the data related to a NIST vuln category, nested in a family. EX: RA-4, PM-12, etc. */
export declare type NistCategory<T extends NistControlRequirements> = {
name: string;

@@ -17,5 +23,6 @@ count: number;

status: ControlGroupStatus;
children: HDFControl[];
children: T[];
};
export declare type NistFamily = {
/** Holds all of the data related to a NIST vuln vamily, EX: SC, SI, etc. */
export declare type NistFamily<T extends NistControlRequirements> = {
name: string;

@@ -25,19 +32,38 @@ desc: string;

status: ControlGroupStatus;
children: NistCategory[];
children: NistCategory<T>[];
};
export declare type NistHash = {
/** Top level structure in a NIST hash. Holds many families */
export declare type NistHash<T extends NistControlRequirements> = {
name: string;
children: NistFamily[];
children: NistFamily<T>[];
count: number;
status: ControlGroupStatus;
};
export declare type ControlHashItem = HDFControl[];
export declare type ControlNistHash = {
[index: string]: ControlHashItem;
export declare type ControlNistHash<T extends NistControlRequirements> = {
[index: string]: T[];
};
export declare function generateNewNistHash(): NistHash;
export declare function generateNewControlHash(): ControlNistHash;
export declare function generateNewNistHash<T extends NistControlRequirements>(): NistHash<T>;
export declare function generateNewControlHash<T extends NistControlRequirements>(): ControlNistHash<T>;
/**
* Adds the given controls to the nist hash
*/
export declare function populateNistHash(controls: HDFControl[], hash: NistHash): void;
export declare function populateNistHash<T extends NistControlRequirements>(controls: T[], hash: NistHash<T>): void;
/**
* Computes the groups status having added control.
* There's a natural precedence to statuses, at least in a list/group
* For instance, we would not mark a group as Passed if it contained a Failed.
* Clearly "Empty" is the lowest precedence, as adding any control would wipe it out.
* Following we have "From Profile" since it is in some way the absence of status, but also lacks run context.
* Next, "Not Applicable" since it means that though we ran we don't care about the result
* "Not Reviewed" implies that had the test run it would've mattered, but it was skipped deliberately
* "No Data" is similarly a lack of result, but in this case unexpected, and thus worthy of more scrutiny
* "Passed" means that a test passed! But "Failed" should override, since fails are really what we're looking for
* Finally, "Profile Errors" mean something is broken and needs to be fixed, and thus overrides all
*
* Returns:
* < 0 if a < b (by the above criteria)
* 0 if a === b
* > 0 if a > b
*/
export declare function compare_statuses(a: ControlGroupStatus, b: ControlGroupStatus): number;
export {};

@@ -122,13 +122,26 @@ "use strict";

* Computes the groups status having added control.
* There's a natural precedence to statuses.
* For instance, we would not mark a group as Passed if we added a Failed.
* There's a natural precedence to statuses, at least in a list/group
* For instance, we would not mark a group as Passed if it contained a Failed.
* Clearly "Empty" is the lowest precedence, as adding any control would wipe it out.
* Following those we have "Not run" and then "No data", which are effectively just no status.
* Next, we would have
* Following we have "From Profile" since it is in some way the absence of status, but also lacks run context.
* Next, "Not Applicable" since it means that though we ran we don't care about the result
* "Not Reviewed" implies that had the test run it would've mattered, but it was skipped deliberately
* "No Data" is similarly a lack of result, but in this case unexpected, and thus worthy of more scrutiny
* "Passed" means that a test passed! But "Failed" should override, since fails are really what we're looking for
* Finally, "Profile Errors" mean something is broken and needs to be fixed, and thus overrides all
*
* Returns:
* < 0 if a < b (by the above criteria)
* 0 if a === b
* > 0 if a > b
*/
function compare_statuses(a, b) {
var precedence = ["Empty", "From Profile", "No Data", "Not Applicable", "Not Reviewed", "Passed", "Failed", "Profile Error"];
var a_i = precedence.indexOf(a);
var b_i = precedence.indexOf(b);
return a_i - b_i;
}
exports.compare_statuses = compare_statuses;
function updateStatus(group, control) {
var precedence = ["Empty", "From Profile", "No Data", "Not Applicable", "Not Reviewed", "Passed", "Failed", "Profile Error"];
var i1 = precedence.indexOf(group);
var i2 = precedence.indexOf(control);
if (i2 > i1) {
if (compare_statuses(group, control) > 0) {
// Our new control has shifted the status!

@@ -135,0 +148,0 @@ return control;

{
"name": "inspecjs",
"version": "0.2.3",
"version": "0.3.0",
"description": "© 2018 The MITRE Corporation.",

@@ -5,0 +5,0 @@ "files": [

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