@guanjinke/artifact-client 1.17.0 → 1.19.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/README.md +1 -1
- package/dist/artifact-client.d.ts +3 -1
- package/dist/artifact-client.d.ts.map +1 -1
- package/dist/artifact-client.js +6 -1
- package/dist/artifact-client.js.map +1 -1
- package/dist/cli/config-manager.d.ts +3 -0
- package/dist/cli/config-manager.d.ts.map +1 -1
- package/dist/cli/config-manager.js +44 -0
- package/dist/cli/config-manager.js.map +1 -1
- package/dist/cli/environment.d.ts.map +1 -1
- package/dist/cli/environment.js +116 -0
- package/dist/cli/environment.js.map +1 -1
- package/dist/cli/jdbc-service-client.d.ts +9 -0
- package/dist/cli/jdbc-service-client.d.ts.map +1 -0
- package/dist/cli/jdbc-service-client.js +19 -0
- package/dist/cli/jdbc-service-client.js.map +1 -0
- package/dist/cli/setup.d.ts.map +1 -1
- package/dist/cli/setup.js +46 -0
- package/dist/cli/setup.js.map +1 -1
- package/dist/environment/driver-discovery.d.ts +3 -0
- package/dist/environment/driver-discovery.d.ts.map +1 -0
- package/dist/environment/driver-discovery.js +163 -0
- package/dist/environment/driver-discovery.js.map +1 -0
- package/dist/environment/driver-oss.d.ts +14 -0
- package/dist/environment/driver-oss.d.ts.map +1 -0
- package/dist/environment/driver-oss.js +144 -0
- package/dist/environment/driver-oss.js.map +1 -0
- package/dist/environment/drivers.d.ts +33 -0
- package/dist/environment/drivers.d.ts.map +1 -0
- package/dist/environment/drivers.js +274 -0
- package/dist/environment/drivers.js.map +1 -0
- package/dist/environment/hana-archive.d.ts +9 -0
- package/dist/environment/hana-archive.d.ts.map +1 -0
- package/dist/environment/hana-archive.js +181 -0
- package/dist/environment/hana-archive.js.map +1 -0
- package/dist/environment/hana.d.ts +58 -0
- package/dist/environment/hana.d.ts.map +1 -0
- package/dist/environment/hana.js +238 -0
- package/dist/environment/hana.js.map +1 -0
- package/dist/environment/jdbc-connection-test.d.ts +25 -0
- package/dist/environment/jdbc-connection-test.d.ts.map +1 -0
- package/dist/environment/jdbc-connection-test.js +146 -0
- package/dist/environment/jdbc-connection-test.js.map +1 -0
- package/dist/environment/jdbc-diagnostics.d.ts +13 -0
- package/dist/environment/jdbc-diagnostics.d.ts.map +1 -0
- package/dist/environment/jdbc-diagnostics.js +108 -0
- package/dist/environment/jdbc-diagnostics.js.map +1 -0
- package/dist/environment/jdbc-service.d.ts +91 -0
- package/dist/environment/jdbc-service.d.ts.map +1 -0
- package/dist/environment/jdbc-service.js +375 -0
- package/dist/environment/jdbc-service.js.map +1 -0
- package/dist/environment/jdbc.d.ts +28 -0
- package/dist/environment/jdbc.d.ts.map +1 -0
- package/dist/environment/jdbc.js +164 -0
- package/dist/environment/jdbc.js.map +1 -0
- package/dist/environment/manager.d.ts +10 -0
- package/dist/environment/manager.d.ts.map +1 -1
- package/dist/environment/manager.js +32 -0
- package/dist/environment/manager.js.map +1 -1
- package/dist/environment/registry.d.ts +14 -0
- package/dist/environment/registry.d.ts.map +1 -1
- package/dist/environment/registry.js +7 -0
- package/dist/environment/registry.js.map +1 -1
- package/dist/environment/site-init.d.ts +16 -0
- package/dist/environment/site-init.d.ts.map +1 -0
- package/dist/environment/site-init.js +108 -0
- package/dist/environment/site-init.js.map +1 -0
- package/dist/environment/update.d.ts +1 -1
- package/dist/environment/update.d.ts.map +1 -1
- package/dist/environment/update.js +717 -552
- package/dist/environment/update.js.map +1 -1
- package/dist/providers/oss-provider.d.ts +6 -2
- package/dist/providers/oss-provider.d.ts.map +1 -1
- package/dist/providers/oss-provider.js +37 -7
- package/dist/providers/oss-provider.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.DriverDeployWriteError = void 0;
|
|
37
|
+
exports.deployThirdPartyDrivers = deployThirdPartyDrivers;
|
|
38
|
+
const fs = __importStar(require("fs/promises"));
|
|
39
|
+
const path = __importStar(require("path"));
|
|
40
|
+
const fs_1 = require("fs");
|
|
41
|
+
const registry_1 = require("./registry");
|
|
42
|
+
const process_1 = require("./process");
|
|
43
|
+
const posix_process_1 = require("./posix-process");
|
|
44
|
+
const validate_1 = require("./validate");
|
|
45
|
+
class DriverDeployWriteError extends Error {
|
|
46
|
+
installed;
|
|
47
|
+
failed;
|
|
48
|
+
constructor(installed, failed) {
|
|
49
|
+
super(`Driver deployment incomplete; created: ${installed.join(', ') || '(none)'}; failed or possibly partial: ${failed}. No files were removed.`);
|
|
50
|
+
this.installed = installed;
|
|
51
|
+
this.failed = failed;
|
|
52
|
+
this.name = 'DriverDeployWriteError';
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.DriverDeployWriteError = DriverDeployWriteError;
|
|
56
|
+
const MAX_FILES = 4096, MAX_ENTRIES = 8192, MAX_BYTES = 512 * 1024 * 1024, MAX_DEPTH = 32;
|
|
57
|
+
function validName(name) {
|
|
58
|
+
return typeof name === 'string' && /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(name) && !/[. ]$/.test(name) && !/^(con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\.|$)/i.test(name);
|
|
59
|
+
}
|
|
60
|
+
async function statOrMissing(file) {
|
|
61
|
+
try {
|
|
62
|
+
return await fs.lstat(file);
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
if (error.code === 'ENOENT')
|
|
66
|
+
return undefined;
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
async function noLinks(file) {
|
|
71
|
+
const absolute = path.resolve(file);
|
|
72
|
+
const root = path.parse(absolute).root;
|
|
73
|
+
let current = root;
|
|
74
|
+
for (const part of absolute.slice(root.length).split(path.sep).filter(Boolean)) {
|
|
75
|
+
current = path.join(current, part);
|
|
76
|
+
const stat = await statOrMissing(current);
|
|
77
|
+
if (!stat)
|
|
78
|
+
break;
|
|
79
|
+
if (stat.isSymbolicLink())
|
|
80
|
+
throw new Error(`Link is not allowed: ${current}.`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
async function readBounded(file, expected) {
|
|
84
|
+
const handle = await fs.open(file, 'r');
|
|
85
|
+
try {
|
|
86
|
+
const stat = await handle.stat();
|
|
87
|
+
if (!stat.isFile() || stat.size !== expected)
|
|
88
|
+
throw new Error('Driver file changed during inspection.');
|
|
89
|
+
const buffer = Buffer.alloc(expected + 1);
|
|
90
|
+
let offset = 0;
|
|
91
|
+
while (offset < buffer.length) {
|
|
92
|
+
const { bytesRead } = await handle.read(buffer, offset, buffer.length - offset, offset);
|
|
93
|
+
if (!bytesRead)
|
|
94
|
+
break;
|
|
95
|
+
offset += bytesRead;
|
|
96
|
+
}
|
|
97
|
+
if (offset !== expected)
|
|
98
|
+
throw new Error('Driver file changed during inspection.');
|
|
99
|
+
return buffer.subarray(0, expected);
|
|
100
|
+
}
|
|
101
|
+
finally {
|
|
102
|
+
await handle.close();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/** Install files without replacing existing files. A write failure can leave partial results. */
|
|
106
|
+
async function deployThirdPartyDrivers(options, dependencies = {}) {
|
|
107
|
+
if (!validName(options.driverId))
|
|
108
|
+
throw new Error('Invalid driver id.');
|
|
109
|
+
const driverId = options.driverId.toLowerCase();
|
|
110
|
+
if (!Array.isArray(options.files) || options.files.length === 0)
|
|
111
|
+
throw new Error('At least one driver file is required.');
|
|
112
|
+
for (const file of options.files)
|
|
113
|
+
if (typeof file !== 'string' || !file || file.includes('\0'))
|
|
114
|
+
throw new Error('Invalid driver source path.');
|
|
115
|
+
const registry = dependencies.registry ?? new registry_1.EnvironmentRegistry();
|
|
116
|
+
const processes = dependencies.processes ?? (process.platform === 'win32' ? new process_1.WindowsProcessBackend() : new posix_process_1.PosixProcessBackend());
|
|
117
|
+
const original = await registry.get(options.name);
|
|
118
|
+
return registry.locked(`env-${original.id}`, async () => {
|
|
119
|
+
const entry = await registry.get(options.name);
|
|
120
|
+
if (entry.id !== original.id || entry.root !== original.root)
|
|
121
|
+
throw new Error('Environment changed during operation.');
|
|
122
|
+
await (0, validate_1.validateEnvironmentOwnership)(entry, registry.directory);
|
|
123
|
+
const state = await (0, validate_1.observeRuntimeState)(entry, processes);
|
|
124
|
+
if (state !== 'stopped' && state !== 'ready')
|
|
125
|
+
throw new Error(`Environment must be stopped; observed state: ${state}.`);
|
|
126
|
+
const directory = path.join(entry.root, 'DataSourceService', 'third-party-drivers', driverId);
|
|
127
|
+
await noLinks(directory);
|
|
128
|
+
const names = new Map();
|
|
129
|
+
const sources = [];
|
|
130
|
+
let count = 0;
|
|
131
|
+
let total = 0;
|
|
132
|
+
const register = (name, kind) => {
|
|
133
|
+
if (++count > MAX_ENTRIES)
|
|
134
|
+
throw new Error('Driver source entry limit exceeded.');
|
|
135
|
+
const key = name.toLowerCase();
|
|
136
|
+
const prior = names.get(key);
|
|
137
|
+
if (prior && (prior.name !== name || prior.kind !== kind || kind === 'file'))
|
|
138
|
+
throw new Error(`Invalid or duplicate driver filename: ${name}.`);
|
|
139
|
+
names.set(key, { name, kind });
|
|
140
|
+
};
|
|
141
|
+
const visit = async (source, parts) => {
|
|
142
|
+
if (parts.length > MAX_DEPTH)
|
|
143
|
+
throw new Error('Driver source depth limit exceeded.');
|
|
144
|
+
await noLinks(source);
|
|
145
|
+
const stat = await fs.lstat(source);
|
|
146
|
+
if (stat.isSymbolicLink())
|
|
147
|
+
throw new Error('Driver source link is not allowed.');
|
|
148
|
+
if (stat.isDirectory()) {
|
|
149
|
+
if (parts.length)
|
|
150
|
+
register(parts.join('/'), 'directory');
|
|
151
|
+
for (const child of (await fs.readdir(source)).sort()) {
|
|
152
|
+
if (!validName(child))
|
|
153
|
+
throw new Error(`Invalid driver filename: ${child}.`);
|
|
154
|
+
await visit(path.join(source, child), [...parts, child]);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
else if (stat.isFile()) {
|
|
158
|
+
if (!parts.length || !validName(parts[parts.length - 1]))
|
|
159
|
+
throw new Error('Invalid driver filename.');
|
|
160
|
+
register(parts.join('/'), 'file');
|
|
161
|
+
total += stat.size;
|
|
162
|
+
if (sources.length >= MAX_FILES || total > MAX_BYTES)
|
|
163
|
+
throw new Error('Driver source file count or size limit exceeded.');
|
|
164
|
+
sources.push({ source, name: parts.join('/'), size: stat.size });
|
|
165
|
+
}
|
|
166
|
+
else
|
|
167
|
+
throw new Error('Driver source must contain only regular files and directories.');
|
|
168
|
+
};
|
|
169
|
+
for (const input of options.files) {
|
|
170
|
+
const source = path.resolve(input);
|
|
171
|
+
await noLinks(source);
|
|
172
|
+
const stat = await fs.lstat(source);
|
|
173
|
+
if (options.preserveSourceDir && (!stat.isDirectory() || options.files.length !== 1 || !validName(path.basename(source))))
|
|
174
|
+
throw new Error('Preserving source directory requires one safely named directory.');
|
|
175
|
+
await visit(source, stat.isDirectory() && !options.preserveSourceDir ? [] : [path.basename(source)]);
|
|
176
|
+
}
|
|
177
|
+
if (!sources.length)
|
|
178
|
+
throw new Error('At least one driver file is required.');
|
|
179
|
+
async function checkTarget(parts, file) {
|
|
180
|
+
let current = entry.root;
|
|
181
|
+
const all = ['DataSourceService', 'third-party-drivers', driverId, ...parts];
|
|
182
|
+
for (const [index, part] of all.entries()) {
|
|
183
|
+
const parent = await statOrMissing(current);
|
|
184
|
+
if (!parent)
|
|
185
|
+
return;
|
|
186
|
+
if (!parent.isDirectory() || parent.isSymbolicLink())
|
|
187
|
+
throw new Error('Driver destination is not a real directory.');
|
|
188
|
+
const match = (await fs.readdir(current)).find(name => name.toLowerCase() === part.toLowerCase());
|
|
189
|
+
if (!match)
|
|
190
|
+
return;
|
|
191
|
+
if (match !== part)
|
|
192
|
+
throw new Error(`Driver filename conflicts: ${parts.join('/')}.`);
|
|
193
|
+
current = path.join(current, match);
|
|
194
|
+
const stat = await fs.lstat(current);
|
|
195
|
+
if (stat.isSymbolicLink() || (index < all.length - 1 || !file) && !stat.isDirectory())
|
|
196
|
+
throw new Error('Driver destination is not a real directory.');
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
await checkTarget([], false);
|
|
200
|
+
if (options.exclusiveJarSet) {
|
|
201
|
+
if (sources.some(item => item.name.includes('/') || !/\.jar$/i.test(item.name)))
|
|
202
|
+
throw new Error('Exclusive driver package must contain only flat JAR files.');
|
|
203
|
+
const destination = await statOrMissing(directory);
|
|
204
|
+
if (destination) {
|
|
205
|
+
for (const existing of await fs.readdir(directory)) {
|
|
206
|
+
if (/\.jar$/i.test(existing) && !names.has(existing.toLowerCase()))
|
|
207
|
+
throw new Error(`Existing driver JAR conflicts with selected package: ${existing}.`);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
for (const item of names.values())
|
|
212
|
+
if (item.kind === 'directory')
|
|
213
|
+
await checkTarget(item.name.split('/'), false);
|
|
214
|
+
const plans = [];
|
|
215
|
+
let actualBytes = 0;
|
|
216
|
+
for (const item of sources) {
|
|
217
|
+
const parts = item.name.split('/');
|
|
218
|
+
await checkTarget(parts, true);
|
|
219
|
+
await noLinks(item.source);
|
|
220
|
+
const content = await readBounded(item.source, item.size);
|
|
221
|
+
actualBytes += content.length;
|
|
222
|
+
if (content.length !== item.size || actualBytes > MAX_BYTES)
|
|
223
|
+
throw new Error('Driver source changed or size limit exceeded.');
|
|
224
|
+
const destination = path.join(directory, ...parts);
|
|
225
|
+
const target = await statOrMissing(destination);
|
|
226
|
+
if (target) {
|
|
227
|
+
if (!target.isFile() || target.isSymbolicLink() || target.size !== content.length || !(await readBounded(destination, content.length)).equals(content))
|
|
228
|
+
throw new Error(`Driver file conflicts: ${item.name}.`);
|
|
229
|
+
plans.push({ name: item.name, content, status: 'unchanged' });
|
|
230
|
+
}
|
|
231
|
+
else
|
|
232
|
+
plans.push({ name: item.name, content, status: 'would-install' });
|
|
233
|
+
}
|
|
234
|
+
if (!options.dryRun) {
|
|
235
|
+
for (const plan of plans.filter(item => item.status === 'unchanged')) {
|
|
236
|
+
const parts = plan.name.split('/');
|
|
237
|
+
await checkTarget(parts, true);
|
|
238
|
+
const destination = path.join(directory, ...parts);
|
|
239
|
+
const stat = await statOrMissing(destination);
|
|
240
|
+
if (!stat?.isFile() || stat.isSymbolicLink() || stat.size !== plan.content.length || !(await readBounded(destination, plan.content.length)).equals(plan.content))
|
|
241
|
+
throw new Error(`Driver file conflicts: ${plan.name}.`);
|
|
242
|
+
}
|
|
243
|
+
const installed = [];
|
|
244
|
+
for (const plan of plans) {
|
|
245
|
+
if (plan.status === 'unchanged')
|
|
246
|
+
continue;
|
|
247
|
+
try {
|
|
248
|
+
const parts = plan.name.split('/');
|
|
249
|
+
for (const dir of [path.join(entry.root, 'DataSourceService'), path.dirname(directory), directory, ...parts.slice(0, -1).map((_, i) => path.join(directory, ...parts.slice(0, i + 1)))]) {
|
|
250
|
+
await noLinks(dir);
|
|
251
|
+
try {
|
|
252
|
+
await fs.mkdir(dir);
|
|
253
|
+
}
|
|
254
|
+
catch (error) {
|
|
255
|
+
if (error.code !== 'EEXIST')
|
|
256
|
+
throw error;
|
|
257
|
+
}
|
|
258
|
+
const stat = await fs.lstat(dir);
|
|
259
|
+
if (!stat.isDirectory() || stat.isSymbolicLink())
|
|
260
|
+
throw new Error('Driver destination is not a real directory.');
|
|
261
|
+
}
|
|
262
|
+
await checkTarget(parts, true);
|
|
263
|
+
await fs.writeFile(path.join(directory, ...parts), plan.content, { flag: fs_1.constants.O_WRONLY | fs_1.constants.O_CREAT | fs_1.constants.O_EXCL, mode: 0o666 });
|
|
264
|
+
installed.push(plan.name);
|
|
265
|
+
}
|
|
266
|
+
catch {
|
|
267
|
+
throw new DriverDeployWriteError(installed, plan.name);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
return { name: entry.name, driverId, directory, dryRun: !!options.dryRun, files: plans.map(plan => ({ name: plan.name, status: plan.status === 'would-install' && !options.dryRun ? 'installed' : plan.status })) };
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
//# sourceMappingURL=drivers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drivers.js","sourceRoot":"","sources":["../../src/environment/drivers.ts"],"names":[],"mappings":";;;;;;;;;;;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AAC,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,KAAK,eAAe,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC;IACtN,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface TrustedTgzLimits {
|
|
2
|
+
maxCompressedBytes?: number;
|
|
3
|
+
maxExpandedBytes?: number;
|
|
4
|
+
maxFileBytes?: number;
|
|
5
|
+
maxEntries?: number;
|
|
6
|
+
}
|
|
7
|
+
/** Read a hash-pinned TGZ, returning only explicitly selected regular files. Never writes extracted data. */
|
|
8
|
+
export declare function extractTrustedTgz(archive: string, expectedSha256: string, selected: string[], limits?: TrustedTgzLimits): Promise<Map<string, Buffer>>;
|
|
9
|
+
//# sourceMappingURL=hana-archive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hana-archive.d.ts","sourceRoot":"","sources":["../../src/environment/hana-archive.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,gBAAgB;IAAG,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE;AAaxI,6GAA6G;AAC7G,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,MAAM,GAAE,gBAAqB,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAgFhK"}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.extractTrustedTgz = extractTrustedTgz;
|
|
37
|
+
const fs = __importStar(require("fs/promises"));
|
|
38
|
+
const crypto_1 = require("crypto");
|
|
39
|
+
const stream_1 = require("stream");
|
|
40
|
+
const zlib_1 = require("zlib");
|
|
41
|
+
function tarNumber(field) {
|
|
42
|
+
const value = field.toString('ascii').replace(/\0.*$/, '').trim();
|
|
43
|
+
if (!/^[0-7]+$/.test(value))
|
|
44
|
+
throw new Error('Invalid TAR numeric field.');
|
|
45
|
+
const number = parseInt(value, 8);
|
|
46
|
+
if (!Number.isSafeInteger(number))
|
|
47
|
+
throw new Error('TAR numeric field too large.');
|
|
48
|
+
return number;
|
|
49
|
+
}
|
|
50
|
+
function safePath(value) {
|
|
51
|
+
return !!value && !value.startsWith('/') && !/[\\:\x00-\x1f\x7f]/.test(value) && value.split('/').every(part => !!part && part !== '.' && part !== '..');
|
|
52
|
+
}
|
|
53
|
+
/** Read a hash-pinned TGZ, returning only explicitly selected regular files. Never writes extracted data. */
|
|
54
|
+
async function extractTrustedTgz(archive, expectedSha256, selected, limits = {}) {
|
|
55
|
+
if (!/^[a-f0-9]{64}$/.test(expectedSha256))
|
|
56
|
+
throw new Error('Invalid expected SHA256.');
|
|
57
|
+
if (!selected.length || new Set(selected).size !== selected.length || selected.some(name => !safePath(name)))
|
|
58
|
+
throw new Error('Invalid TAR selection.');
|
|
59
|
+
const compressedLimit = limits.maxCompressedBytes ?? 64 * 1024 * 1024;
|
|
60
|
+
const expandedLimit = limits.maxExpandedBytes ?? 128 * 1024 * 1024;
|
|
61
|
+
const fileLimit = limits.maxFileBytes ?? 32 * 1024 * 1024;
|
|
62
|
+
const entryLimit = limits.maxEntries ?? 1024;
|
|
63
|
+
if (![compressedLimit, expandedLimit, fileLimit, entryLimit].every(n => Number.isSafeInteger(n) && n > 0))
|
|
64
|
+
throw new Error('Invalid TAR limits.');
|
|
65
|
+
const link = await fs.lstat(archive);
|
|
66
|
+
if (!link.isFile() || link.isSymbolicLink() || link.size <= 0 || link.size > compressedLimit)
|
|
67
|
+
throw new Error('Invalid TGZ file or size.');
|
|
68
|
+
const handle = await fs.open(archive, 'r');
|
|
69
|
+
let compressed;
|
|
70
|
+
try {
|
|
71
|
+
const stat = await handle.stat();
|
|
72
|
+
if (!stat.isFile() || stat.size !== link.size)
|
|
73
|
+
throw new Error('TGZ changed during inspection.');
|
|
74
|
+
compressed = Buffer.alloc(stat.size);
|
|
75
|
+
let offset = 0;
|
|
76
|
+
while (offset < compressed.length) {
|
|
77
|
+
const { bytesRead } = await handle.read(compressed, offset, compressed.length - offset, offset);
|
|
78
|
+
if (!bytesRead)
|
|
79
|
+
throw new Error('TGZ changed during inspection.');
|
|
80
|
+
offset += bytesRead;
|
|
81
|
+
}
|
|
82
|
+
const after = await handle.stat();
|
|
83
|
+
if (after.size !== stat.size || after.mtimeMs !== stat.mtimeMs || after.ctimeMs !== stat.ctimeMs)
|
|
84
|
+
throw new Error('TGZ changed during inspection.');
|
|
85
|
+
}
|
|
86
|
+
finally {
|
|
87
|
+
await handle.close();
|
|
88
|
+
}
|
|
89
|
+
if ((0, crypto_1.createHash)('sha256').update(compressed).digest('hex') !== expectedSha256)
|
|
90
|
+
throw new Error('TGZ SHA256 mismatch.');
|
|
91
|
+
const output = new Map();
|
|
92
|
+
const seen = new Set();
|
|
93
|
+
let pending = Buffer.alloc(0), remaining = 0, padding = 0, expanded = 0, entries = 0, ended = false, zeroBlocks = 0;
|
|
94
|
+
let current;
|
|
95
|
+
let pieces = [];
|
|
96
|
+
const stream = stream_1.Readable.from([compressed]).pipe((0, zlib_1.createGunzip)());
|
|
97
|
+
for await (const input of stream) {
|
|
98
|
+
const chunk = input;
|
|
99
|
+
expanded += chunk.length;
|
|
100
|
+
if (expanded > expandedLimit)
|
|
101
|
+
throw new Error('TGZ expanded size limit exceeded.');
|
|
102
|
+
pending = Buffer.concat([pending, chunk]);
|
|
103
|
+
while (true) {
|
|
104
|
+
if (ended) {
|
|
105
|
+
if (pending.some(byte => byte !== 0))
|
|
106
|
+
throw new Error('Unexpected data after TAR end.');
|
|
107
|
+
pending = Buffer.alloc(0);
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
if (remaining) {
|
|
111
|
+
if (!pending.length)
|
|
112
|
+
break;
|
|
113
|
+
const take = Math.min(remaining, pending.length);
|
|
114
|
+
if (current)
|
|
115
|
+
pieces.push(Buffer.from(pending.subarray(0, take)));
|
|
116
|
+
pending = pending.subarray(take);
|
|
117
|
+
remaining -= take;
|
|
118
|
+
if (remaining)
|
|
119
|
+
break;
|
|
120
|
+
if (current) {
|
|
121
|
+
output.set(current, Buffer.concat(pieces));
|
|
122
|
+
current = undefined;
|
|
123
|
+
pieces = [];
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (padding) {
|
|
127
|
+
if (pending.length < padding)
|
|
128
|
+
break;
|
|
129
|
+
if (pending.subarray(0, padding).some(byte => byte !== 0))
|
|
130
|
+
throw new Error('Invalid TAR padding.');
|
|
131
|
+
pending = pending.subarray(padding);
|
|
132
|
+
padding = 0;
|
|
133
|
+
}
|
|
134
|
+
if (pending.length < 512)
|
|
135
|
+
break;
|
|
136
|
+
const header = pending.subarray(0, 512);
|
|
137
|
+
pending = pending.subarray(512);
|
|
138
|
+
if (header.every(byte => byte === 0)) {
|
|
139
|
+
if (++zeroBlocks === 2)
|
|
140
|
+
ended = true;
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
if (zeroBlocks)
|
|
144
|
+
throw new Error('Invalid TAR end marker.');
|
|
145
|
+
if (++entries > entryLimit)
|
|
146
|
+
throw new Error('TAR entry limit exceeded.');
|
|
147
|
+
const recorded = tarNumber(header.subarray(148, 156));
|
|
148
|
+
let sum = 0;
|
|
149
|
+
for (let i = 0; i < 512; i++)
|
|
150
|
+
sum += i >= 148 && i < 156 ? 32 : header[i];
|
|
151
|
+
if (sum !== recorded)
|
|
152
|
+
throw new Error('Invalid TAR header checksum.');
|
|
153
|
+
const text = (start, length) => header.subarray(start, start + length).toString('utf8').replace(/\0.*$/, '');
|
|
154
|
+
const prefix = text(345, 155), name = (prefix ? prefix + '/' : '') + text(0, 100);
|
|
155
|
+
if (!safePath(name))
|
|
156
|
+
throw new Error('Unsafe TAR path.');
|
|
157
|
+
const key = name.toLowerCase();
|
|
158
|
+
if (seen.has(key))
|
|
159
|
+
throw new Error('Duplicate TAR entry.');
|
|
160
|
+
seen.add(key);
|
|
161
|
+
const type = header[156];
|
|
162
|
+
if (type !== 0 && type !== 48)
|
|
163
|
+
throw new Error('TAR links and non-regular entries are forbidden.');
|
|
164
|
+
const size = tarNumber(header.subarray(124, 136));
|
|
165
|
+
if (size > fileLimit)
|
|
166
|
+
throw new Error('TAR file size limit exceeded.');
|
|
167
|
+
remaining = size;
|
|
168
|
+
padding = (512 - size % 512) % 512;
|
|
169
|
+
if (selected.includes(name)) {
|
|
170
|
+
if (!size)
|
|
171
|
+
output.set(name, Buffer.alloc(0));
|
|
172
|
+
else
|
|
173
|
+
current = name;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
if (!ended || remaining || padding || pending.length || output.size !== selected.length)
|
|
178
|
+
throw new Error('Incomplete TAR or selected file missing.');
|
|
179
|
+
return output;
|
|
180
|
+
}
|
|
181
|
+
//# sourceMappingURL=hana-archive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hana-archive.js","sourceRoot":"","sources":["../../src/environment/hana-archive.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,8CAgFC;AAnGD,gDAAkC;AAClC,mCAAoC;AACpC,mCAAkC;AAClC,+BAAoC;AAIpC,SAAS,SAAS,CAAC,KAAa;IAC9B,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAClE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAA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Q,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC5B,IAAI,CAAC,IAAI;oBAAE,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;;oBACxC,OAAO,GAAG,IAAI,CAAC;YACtB,CAAC;QACH,CAAC;IACH,CAAC;IACD,IAAI,CAAC,KAAK,IAAI,SAAS,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IACrJ,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { EnvironmentRegistry } from './registry';
|
|
2
|
+
import { ProcessBackend } from './process';
|
|
3
|
+
/** Fingerprint of the locally verified SAP HANA Client 2.10.15 Windows x64 DOTNETCORE.TGZ. */
|
|
4
|
+
export declare const VERIFIED_HANA_WINDOWS_SHA256 = "95b7b6f1dbe9f4b0367b92189e3d819a9786c178555ea2e8b6246cac01850d7b";
|
|
5
|
+
export interface HanaPackageReport {
|
|
6
|
+
archive: string;
|
|
7
|
+
sha256: string;
|
|
8
|
+
platform: 'win32';
|
|
9
|
+
architecture: 'x64';
|
|
10
|
+
version: '2.10.15' | null;
|
|
11
|
+
verified: boolean;
|
|
12
|
+
action: 'inspection-only';
|
|
13
|
+
}
|
|
14
|
+
/** Inspect a known Windows package without extracting, deploying, or changing environment variables. */
|
|
15
|
+
export declare function inspectWindowsHanaPackage(archive?: string): Promise<HanaPackageReport>;
|
|
16
|
+
export declare class HanaPrepareWriteError extends Error {
|
|
17
|
+
readonly created: string[];
|
|
18
|
+
readonly failed: string;
|
|
19
|
+
constructor(created: string[], failed: string);
|
|
20
|
+
}
|
|
21
|
+
export interface HanaPrepareDependencies {
|
|
22
|
+
registry?: EnvironmentRegistry;
|
|
23
|
+
processes?: ProcessBackend;
|
|
24
|
+
}
|
|
25
|
+
export interface HanaDeployDependencies extends HanaPrepareDependencies {
|
|
26
|
+
platform?: NodeJS.Platform;
|
|
27
|
+
arch?: string;
|
|
28
|
+
}
|
|
29
|
+
/** Prepare the pinned pair only; does not configure or install a Wyn provider. */
|
|
30
|
+
export declare function prepareWindowsHana(name: string, archive?: string, dependencies?: HanaPrepareDependencies): Promise<{
|
|
31
|
+
name: string;
|
|
32
|
+
directory: string;
|
|
33
|
+
files: string[];
|
|
34
|
+
status: "prepared";
|
|
35
|
+
configured: boolean;
|
|
36
|
+
installed: boolean;
|
|
37
|
+
loadability: "unverified";
|
|
38
|
+
}>;
|
|
39
|
+
export declare class HanaDeployWriteError extends Error {
|
|
40
|
+
readonly created: string[];
|
|
41
|
+
readonly failed: string;
|
|
42
|
+
constructor(created: string[], failed: string);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Deploy the pinned managed and native files to the two Windows locations used by Wyn.
|
|
46
|
+
* The deployed files are not a complete installation: the provider stays unconfigured, plugin
|
|
47
|
+
* precedence and the native search path are not verified here, and a restart is required.
|
|
48
|
+
*/
|
|
49
|
+
export declare function deployWindowsHana(name: string, archive?: string, dependencies?: HanaDeployDependencies): Promise<{
|
|
50
|
+
name: string;
|
|
51
|
+
files: string[];
|
|
52
|
+
status: "deployed";
|
|
53
|
+
configured: boolean;
|
|
54
|
+
installed: boolean;
|
|
55
|
+
loadability: "unverified";
|
|
56
|
+
restartRequired: true;
|
|
57
|
+
}>;
|
|
58
|
+
//# sourceMappingURL=hana.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hana.d.ts","sourceRoot":"","sources":["../../src/environment/hana.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,cAAc,EAAyB,MAAM,WAAW,CAAC;AAGlE,8FAA8F;AAC9F,eAAO,MAAM,4BAA4B,qEAAqE,CA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