@nodesecure/rc 1.4.0 → 1.5.0

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.
@@ -1,33 +1,33 @@
1
- export function generateReportConfiguration() {
2
- const report = {
3
- theme: "light",
4
- includeTransitiveInternal: false,
5
- reporters: ["html", "pdf"],
6
- charts: [
7
- {
8
- name: "Extensions",
9
- display: true,
10
- interpolation: "d3.interpolateRainbow"
11
- },
12
- {
13
- name: "Licenses",
14
- display: true,
15
- interpolation: "d3.interpolateCool"
16
- },
17
- {
18
- name: "Warnings",
19
- display: true,
20
- type: "horizontalBar",
21
- interpolation: "d3.interpolateInferno"
22
- },
23
- {
24
- name: "Flags",
25
- display: true,
26
- type: "horizontalBar",
27
- interpolation: "d3.interpolateSinebow"
28
- }
29
- ]
30
- };
31
- return { report };
32
- }
1
+ export function generateReportConfiguration() {
2
+ const report = {
3
+ theme: "light",
4
+ includeTransitiveInternal: false,
5
+ reporters: ["html", "pdf"],
6
+ charts: [
7
+ {
8
+ name: "Extensions",
9
+ display: true,
10
+ interpolation: "d3.interpolateRainbow"
11
+ },
12
+ {
13
+ name: "Licenses",
14
+ display: true,
15
+ interpolation: "d3.interpolateCool"
16
+ },
17
+ {
18
+ name: "Warnings",
19
+ display: true,
20
+ type: "horizontalBar",
21
+ interpolation: "d3.interpolateInferno"
22
+ },
23
+ {
24
+ name: "Flags",
25
+ display: true,
26
+ type: "horizontalBar",
27
+ interpolation: "d3.interpolateSinebow"
28
+ }
29
+ ]
30
+ };
31
+ return { report };
32
+ }
33
33
  //# sourceMappingURL=report.js.map
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Configuration dedicated for NodeSecure scanner
3
+ * @see https://github.com/NodeSecure/scanner
4
+ */
5
+ export interface ScannerConfiguration {
6
+ /**
7
+ * List of NPM users/authors flagged
8
+ * @see https://github.com/NodeSecure/authors
9
+ */
10
+ flaggedAuthors: Author[];
11
+ }
12
+ export type Author = {
13
+ name: string;
14
+ email: string;
15
+ };
16
+ export declare function generateScannerConfiguration(): {
17
+ scanner: ScannerConfiguration;
18
+ };
@@ -0,0 +1,7 @@
1
+ export function generateScannerConfiguration() {
2
+ const scanner = {
3
+ flaggedAuthors: []
4
+ };
5
+ return { scanner };
6
+ }
7
+ //# sourceMappingURL=scanner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scanner.js","sourceRoot":"","sources":["../../src/projects/scanner.ts"],"names":[],"mappings":"AAgBA,MAAM,UAAU,4BAA4B;IAC1C,MAAM,OAAO,GAAyB;QACpC,cAAc,EAAE,EAAE;KACnB,CAAC;IAEF,OAAO,EAAE,OAAO,EAAE,CAAC;AACrB,CAAC"}
package/dist/rc.d.ts CHANGED
@@ -1,40 +1,43 @@
1
- import i18n from "@nodesecure/i18n";
2
- import * as vuln from "@nodesecure/vuln";
3
- import { generateCIConfiguration, CiConfiguration, CiWarnings } from "./projects/ci.js";
4
- import { generateReportConfiguration, ReportConfiguration, ReportChart } from "./projects/report.js";
5
- export declare const JSONSchema: any;
6
- export interface RC {
7
- /** version of the rc package used to generate the nodesecurerc file */
8
- version: string;
9
- /**
10
- * Language to use for i18n (translation in NodeSecure tools).
11
- * @see https://developer.mozilla.org/en-US/docs/Glossary/I18N
12
- * @see https://github.com/NodeSecure/i18n
13
- *
14
- * @default `english`
15
- */
16
- i18n?: i18n.languages;
17
- /**
18
- * Vulnerability strategy to use. Can be disabled by using `none` as value.
19
- * @see https://github.com/NodeSecure/vuln#available-strategy
20
- *
21
- * @default `npm`
22
- */
23
- strategy?: vuln.Strategy.Kind;
24
- /** NodeSecure ci Object configuration */
25
- ci?: CiConfiguration;
26
- /** NodeSecure report Object configuration */
27
- report?: ReportConfiguration;
28
- }
29
- export type RCGenerationMode = "minimal" | "ci" | "report" | "complete";
30
- /**
31
- * @example
32
- * generateDefaultRC("complete");
33
- * generateDefaultRC(["ci", "report"]); // minimal + ci + report
34
- */
35
- export declare function generateDefaultRC(mode?: RCGenerationMode | RCGenerationMode[]): RC;
36
- /**
37
- * Dedicated directory for NodeSecure to store the configuration in the os HOME directory.
38
- */
39
- export declare function homedir(): string;
40
- export { generateCIConfiguration, CiConfiguration, CiWarnings, generateReportConfiguration, ReportConfiguration, ReportChart };
1
+ import i18n from "@nodesecure/i18n";
2
+ import * as vuln from "@nodesecure/vuln";
3
+ import { generateCIConfiguration, CiConfiguration, CiWarnings } from "./projects/ci.js";
4
+ import { generateReportConfiguration, ReportConfiguration, ReportChart } from "./projects/report.js";
5
+ import { generateScannerConfiguration, ScannerConfiguration, Author } from "./projects/scanner.js";
6
+ export declare const JSONSchema: any;
7
+ export interface RC {
8
+ /** version of the rc package used to generate the nodesecurerc file */
9
+ version: string;
10
+ /**
11
+ * Language to use for i18n (translation in NodeSecure tools).
12
+ * @see https://developer.mozilla.org/en-US/docs/Glossary/I18N
13
+ * @see https://github.com/NodeSecure/i18n
14
+ *
15
+ * @default `english`
16
+ */
17
+ i18n?: i18n.languages;
18
+ /**
19
+ * Vulnerability strategy to use. Can be disabled by using `none` as value.
20
+ * @see https://github.com/NodeSecure/vuln#available-strategy
21
+ *
22
+ * @default `npm`
23
+ */
24
+ strategy?: vuln.Strategy.Kind;
25
+ /** NodeSecure scanner Object configuration */
26
+ scanner?: ScannerConfiguration;
27
+ /** NodeSecure ci Object configuration */
28
+ ci?: CiConfiguration;
29
+ /** NodeSecure report Object configuration */
30
+ report?: ReportConfiguration;
31
+ }
32
+ export type RCGenerationMode = "minimal" | "ci" | "report" | "scanner" | "complete";
33
+ /**
34
+ * @example
35
+ * generateDefaultRC("complete");
36
+ * generateDefaultRC(["ci", "report"]); // minimal + ci + report
37
+ */
38
+ export declare function generateDefaultRC(mode?: RCGenerationMode | RCGenerationMode[]): RC;
39
+ /**
40
+ * Dedicated directory for NodeSecure to store the configuration in the os HOME directory.
41
+ */
42
+ export declare function homedir(): string;
43
+ export { generateCIConfiguration, CiConfiguration, CiWarnings, generateReportConfiguration, ReportConfiguration, ReportChart, generateScannerConfiguration, ScannerConfiguration, Author };
package/dist/rc.js CHANGED
@@ -1,33 +1,34 @@
1
- // Import Node.js Dependencies
2
- import os from "node:os";
3
- import path from "node:path";
4
- // Import Internal Dependencies
5
- import { GLOBAL_CONFIGURATION_DIRECTORY } from "./constants.js";
6
- import { loadJSONSchemaSync } from "./schema/loader.js";
7
- import { generateCIConfiguration } from "./projects/ci.js";
8
- import { generateReportConfiguration } from "./projects/report.js";
9
- // CONSTANTS
10
- export const JSONSchema = loadJSONSchemaSync();
11
- /**
12
- * @example
13
- * generateDefaultRC("complete");
14
- * generateDefaultRC(["ci", "report"]); // minimal + ci + report
15
- */
16
- export function generateDefaultRC(mode = "minimal") {
17
- const modes = new Set(typeof mode === "string" ? [mode] : mode);
18
- const minimalRC = {
19
- version: "1.0.0",
20
- i18n: "english",
21
- strategy: "npm"
22
- };
23
- const complete = modes.has("complete");
24
- return Object.assign(minimalRC, complete || modes.has("ci") ? generateCIConfiguration() : {}, complete || modes.has("report") ? generateReportConfiguration() : {});
25
- }
26
- /**
27
- * Dedicated directory for NodeSecure to store the configuration in the os HOME directory.
28
- */
29
- export function homedir() {
30
- return path.join(os.homedir(), GLOBAL_CONFIGURATION_DIRECTORY);
31
- }
32
- export { generateCIConfiguration, generateReportConfiguration };
1
+ // Import Node.js Dependencies
2
+ import os from "node:os";
3
+ import path from "node:path";
4
+ // Import Internal Dependencies
5
+ import { GLOBAL_CONFIGURATION_DIRECTORY } from "./constants.js";
6
+ import { loadJSONSchemaSync } from "./schema/loader.js";
7
+ import { generateCIConfiguration } from "./projects/ci.js";
8
+ import { generateReportConfiguration } from "./projects/report.js";
9
+ import { generateScannerConfiguration } from "./projects/scanner.js";
10
+ // CONSTANTS
11
+ export const JSONSchema = loadJSONSchemaSync();
12
+ /**
13
+ * @example
14
+ * generateDefaultRC("complete");
15
+ * generateDefaultRC(["ci", "report"]); // minimal + ci + report
16
+ */
17
+ export function generateDefaultRC(mode = "minimal") {
18
+ const modes = new Set(typeof mode === "string" ? [mode] : mode);
19
+ const minimalRC = {
20
+ version: "1.0.0",
21
+ i18n: "english",
22
+ strategy: "npm"
23
+ };
24
+ const complete = modes.has("complete");
25
+ return Object.assign(minimalRC, complete || modes.has("ci") ? generateCIConfiguration() : {}, complete || modes.has("report") ? generateReportConfiguration() : {}, complete || modes.has("scanner") ? generateScannerConfiguration() : {});
26
+ }
27
+ /**
28
+ * Dedicated directory for NodeSecure to store the configuration in the os HOME directory.
29
+ */
30
+ export function homedir() {
31
+ return path.join(os.homedir(), GLOBAL_CONFIGURATION_DIRECTORY);
32
+ }
33
+ export { generateCIConfiguration, generateReportConfiguration, generateScannerConfiguration };
33
34
  //# sourceMappingURL=rc.js.map
