@mitre/inspec-objects 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/mappings/CciNistMappingData.d.ts +5100 -0
- package/lib/mappings/CciNistMappingData.js +5103 -0
- package/lib/parsers/xccdf.d.ts +1 -1
- package/lib/parsers/xccdf.js +48 -15
- package/lib/utilities/CciNistMappingData.d.ts +5100 -0
- package/lib/utilities/CciNistMappingData.js +5103 -0
- package/lib/utilities/diff.d.ts +1 -2
- package/lib/utilities/diff.js +17 -4
- package/lib/utilities/xccdf.d.ts +1 -0
- package/lib/utilities/xccdf.js +5 -1
- package/mitre-inspec-objects-v0.0.1.tgz +0 -0
- package/mitre-inspec-objects-v0.0.3.tgz +0 -0
- package/package-lock.json +38 -3415
- package/package.json +4 -4
- package/src/mappings/CciNistMappingData.ts +5100 -0
- package/src/parsers/xccdf.ts +45 -15
- package/src/utilities/diff.ts +14 -3
- package/src/utilities/xccdf.ts +4 -0
- package/tsconfig.json +1 -1
- package/error.log +0 -12
- package/types/ionchannelAnalysis.d.ts +0 -238
- package/types/ionchannelProjects.d.ts +0 -72
- package/types/ionchannelTeams.d.ts +0 -26
- package/types/reverseMappedXCCDF.d.ts +0 -67
- package/types/splunk-sdk-no-env/index.d.ts +0 -88
package/lib/utilities/diff.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import Profile from '../objects/profile';
|
|
2
2
|
import { ProfileDiff } from '../types/diff';
|
|
3
|
-
|
|
4
|
-
export declare function updateControl(originalControlString: string, originalControl: Control, updatedControl: Control): void;
|
|
3
|
+
export declare function removeNewlines(control?: Record<string, unknown>): Record<string, unknown>;
|
|
5
4
|
export declare function diffProfile(fromProfile: Profile, toProfile: Profile): ProfileDiff;
|
package/lib/utilities/diff.js
CHANGED
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.diffProfile = exports.
|
|
3
|
+
exports.diffProfile = exports.removeNewlines = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const json_diff_1 = require("json-diff");
|
|
6
6
|
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
7
|
-
function
|
|
8
|
-
|
|
7
|
+
function removeNewlines(control) {
|
|
8
|
+
if (!control) {
|
|
9
|
+
return {};
|
|
10
|
+
}
|
|
11
|
+
return lodash_1.default.mapValues(control, (value) => {
|
|
12
|
+
if (typeof value === 'string') {
|
|
13
|
+
return value.replace(/\n/g, '{{{{newlineHERE}}}}').trim();
|
|
14
|
+
}
|
|
15
|
+
else if (typeof value === 'object' && value !== null) {
|
|
16
|
+
return removeNewlines(value);
|
|
17
|
+
}
|
|
18
|
+
return value;
|
|
19
|
+
});
|
|
9
20
|
}
|
|
10
|
-
exports.
|
|
21
|
+
exports.removeNewlines = removeNewlines;
|
|
11
22
|
function diffProfile(fromProfile, toProfile) {
|
|
12
23
|
const profileDiff = {
|
|
13
24
|
addedControlIDs: [],
|
|
@@ -38,8 +49,10 @@ function diffProfile(fromProfile, toProfile) {
|
|
|
38
49
|
const toControl = toProfile.controls.find((control) => control.id === fromControl.id);
|
|
39
50
|
if (toControl) {
|
|
40
51
|
const controlDiff = (0, json_diff_1.diff)(fromControl, toControl);
|
|
52
|
+
console.log(controlDiff);
|
|
41
53
|
if (controlDiff) {
|
|
42
54
|
Object.entries(controlDiff).forEach(([key, value]) => {
|
|
55
|
+
console.log(value);
|
|
43
56
|
if (lodash_1.default.has(value, '__new')) {
|
|
44
57
|
lodash_1.default.set(profileDiff, 'changedControls.' + fromControl.id + '.' + key.replace('.', '\\.'), lodash_1.default.get(controlDiff, key + '.__new'));
|
|
45
58
|
}
|
package/lib/utilities/xccdf.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DecodedDescription } from '../types/xccdf';
|
|
2
2
|
export declare function convertEncodedXmlIntoJson(encodedXml: string): any;
|
|
3
|
+
export declare function removeXMLSpecialCharacters(input: string): string;
|
|
3
4
|
export declare function severityStringToImpact(string: string, id: string): number;
|
|
4
5
|
export declare function impactNumberToSeverityString(impact: number): string;
|
|
5
6
|
export declare function convertEncodedHTMLIntoJson(encodedHTML?: string): DecodedDescription;
|
package/lib/utilities/xccdf.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.convertEncodedHTMLIntoJson = exports.impactNumberToSeverityString = exports.severityStringToImpact = exports.convertEncodedXmlIntoJson = void 0;
|
|
3
|
+
exports.convertEncodedHTMLIntoJson = exports.impactNumberToSeverityString = exports.severityStringToImpact = exports.removeXMLSpecialCharacters = exports.convertEncodedXmlIntoJson = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const fast_xml_parser_1 = tslib_1.__importDefault(require("fast-xml-parser"));
|
|
6
6
|
const htmlparser = tslib_1.__importStar(require("htmlparser2"));
|
|
@@ -14,6 +14,10 @@ function convertEncodedXmlIntoJson(encodedXml) {
|
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
16
|
exports.convertEncodedXmlIntoJson = convertEncodedXmlIntoJson;
|
|
17
|
+
function removeXMLSpecialCharacters(input) {
|
|
18
|
+
return input.replace(/&/gm, '&').replace(/</gm, '<').replace(/>/gm, '>');
|
|
19
|
+
}
|
|
20
|
+
exports.removeXMLSpecialCharacters = removeXMLSpecialCharacters;
|
|
17
21
|
function severityStringToImpact(string, id) {
|
|
18
22
|
var _a, _b, _c, _d, _e;
|
|
19
23
|
if ((_a = string.match(/none|na|n\/a|not[\s()*_|]?applicable/i)) === null || _a === void 0 ? void 0 : _a.length) {
|
|
Binary file
|
|
Binary file
|