timonel 2.2.0 → 2.4.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.
- package/CHANGELOG.md +16 -0
- package/README.md +5 -1
- package/SECURITY.md +15 -8
- package/dist/cli.js +29 -31
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/helm.d.ts +200 -12
- package/dist/lib/helm.d.ts.map +1 -1
- package/dist/lib/helm.js +234 -13
- package/dist/lib/helm.js.map +1 -1
- package/dist/lib/helmChartWriter.d.ts +238 -0
- package/dist/lib/helmChartWriter.d.ts.map +1 -0
- package/dist/lib/helmChartWriter.js +318 -0
- package/dist/lib/helmChartWriter.js.map +1 -0
- package/dist/lib/resources/autoscaling/autoscalingResources.d.ts +26 -0
- package/dist/lib/resources/autoscaling/autoscalingResources.d.ts.map +1 -0
- package/dist/lib/resources/autoscaling/autoscalingResources.js +35 -0
- package/dist/lib/resources/autoscaling/autoscalingResources.js.map +1 -0
- package/dist/lib/resources/baseResourceProvider.d.ts +47 -0
- package/dist/lib/resources/baseResourceProvider.d.ts.map +1 -0
- package/dist/lib/resources/baseResourceProvider.js +83 -0
- package/dist/lib/resources/baseResourceProvider.js.map +1 -0
- package/dist/lib/resources/cloud/aws/awsResources.d.ts +165 -0
- package/dist/lib/resources/cloud/aws/awsResources.d.ts.map +1 -0
- package/dist/lib/resources/cloud/aws/awsResources.js +187 -0
- package/dist/lib/resources/cloud/aws/awsResources.js.map +1 -0
- package/dist/lib/resources/cloud/azure/azureResources.d.ts +169 -0
- package/dist/lib/resources/cloud/azure/azureResources.d.ts.map +1 -0
- package/dist/lib/resources/cloud/azure/azureResources.js +218 -0
- package/dist/lib/resources/cloud/azure/azureResources.js.map +1 -0
- package/dist/lib/resources/cloud/gcp/gcpResources.d.ts +133 -0
- package/dist/lib/resources/cloud/gcp/gcpResources.d.ts.map +1 -0
- package/dist/lib/resources/cloud/gcp/gcpResources.js +162 -0
- package/dist/lib/resources/cloud/gcp/gcpResources.js.map +1 -0
- package/dist/lib/resources/core/coreResources.d.ts +584 -0
- package/dist/lib/resources/core/coreResources.d.ts.map +1 -0
- package/dist/lib/resources/core/coreResources.js +796 -0
- package/dist/lib/resources/core/coreResources.js.map +1 -0
- package/dist/lib/resources/core/storageResources.d.ts +133 -0
- package/dist/lib/resources/core/storageResources.d.ts.map +1 -0
- package/dist/lib/resources/core/storageResources.js +120 -0
- package/dist/lib/resources/core/storageResources.js.map +1 -0
- package/dist/lib/resources/validation/validationResources.d.ts +26 -0
- package/dist/lib/resources/validation/validationResources.d.ts.map +1 -0
- package/dist/lib/resources/validation/validationResources.js +33 -0
- package/dist/lib/resources/validation/validationResources.js.map +1 -0
- package/dist/lib/rutter.d.ts +554 -0
- package/dist/lib/rutter.d.ts.map +1 -0
- package/dist/lib/rutter.js +665 -0
- package/dist/lib/rutter.js.map +1 -0
- package/dist/lib/security.d.ts +73 -0
- package/dist/lib/security.d.ts.map +1 -0
- package/dist/lib/security.js +138 -0
- package/dist/lib/security.js.map +1 -0
- package/dist/lib/umbrella.d.ts +22 -2
- package/dist/lib/umbrella.d.ts.map +1 -1
- package/dist/lib/umbrella.js +21 -1
- package/dist/lib/umbrella.js.map +1 -1
- package/dist/lib/umbrellaRutter.d.ts +97 -0
- package/dist/lib/umbrellaRutter.d.ts.map +1 -0
- package/dist/lib/{UmbrellaRutter.js → umbrellaRutter.js} +72 -23
- package/dist/lib/umbrellaRutter.js.map +1 -0
- package/package.json +2 -1
- package/dist/lib/HelmChartWriter.d.ts +0 -69
- package/dist/lib/HelmChartWriter.d.ts.map +0 -1
- package/dist/lib/HelmChartWriter.js +0 -124
- package/dist/lib/HelmChartWriter.js.map +0 -1
- package/dist/lib/Rutter.d.ts +0 -1334
- package/dist/lib/Rutter.d.ts.map +0 -1
- package/dist/lib/Rutter.js +0 -2138
- package/dist/lib/Rutter.js.map +0 -1
- package/dist/lib/UmbrellaRutter.d.ts +0 -34
- package/dist/lib/UmbrellaRutter.d.ts.map +0 -1
- package/dist/lib/UmbrellaRutter.js.map +0 -1
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Security utilities for input validation and sanitization
|
|
3
|
+
* Focused on CLI tool security concerns: path traversal, injection prevention
|
|
4
|
+
* @since 2.2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Security utilities for input validation and sanitization
|
|
8
|
+
* Focused on CLI tool security concerns: path traversal, injection prevention
|
|
9
|
+
*
|
|
10
|
+
* @since 2.2.0
|
|
11
|
+
*/
|
|
12
|
+
export declare class SecurityUtils {
|
|
13
|
+
/**
|
|
14
|
+
* Validates and sanitizes file paths to prevent path traversal attacks
|
|
15
|
+
* @param inputPath - The path to validate
|
|
16
|
+
* @param allowedBasePath - The base path that the input should be within
|
|
17
|
+
* @returns Sanitized path if valid
|
|
18
|
+
* @throws Error if path is invalid or contains traversal sequences
|
|
19
|
+
*
|
|
20
|
+
* @since 2.2.0
|
|
21
|
+
*/
|
|
22
|
+
static validatePath(inputPath: string, allowedBasePath: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* Sanitizes log messages to prevent log injection attacks
|
|
25
|
+
* @param message - The message to sanitize
|
|
26
|
+
* @returns Sanitized message with control characters removed
|
|
27
|
+
*
|
|
28
|
+
* @since 2.2.0
|
|
29
|
+
*/
|
|
30
|
+
static sanitizeLogMessage(message: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Sanitizes environment names to prevent path traversal (CWE-22)
|
|
33
|
+
* @param env - Environment name to sanitize
|
|
34
|
+
* @returns Sanitized environment name
|
|
35
|
+
* @throws Error if environment name is invalid
|
|
36
|
+
*
|
|
37
|
+
* @since 2.2.0
|
|
38
|
+
*/
|
|
39
|
+
static sanitizeEnvironmentName(env: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* Validates TypeScript file extensions for dynamic imports
|
|
42
|
+
* @param filePath - The file path to validate
|
|
43
|
+
* @returns True if the file has a valid TypeScript extension
|
|
44
|
+
*
|
|
45
|
+
* @since 2.2.0
|
|
46
|
+
*/
|
|
47
|
+
static isValidTypeScriptFile(filePath: string): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Validates Helm template path syntax
|
|
50
|
+
* @param templatePath - The template path to validate
|
|
51
|
+
* @returns True if the path is valid for Helm templates
|
|
52
|
+
*
|
|
53
|
+
* @since 2.2.0
|
|
54
|
+
*/
|
|
55
|
+
static isValidHelmTemplatePath(templatePath: string): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Validates chart names according to Helm conventions
|
|
58
|
+
* @param chartName - Chart name to validate
|
|
59
|
+
* @returns True if chart name follows Helm naming rules
|
|
60
|
+
*
|
|
61
|
+
* @since 2.2.0
|
|
62
|
+
*/
|
|
63
|
+
static isValidChartName(chartName: string): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Validates subchart names according to Helm conventions
|
|
66
|
+
* @param subchartName - Subchart name to validate
|
|
67
|
+
* @returns True if subchart name is valid
|
|
68
|
+
*
|
|
69
|
+
* @since 2.2.0
|
|
70
|
+
*/
|
|
71
|
+
static isValidSubchartName(subchartName: string): boolean;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=security.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../../src/lib/security.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;;GAKG;AACH,qBAAa,aAAa;IACxB;;;;;;;;OAQG;IACH,MAAM,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM;IA2BvE;;;;;;OAMG;IACH,MAAM,CAAC,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAgBlD;;;;;;;OAOG;IACH,MAAM,CAAC,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAmBnD;;;;;;OAMG;IACH,MAAM,CAAC,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAMvD;;;;;;OAMG;IACH,MAAM,CAAC,uBAAuB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO;IAU7D;;;;;;OAMG;IACH,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAWnD;;;;;;OAMG;IACH,MAAM,CAAC,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO;CAG1D"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Security utilities for input validation and sanitization
|
|
3
|
+
* Focused on CLI tool security concerns: path traversal, injection prevention
|
|
4
|
+
* @since 2.2.0
|
|
5
|
+
*/
|
|
6
|
+
import * as path from 'path';
|
|
7
|
+
/**
|
|
8
|
+
* Security utilities for input validation and sanitization
|
|
9
|
+
* Focused on CLI tool security concerns: path traversal, injection prevention
|
|
10
|
+
*
|
|
11
|
+
* @since 2.2.0
|
|
12
|
+
*/
|
|
13
|
+
export class SecurityUtils {
|
|
14
|
+
/**
|
|
15
|
+
* Validates and sanitizes file paths to prevent path traversal attacks
|
|
16
|
+
* @param inputPath - The path to validate
|
|
17
|
+
* @param allowedBasePath - The base path that the input should be within
|
|
18
|
+
* @returns Sanitized path if valid
|
|
19
|
+
* @throws Error if path is invalid or contains traversal sequences
|
|
20
|
+
*
|
|
21
|
+
* @since 2.2.0
|
|
22
|
+
*/
|
|
23
|
+
static validatePath(inputPath, allowedBasePath) {
|
|
24
|
+
if (!inputPath || typeof inputPath !== 'string') {
|
|
25
|
+
throw new Error('Invalid path: path must be a non-empty string');
|
|
26
|
+
}
|
|
27
|
+
// Check for path traversal sequences
|
|
28
|
+
if (inputPath.includes('../') ||
|
|
29
|
+
inputPath.includes('..\\') ||
|
|
30
|
+
inputPath.includes('%2e%2e%2f') ||
|
|
31
|
+
inputPath.includes('%2e%2e%5c')) {
|
|
32
|
+
throw new Error('Invalid path: path traversal sequences detected');
|
|
33
|
+
}
|
|
34
|
+
// Resolve and normalize paths
|
|
35
|
+
const resolvedInput = path.resolve(inputPath);
|
|
36
|
+
const resolvedBase = path.resolve(allowedBasePath);
|
|
37
|
+
// Ensure the resolved path is within the allowed base path
|
|
38
|
+
if (!resolvedInput.startsWith(resolvedBase + path.sep) && resolvedInput !== resolvedBase) {
|
|
39
|
+
throw new Error(`Invalid path: path must be within ${resolvedBase}`);
|
|
40
|
+
}
|
|
41
|
+
return resolvedInput;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Sanitizes log messages to prevent log injection attacks
|
|
45
|
+
* @param message - The message to sanitize
|
|
46
|
+
* @returns Sanitized message with control characters removed
|
|
47
|
+
*
|
|
48
|
+
* @since 2.2.0
|
|
49
|
+
*/
|
|
50
|
+
static sanitizeLogMessage(message) {
|
|
51
|
+
if (typeof message !== 'string') {
|
|
52
|
+
return String(message);
|
|
53
|
+
}
|
|
54
|
+
// Remove control characters (ASCII 0-31 and 127) and normalize line endings
|
|
55
|
+
return (message
|
|
56
|
+
// eslint-disable-next-line no-control-regex -- Intentionally removing control characters for security
|
|
57
|
+
.replace(/[\x00-\x1F\x7F]/g, '') // Remove control characters
|
|
58
|
+
.replace(/\r\n/g, ' ') // Replace CRLF with space
|
|
59
|
+
.replace(/[\r\n]/g, ' ') // Replace remaining CR/LF with space
|
|
60
|
+
.trim());
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Sanitizes environment names to prevent path traversal (CWE-22)
|
|
64
|
+
* @param env - Environment name to sanitize
|
|
65
|
+
* @returns Sanitized environment name
|
|
66
|
+
* @throws Error if environment name is invalid
|
|
67
|
+
*
|
|
68
|
+
* @since 2.2.0
|
|
69
|
+
*/
|
|
70
|
+
static sanitizeEnvironmentName(env) {
|
|
71
|
+
if (!env || typeof env !== 'string') {
|
|
72
|
+
throw new Error('Environment name must be a non-empty string');
|
|
73
|
+
}
|
|
74
|
+
// Allow only alphanumeric, hyphens, and underscores
|
|
75
|
+
const sanitized = env.replace(/[^a-zA-Z0-9-_]/g, '');
|
|
76
|
+
if (sanitized !== env) {
|
|
77
|
+
throw new Error(`Invalid environment name: ${this.sanitizeLogMessage(env)}`);
|
|
78
|
+
}
|
|
79
|
+
if (sanitized.length === 0 || sanitized.length > 63) {
|
|
80
|
+
throw new Error('Environment name must be 1-63 characters long');
|
|
81
|
+
}
|
|
82
|
+
return sanitized;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Validates TypeScript file extensions for dynamic imports
|
|
86
|
+
* @param filePath - The file path to validate
|
|
87
|
+
* @returns True if the file has a valid TypeScript extension
|
|
88
|
+
*
|
|
89
|
+
* @since 2.2.0
|
|
90
|
+
*/
|
|
91
|
+
static isValidTypeScriptFile(filePath) {
|
|
92
|
+
const allowedExtensions = ['.ts', '.tsx'];
|
|
93
|
+
const ext = path.extname(filePath);
|
|
94
|
+
return allowedExtensions.includes(ext);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Validates Helm template path syntax
|
|
98
|
+
* @param templatePath - The template path to validate
|
|
99
|
+
* @returns True if the path is valid for Helm templates
|
|
100
|
+
*
|
|
101
|
+
* @since 2.2.0
|
|
102
|
+
*/
|
|
103
|
+
static isValidHelmTemplatePath(templatePath) {
|
|
104
|
+
if (!templatePath || typeof templatePath !== 'string') {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
// Basic validation for dot notation and no special characters that could break Helm
|
|
108
|
+
const helmPathRegex = /^[a-zA-Z][a-zA-Z0-9._-]*$/;
|
|
109
|
+
return helmPathRegex.test(templatePath);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Validates chart names according to Helm conventions
|
|
113
|
+
* @param chartName - Chart name to validate
|
|
114
|
+
* @returns True if chart name follows Helm naming rules
|
|
115
|
+
*
|
|
116
|
+
* @since 2.2.0
|
|
117
|
+
*/
|
|
118
|
+
static isValidChartName(chartName) {
|
|
119
|
+
if (!chartName || typeof chartName !== 'string') {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
// Helm chart name validation (RFC 1123 subdomain) - safe regex
|
|
123
|
+
// eslint-disable-next-line security/detect-unsafe-regex -- Simple character class regex is safe
|
|
124
|
+
const chartNameRegex = /^[a-z0-9]([-a-z0-9]*[a-z0-9])?$/;
|
|
125
|
+
return chartNameRegex.test(chartName) && chartName.length <= 63;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Validates subchart names according to Helm conventions
|
|
129
|
+
* @param subchartName - Subchart name to validate
|
|
130
|
+
* @returns True if subchart name is valid
|
|
131
|
+
*
|
|
132
|
+
* @since 2.2.0
|
|
133
|
+
*/
|
|
134
|
+
static isValidSubchartName(subchartName) {
|
|
135
|
+
return this.isValidChartName(subchartName);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=security.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security.js","sourceRoot":"","sources":["../../src/lib/security.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B;;;;;GAKG;AACH,MAAM,OAAO,aAAa;IACxB;;;;;;;;OAQG;IACH,MAAM,CAAC,YAAY,CAAC,SAAiB,EAAE,eAAuB;QAC5D,IAAI,CAAC,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;YAChD,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;QACnE,CAAC;QAED,qCAAqC;QACrC,IACE,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC;YACzB,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC;YAC1B,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAC;YAC/B,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAC,EAC/B,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,iDAA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brella.d.ts
CHANGED
|
@@ -1,7 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Umbrella chart utilities for managing multiple subcharts as a single unit
|
|
3
|
+
* @since 0.2.0
|
|
4
|
+
*/
|
|
5
|
+
import type { UmbrellaRutter, UmbrellaRutterProps } from './umbrellaRutter.js';
|
|
2
6
|
/**
|
|
3
7
|
* Create an umbrella chart from multiple Rutter instances
|
|
8
|
+
*
|
|
9
|
+
* @param props - Umbrella chart configuration
|
|
10
|
+
* @returns UmbrellaRutter instance for managing subcharts
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const umbrella = createUmbrella({
|
|
15
|
+
* meta: { name: 'my-umbrella', version: '1.0.0' },
|
|
16
|
+
* subcharts: [
|
|
17
|
+
* { name: 'frontend', rutter: frontendChart },
|
|
18
|
+
* { name: 'backend', rutter: backendChart }
|
|
19
|
+
* ]
|
|
20
|
+
* });
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @since 0.2.0
|
|
4
24
|
*/
|
|
5
25
|
export declare function createUmbrella(props: UmbrellaRutterProps): UmbrellaRutter;
|
|
6
|
-
export type { UmbrellaRutterProps, SubchartSpec } from './
|
|
26
|
+
export type { UmbrellaRutterProps, SubchartSpec } from './umbrellaRutter.js';
|
|
7
27
|
//# sourceMappingURL=umbrella.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"umbrella.d.ts","sourceRoot":"","sources":["../../src/lib/umbrella.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAG/E
|
|
1
|
+
{"version":3,"file":"umbrella.d.ts","sourceRoot":"","sources":["../../src/lib/umbrella.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAG/E;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,cAAc,CAEzE;AAGD,YAAY,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/lib/umbrella.js
CHANGED
|
@@ -1,6 +1,26 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Umbrella chart utilities for managing multiple subcharts as a single unit
|
|
3
|
+
* @since 0.2.0
|
|
4
|
+
*/
|
|
5
|
+
import { UmbrellaRutter as UmbrellaRutterClass } from './umbrellaRutter.js';
|
|
2
6
|
/**
|
|
3
7
|
* Create an umbrella chart from multiple Rutter instances
|
|
8
|
+
*
|
|
9
|
+
* @param props - Umbrella chart configuration
|
|
10
|
+
* @returns UmbrellaRutter instance for managing subcharts
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const umbrella = createUmbrella({
|
|
15
|
+
* meta: { name: 'my-umbrella', version: '1.0.0' },
|
|
16
|
+
* subcharts: [
|
|
17
|
+
* { name: 'frontend', rutter: frontendChart },
|
|
18
|
+
* { name: 'backend', rutter: backendChart }
|
|
19
|
+
* ]
|
|
20
|
+
* });
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @since 0.2.0
|
|
4
24
|
*/
|
|
5
25
|
export function createUmbrella(props) {
|
|
6
26
|
return new UmbrellaRutterClass(props);
|
package/dist/lib/umbrella.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"umbrella.js","sourceRoot":"","sources":["../../src/lib/umbrella.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"umbrella.js","sourceRoot":"","sources":["../../src/lib/umbrella.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,cAAc,IAAI,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE5E;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,cAAc,CAAC,KAA0B;IACvD,OAAO,IAAI,mBAAmB,CAAC,KAAK,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview UmbrellaRutter class for managing Helm umbrella charts with multiple subcharts
|
|
3
|
+
* @since 0.2.0
|
|
4
|
+
*/
|
|
5
|
+
import type { Rutter } from './rutter.js';
|
|
6
|
+
import type { HelmChartMeta } from './helmChartWriter.js';
|
|
7
|
+
/**
|
|
8
|
+
* Configuration for a subchart within an umbrella chart
|
|
9
|
+
*
|
|
10
|
+
* @since 0.2.0
|
|
11
|
+
*/
|
|
12
|
+
export interface SubchartSpec {
|
|
13
|
+
/** Name of the subchart */
|
|
14
|
+
name: string;
|
|
15
|
+
/** Rutter instance that generates the subchart */
|
|
16
|
+
rutter: Rutter;
|
|
17
|
+
/** Version of the subchart (optional) */
|
|
18
|
+
version?: string;
|
|
19
|
+
/** Helm condition for enabling/disabling the subchart */
|
|
20
|
+
condition?: string;
|
|
21
|
+
/** Tags for grouping subcharts */
|
|
22
|
+
tags?: string[];
|
|
23
|
+
/** Repository URL for the subchart */
|
|
24
|
+
repository?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Configuration properties for UmbrellaRutter
|
|
28
|
+
*
|
|
29
|
+
* @since 0.2.0
|
|
30
|
+
*/
|
|
31
|
+
export interface UmbrellaRutterProps {
|
|
32
|
+
/** Metadata for the umbrella chart */
|
|
33
|
+
meta: HelmChartMeta;
|
|
34
|
+
/** Array of subchart specifications */
|
|
35
|
+
subcharts: SubchartSpec[];
|
|
36
|
+
/** Default values for the umbrella chart */
|
|
37
|
+
defaultValues?: Record<string, unknown>;
|
|
38
|
+
/** Environment-specific values */
|
|
39
|
+
envValues?: Record<string, Record<string, unknown>>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* UmbrellaRutter manages multiple Rutter instances as subcharts
|
|
43
|
+
* to create Helm umbrella charts with dependencies.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* const umbrella = new UmbrellaRutter({
|
|
48
|
+
* meta: { name: 'my-app', version: '1.0.0' },
|
|
49
|
+
* subcharts: [
|
|
50
|
+
* { name: 'frontend', rutter: frontendChart },
|
|
51
|
+
* { name: 'backend', rutter: backendChart }
|
|
52
|
+
* ]
|
|
53
|
+
* });
|
|
54
|
+
*
|
|
55
|
+
* umbrella.write('./charts/my-app');
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* @since 0.2.0
|
|
59
|
+
*/
|
|
60
|
+
export declare class UmbrellaRutter {
|
|
61
|
+
private readonly props;
|
|
62
|
+
/**
|
|
63
|
+
* Creates a new UmbrellaRutter instance
|
|
64
|
+
*
|
|
65
|
+
* @param props - Configuration properties for the umbrella chart
|
|
66
|
+
* @throws {Error} If chart metadata is invalid
|
|
67
|
+
*
|
|
68
|
+
* @since 0.2.0
|
|
69
|
+
*/
|
|
70
|
+
constructor(props: UmbrellaRutterProps);
|
|
71
|
+
private validateMetadata;
|
|
72
|
+
/**
|
|
73
|
+
* Write the umbrella chart with all subcharts to the output directory
|
|
74
|
+
*
|
|
75
|
+
* Creates the complete umbrella chart structure including:
|
|
76
|
+
* - Parent Chart.yaml with dependencies
|
|
77
|
+
* - Parent values.yaml with global and subchart values
|
|
78
|
+
* - Individual subchart directories under charts/
|
|
79
|
+
* - NOTES.txt template
|
|
80
|
+
*
|
|
81
|
+
* @param outDir - Output directory path for the umbrella chart
|
|
82
|
+
* @throws {Error} If output directory path is invalid
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```typescript
|
|
86
|
+
* umbrella.write('./dist/my-umbrella-chart');
|
|
87
|
+
* ```
|
|
88
|
+
*
|
|
89
|
+
* @since 0.2.0
|
|
90
|
+
*/
|
|
91
|
+
write(outDir: string): void;
|
|
92
|
+
private writeParentChart;
|
|
93
|
+
private writeParentValues;
|
|
94
|
+
private deepMerge;
|
|
95
|
+
private generateNotesTemplate;
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=umbrellaRutter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"umbrellaRutter.d.ts","sourceRoot":"","sources":["../../src/lib/umbrellaRutter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG1D;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yDAAyD;IACzD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kCAAkC;IAClC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,sCAAsC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,sCAAsC;IACtC,IAAI,EAAE,aAAa,CAAC;IACpB,uCAAuC;IACvC,SAAS,EAAE,YAAY,EAAE,CAAC;IAC1B,4CAA4C;IAC5C,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,kCAAkC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACrD;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAsB;IAE5C;;;;;;;OAOG;gBACS,KAAK,EAAE,mBAAmB;IAMtC,OAAO,CAAC,gBAAgB;IAcxB;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAoC3B,OAAO,CAAC,gBAAgB;IA4BxB,OAAO,CAAC,iBAAiB;IAgCzB,OAAO,CAAC,SAAS;IAqBjB,OAAO,CAAC,qBAAqB;CAe9B"}
|
|
@@ -1,11 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview UmbrellaRutter class for managing Helm umbrella charts with multiple subcharts
|
|
3
|
+
* @since 0.2.0
|
|
4
|
+
*/
|
|
1
5
|
import { writeFileSync, mkdirSync } from 'fs';
|
|
2
6
|
import { join } from 'path';
|
|
3
7
|
import YAML from 'yaml';
|
|
8
|
+
import { SecurityUtils } from './security.js';
|
|
4
9
|
/**
|
|
5
10
|
* UmbrellaRutter manages multiple Rutter instances as subcharts
|
|
6
11
|
* to create Helm umbrella charts with dependencies.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const umbrella = new UmbrellaRutter({
|
|
16
|
+
* meta: { name: 'my-app', version: '1.0.0' },
|
|
17
|
+
* subcharts: [
|
|
18
|
+
* { name: 'frontend', rutter: frontendChart },
|
|
19
|
+
* { name: 'backend', rutter: backendChart }
|
|
20
|
+
* ]
|
|
21
|
+
* });
|
|
22
|
+
*
|
|
23
|
+
* umbrella.write('./charts/my-app');
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @since 0.2.0
|
|
7
27
|
*/
|
|
8
28
|
export class UmbrellaRutter {
|
|
29
|
+
/**
|
|
30
|
+
* Creates a new UmbrellaRutter instance
|
|
31
|
+
*
|
|
32
|
+
* @param props - Configuration properties for the umbrella chart
|
|
33
|
+
* @throws {Error} If chart metadata is invalid
|
|
34
|
+
*
|
|
35
|
+
* @since 0.2.0
|
|
36
|
+
*/
|
|
9
37
|
constructor(props) {
|
|
10
38
|
// Validate chart metadata
|
|
11
39
|
this.validateMetadata(props.meta);
|
|
@@ -25,34 +53,50 @@ export class UmbrellaRutter {
|
|
|
25
53
|
}
|
|
26
54
|
/**
|
|
27
55
|
* Write the umbrella chart with all subcharts to the output directory
|
|
56
|
+
*
|
|
57
|
+
* Creates the complete umbrella chart structure including:
|
|
58
|
+
* - Parent Chart.yaml with dependencies
|
|
59
|
+
* - Parent values.yaml with global and subchart values
|
|
60
|
+
* - Individual subchart directories under charts/
|
|
61
|
+
* - NOTES.txt template
|
|
62
|
+
*
|
|
63
|
+
* @param outDir - Output directory path for the umbrella chart
|
|
64
|
+
* @throws {Error} If output directory path is invalid
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```typescript
|
|
68
|
+
* umbrella.write('./dist/my-umbrella-chart');
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* @since 0.2.0
|
|
28
72
|
*/
|
|
29
73
|
write(outDir) {
|
|
30
|
-
//
|
|
31
|
-
const
|
|
32
|
-
const sanitizedOutDir = path.normalize(path.resolve(outDir));
|
|
33
|
-
const cwd = process.cwd();
|
|
34
|
-
if (!sanitizedOutDir.startsWith(cwd)) {
|
|
35
|
-
throw new Error('Output directory must be within current working directory');
|
|
36
|
-
}
|
|
74
|
+
// Validate output directory path
|
|
75
|
+
const validatedOutDir = SecurityUtils.validatePath(outDir, process.cwd());
|
|
37
76
|
// Create output directory structure
|
|
38
77
|
// eslint-disable-next-line security/detect-non-literal-fs-filename -- CLI tool needs dynamic paths
|
|
39
|
-
mkdirSync(
|
|
78
|
+
mkdirSync(validatedOutDir, { recursive: true });
|
|
40
79
|
// eslint-disable-next-line security/detect-non-literal-fs-filename -- CLI tool needs dynamic paths
|
|
41
|
-
mkdirSync(join(
|
|
80
|
+
mkdirSync(join(validatedOutDir, 'charts'), { recursive: true });
|
|
42
81
|
// Write each subchart to charts/ directory
|
|
43
82
|
for (const subchart of this.props.subcharts) {
|
|
44
|
-
|
|
83
|
+
// Validate subchart name using centralized validation
|
|
84
|
+
if (!SecurityUtils.isValidSubchartName(subchart.name)) {
|
|
85
|
+
throw new Error(`Invalid subchart name: ${SecurityUtils.sanitizeLogMessage(subchart.name)}`);
|
|
86
|
+
}
|
|
87
|
+
const sanitizedName = subchart.name; // Already validated by SecurityUtils
|
|
88
|
+
const subchartDir = join(validatedOutDir, 'charts', sanitizedName);
|
|
45
89
|
subchart.rutter.write(subchartDir);
|
|
46
90
|
}
|
|
47
91
|
// Generate parent Chart.yaml with dependencies
|
|
48
|
-
this.writeParentChart(
|
|
92
|
+
this.writeParentChart(validatedOutDir);
|
|
49
93
|
// Generate parent values.yaml
|
|
50
|
-
this.writeParentValues(
|
|
94
|
+
this.writeParentValues(validatedOutDir);
|
|
51
95
|
// Generate empty templates directory (umbrella charts typically don't have templates)
|
|
52
96
|
// eslint-disable-next-line security/detect-non-literal-fs-filename -- CLI tool needs dynamic paths
|
|
53
|
-
mkdirSync(join(
|
|
97
|
+
mkdirSync(join(validatedOutDir, 'templates'), { recursive: true });
|
|
54
98
|
// eslint-disable-next-line security/detect-non-literal-fs-filename -- CLI tool needs dynamic paths
|
|
55
|
-
writeFileSync(join(
|
|
99
|
+
writeFileSync(join(validatedOutDir, 'templates', 'NOTES.txt'), this.generateNotesTemplate());
|
|
56
100
|
}
|
|
57
101
|
writeParentChart(outDir) {
|
|
58
102
|
const chartYaml = {
|
|
@@ -66,13 +110,16 @@ export class UmbrellaRutter {
|
|
|
66
110
|
home: this.props.meta.home,
|
|
67
111
|
sources: this.props.meta.sources,
|
|
68
112
|
maintainers: this.props.meta.maintainers,
|
|
69
|
-
dependencies: this.props.subcharts.map((subchart) =>
|
|
70
|
-
name
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
113
|
+
dependencies: this.props.subcharts.map((subchart) => {
|
|
114
|
+
// Subchart name already validated in write() method
|
|
115
|
+
return {
|
|
116
|
+
name: subchart.name,
|
|
117
|
+
version: subchart.version || '0.1.0',
|
|
118
|
+
repository: subchart.repository || `file://./charts/${subchart.name}`,
|
|
119
|
+
...(subchart.condition && { condition: subchart.condition }),
|
|
120
|
+
...(subchart.tags && { tags: subchart.tags }),
|
|
121
|
+
};
|
|
122
|
+
}),
|
|
76
123
|
};
|
|
77
124
|
// eslint-disable-next-line security/detect-non-literal-fs-filename -- CLI tool needs dynamic paths
|
|
78
125
|
writeFileSync(join(outDir, 'Chart.yaml'), YAML.stringify(chartYaml));
|
|
@@ -97,9 +144,11 @@ export class UmbrellaRutter {
|
|
|
97
144
|
// Write environment-specific values files
|
|
98
145
|
if (this.props.envValues) {
|
|
99
146
|
for (const [env, envVals] of Object.entries(this.props.envValues)) {
|
|
147
|
+
// Use centralized environment name sanitization
|
|
148
|
+
const sanitizedEnv = SecurityUtils.sanitizeEnvironmentName(env);
|
|
100
149
|
const envValues = this.deepMerge(values, envVals);
|
|
101
150
|
// eslint-disable-next-line security/detect-non-literal-fs-filename -- CLI tool needs dynamic paths
|
|
102
|
-
writeFileSync(join(outDir, `values-${
|
|
151
|
+
writeFileSync(join(outDir, `values-${sanitizedEnv}.yaml`), YAML.stringify(envValues));
|
|
103
152
|
}
|
|
104
153
|
}
|
|
105
154
|
}
|
|
@@ -135,4 +184,4 @@ ${this.props.subcharts.map((s) => ` - charts/${s.name}/README.md`).join('\n')}
|
|
|
135
184
|
`;
|
|
136
185
|
}
|
|
137
186
|
}
|
|
138
|
-
//# sourceMappingURL=
|
|
187
|
+
//# sourceMappingURL=umbrellaRutter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"umbrellaRutter.js","sourceRoot":"","sources":["../../src/lib/umbrellaRutter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,IAAI,MAAM,MAAM,CAAC;AAIxB,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAsC9C;;;;;;;;;;;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O,qBAAqB;QAC3B,OAAO;;;;;;;;;;;EAWT,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,cAAc,CAAC,CAAC,IAAI,YAAY,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;CAC7E,CAAC;IACA,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "timonel",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.4.0",
|
|
5
5
|
"description": "Timonel: programmatic Helm chart generator using cdk8s (TypeScript)",
|
|
6
6
|
"bin": {
|
|
7
7
|
"timonel": "dist/cli.js",
|
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
82
|
"cdk8s": "^2.70.11",
|
|
83
|
+
"constructs": "^10.4.2",
|
|
83
84
|
"ts-node": "^10.9.2",
|
|
84
85
|
"yaml": "^2.8.1"
|
|
85
86
|
},
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
export interface HelmChartMeta {
|
|
2
|
-
name: string;
|
|
3
|
-
version: string;
|
|
4
|
-
description?: string;
|
|
5
|
-
appVersion?: string;
|
|
6
|
-
type?: 'application' | 'library';
|
|
7
|
-
kubeVersion?: string;
|
|
8
|
-
keywords?: string[];
|
|
9
|
-
home?: string;
|
|
10
|
-
sources?: string[];
|
|
11
|
-
maintainers?: {
|
|
12
|
-
name: string;
|
|
13
|
-
email?: string;
|
|
14
|
-
url?: string;
|
|
15
|
-
}[];
|
|
16
|
-
icon?: string;
|
|
17
|
-
dependencies?: Array<{
|
|
18
|
-
name: string;
|
|
19
|
-
version: string;
|
|
20
|
-
repository: string;
|
|
21
|
-
alias?: string;
|
|
22
|
-
condition?: string | string[];
|
|
23
|
-
tags?: string[];
|
|
24
|
-
importValues?: unknown;
|
|
25
|
-
}>;
|
|
26
|
-
}
|
|
27
|
-
export interface EnvValuesMap {
|
|
28
|
-
[env: string]: Record<string, unknown>;
|
|
29
|
-
}
|
|
30
|
-
export interface SynthAsset {
|
|
31
|
-
/** filename or logical id */
|
|
32
|
-
id: string;
|
|
33
|
-
/** YAML string, may contain multiple docs separated by --- */
|
|
34
|
-
yaml: string;
|
|
35
|
-
/** target directory inside chart: templates (default) or crds */
|
|
36
|
-
target?: 'templates' | 'crds';
|
|
37
|
-
/** if true, don't split this asset into multiple files even if it contains multiple docs */
|
|
38
|
-
singleFile?: boolean;
|
|
39
|
-
}
|
|
40
|
-
export interface HelmChartWriteOptions {
|
|
41
|
-
outDir: string;
|
|
42
|
-
meta: HelmChartMeta;
|
|
43
|
-
defaultValues?: Record<string, unknown> | undefined;
|
|
44
|
-
envValues?: EnvValuesMap | undefined;
|
|
45
|
-
/**
|
|
46
|
-
* Kubernetes manifests to place under templates/
|
|
47
|
-
* Accepts one or multiple documents per SynthAsset.
|
|
48
|
-
*/
|
|
49
|
-
assets: SynthAsset[];
|
|
50
|
-
/**
|
|
51
|
-
* Optional Helm helpers content for templates/_helpers.tpl.
|
|
52
|
-
* If a string is provided, it's written verbatim.
|
|
53
|
-
* If an array is provided, each item becomes a named Helm template
|
|
54
|
-
* block as: {{- define "<name>" -}} ... {{- end }}
|
|
55
|
-
*/
|
|
56
|
-
helpersTpl?: string | HelperDefinition[];
|
|
57
|
-
/** Optional NOTES.txt content under templates/ */
|
|
58
|
-
notesTpl?: string;
|
|
59
|
-
/** Optional values.schema.json object */
|
|
60
|
-
valuesSchema?: Record<string, unknown>;
|
|
61
|
-
}
|
|
62
|
-
export interface HelperDefinition {
|
|
63
|
-
name: string;
|
|
64
|
-
body: string;
|
|
65
|
-
}
|
|
66
|
-
export declare class HelmChartWriter {
|
|
67
|
-
static write(opts: HelmChartWriteOptions): void;
|
|
68
|
-
}
|
|
69
|
-
//# sourceMappingURL=HelmChartWriter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3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