package/dist/rc.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"rc.js","sourceRoot":"","sources":["../src/rc.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAM7B,+BAA+B;AAC/B,OAAO,EAAE,8BAA8B,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAA+B,MAAM,kBAAkB,CAAC;AACxF,OAAO,EAAE,2BAA2B,EAAoC,MAAM,sBAAsB,CAAC;AAErG,YAAY;AACZ,MAAM,CAAC,MAAM,UAAU,GAAG,kBAAkB,EAAE,CAAC;AA4B/C;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAA8C,SAAS;IACvF,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAEhE,MAAM,SAAS,GAAG;QAChB,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE,SAAkB;QACxB,QAAQ,EAAE,KAAc;KACzB,CAAC;IAC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AC,IAAI,CAAC,CAAC;IAEhE,MAAM,SAAS,GAAG;QAChB,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE,SAAkB;QACxB,QAAQ,EAAE,KAAc;KACzB,CAAC;IACF,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAEvC,OAAO,MAAM,CAAC,MAAM,CAClB,SAAS,EACT,QAAQ,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,uBAAuB,EAAE,CAAC,CAAC,CAAC,EAAE,EAC5D,QAAQ,IAAI,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,2BAA2B,EAAE,CAAC,CAAC,CAAC,EAAE,EACpE,QAAQ,IAAI,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,4BAA4B,EAAE,CAAC,CAAC,CAAC,EAAE,CACvE,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,OAAO;IACrB,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,8BAA8B,CAAC,CAAC;AACjE,CAAC;AAED,OAAO,EACL,uBAAuB,EAIvB,2BAA2B,EAI3B,4BAA4B,EAG7B,CAAC"}
@@ -0,0 +1,13 @@
1
+ {
2
+ "type": "object",
3
+ "properties": {
4
+ "name": {
5
+ "type": "string"
6
+ },
7
+ "email": {
8
+ "type": "string"
9
+ }
10
+ },
11
+ "required": ["name", "email"],
12
+ "additionalProperties": false
13
+ }
@@ -1,58 +1,58 @@
1
- {
2
- "type": "object",
3
- "properties": {
4
- "reporters": {
5
- "type": "array",
6
- "uniqueItems": true,
7
- "items": {
8
- "type": "string",
9
- "enum": [
10
- "html",
11
- "console"
12
- ]
13
- },
14
- "default": [
15
- "console"
16
- ]
17
- },
18
- "vulnerabilities": {
19
- "type": "object",
20
- "properties": {
21
- "severity": {
22
- "type": "string",
23
- "enum": [
24
- "medium",
25
- "high",
26
- "critical",
27
- "all"
28
- ],
29
- "default": "all"
30
- }
31
- },
32
- "additionalProperties": false
33
- },
34
- "warnings": {
35
- "default": "off",
36
- "description": "JS-X-Ray warnings configuration",
37
- "oneOf": [
38
- {
39
- "$ref": "#/$defs/ciWarnings"
40
- },
41
- {
42
- "type": "object",
43
- "minProperties": 1,
44
- "patternProperties": {
45
- "^[A-Za-z-]+$": {
46
- "$ref": "#/$defs/ciWarnings"
47
- }
48
- }
49
- }
50
- ]
51
- }
52
- },
53
- "required": [
54
- "reporters",
55
- "warnings"
56
- ],
57
- "additionalProperties": false
58
- }
1
+ {
2
+ "type": "object",
3
+ "properties": {
4
+ "reporters": {
5
+ "type": "array",
6
+ "uniqueItems": true,
7
+ "items": {
8
+ "type": "string",
9
+ "enum": [
10
+ "html",
11
+ "console"
12
+ ]
13
+ },
14
+ "default": [
15
+ "console"
16
+ ]
17
+ },
18
+ "vulnerabilities": {
19
+ "type": "object",
20
+ "properties": {
21
+ "severity": {
22
+ "type": "string",
23
+ "enum": [
24
+ "medium",
25
+ "high",
26
+ "critical",
27
+ "all"
28
+ ],
29
+ "default": "all"
30
+ }
31
+ },
32
+ "additionalProperties": false
33
+ },
34
+ "warnings": {
35
+ "default": "off",
36
+ "description": "JS-X-Ray warnings configuration",
37
+ "oneOf": [
38
+ {
39
+ "$ref": "#/$defs/ciWarnings"
40
+ },
41
+ {
42
+ "type": "object",
43
+ "minProperties": 1,
44
+ "patternProperties": {
45
+ "^[A-Za-z-]+$": {
46
+ "$ref": "#/$defs/ciWarnings"
47
+ }
48
+ }
49
+ }
50
+ ]
51
+ }
52
+ },
53
+ "required": [
54
+ "reporters",
55
+ "warnings"
56
+ ],
57
+ "additionalProperties": false
58
+ }
@@ -1,8 +1,8 @@
1
- {
2
- "type": "string",
3
- "enum": [
4
- "off",
5
- "error",
6
- "warning"
7
- ]
8
- }
1
+ {
2
+ "type": "string",
3
+ "enum": [
4
+ "off",
5
+ "error",
6
+ "warning"
7
+ ]
8
+ }
@@ -1,98 +1,98 @@
1
- {
2
- "title": "Report configuration",
3
- "type": "object",
4
- "additionalProperties": false,
5
- "required": [
6
- "title",
7
- "logoUrl"
8
- ],
9
- "properties": {
10
- "theme": {
11
- "type": "string",
12
- "enum": [
13
- "light",
14
- "dark"
15
- ],
16
- "default": "light"
17
- },
18
- "title": {
19
- "type": "string",
20
- "description": "Report title",
21
- "default": "Default report title"
22
- },
23
- "logoUrl": {
24
- "type": "string",
25
- "description": "Logo",
26
- "default": "https://avatars0.githubusercontent.com/u/29552883?s=200&v=4"
27
- },
28
- "includeTransitiveInternal": {
29
- "type": "boolean",
30
- "default": false,
31
- "description": "Show/categorize internal dependencies as transitive"
32
- },
33
- "npm": {
34
- "type": "object",
35
- "additionalProperties": false,
36
- "required": [
37
- "organizationPrefix",
38
- "packages"
39
- ],
40
- "properties": {
41
- "organizationPrefix": {
42
- "type": "string",
43
- "description": "NPM organization prefix starting with @"
44
- },
45
- "packages": {
46
- "type": "array",
47
- "items": {
48
- "type": "string"
49
- },
50
- "uniqueItems": true
51
- }
52
- }
53
- },
54
- "git": {
55
- "type": "object",
56
- "additionalProperties": false,
57
- "required": [
58
- "organizationUrl",
59
- "repositories"
60
- ],
61
- "properties": {
62
- "organizationUrl": {
63
- "type": "string",
64
- "description": "GitHub organization URL"
65
- },
66
- "repositories": {
67
- "type": "array",
68
- "description": "List of repositories (name are enough, no need to provide .git url or any equivalent)",
69
- "items": {
70
- "type": "string"
71
- },
72
- "uniqueItems": true
73
- }
74
- }
75
- },
76
- "reporters": {
77
- "type": "array",
78
- "uniqueItems": true,
79
- "items": {
80
- "type": "string",
81
- "enum": [
82
- "html",
83
- "pdf"
84
- ]
85
- },
86
- "default": [
87
- "html",
88
- "pdf"
89
- ]
90
- },
91
- "charts": {
92
- "type": "array",
93
- "items": {
94
- "$ref": "#/$defs/reportChart"
95
- }
96
- }
97
- }
98
- }
1
+ {
2
+ "title": "Report configuration",
3
+ "type": "object",
4
+ "additionalProperties": false,
5
+ "required": [
6
+ "title",
7
+ "logoUrl"
8
+ ],
9
+ "properties": {
10
+ "theme": {
11
+ "type": "string",
12
+ "enum": [
13
+ "light",
14
+ "dark"
15
+ ],
16
+ "default": "light"
17
+ },
18
+ "title": {
19
+ "type": "string",
20
+ "description": "Report title",
21
+ "default": "Default report title"
22
+ },
23
+ "logoUrl": {
24
+ "type": "string",
25
+ "description": "Logo",
26
+ "default": "https://avatars0.githubusercontent.com/u/29552883?s=200&v=4"
27
+ },
28
+ "includeTransitiveInternal": {
29
+ "type": "boolean",
30
+ "default": false,
31
+ "description": "Show/categorize internal dependencies as transitive"
32
+ },
33
+ "npm": {
34
+ "type": "object",
35
+ "additionalProperties": false,
36
+ "required": [
37
+ "organizationPrefix",
38
+ "packages"
39
+ ],
40
+ "properties": {
41
+ "organizationPrefix": {
42
+ "type": "string",
43
+ "description": "NPM organization prefix starting with @"
44
+ },
45
+ "packages": {
46
+ "type": "array",
47
+ "items": {
48
+ "type": "string"
49
+ },
50
+ "uniqueItems": true
51
+ }
52
+ }
53
+ },
54
+ "git": {
55
+ "type": "object",
56
+ "additionalProperties": false,
57
+ "required": [
58
+ "organizationUrl",
59
+ "repositories"
60
+ ],
61
+ "properties": {
62
+ "organizationUrl": {
63
+ "type": "string",
64
+ "description": "GitHub organization URL"
65
+ },
66
+ "repositories": {
67
+ "type": "array",
68
+ "description": "List of repositories (name are enough, no need to provide .git url or any equivalent)",
69
+ "items": {
70
+ "type": "string"
71
+ },
72
+ "uniqueItems": true
73
+ }
74
+ }
75
+ },
76
+ "reporters": {
77
+ "type": "array",
78
+ "uniqueItems": true,
79
+ "items": {
80
+ "type": "string",
81
+ "enum": [
82
+ "html",
83
+ "pdf"
84
+ ]
85
+ },
86
+ "default": [
87
+ "html",
88
+ "pdf"
89
+ ]
90
+ },
91
+ "charts": {
92
+ "type": "array",
93
+ "items": {
94
+ "$ref": "#/$defs/reportChart"
95
+ }
96
+ }
97
+ }
98
+ }