larkin 0.2.80 → 0.2.81
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,5 +1,6 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
+
import { isWindows } from "../platform/secure-metadata.mjs";
|
|
3
4
|
import { callbackCapability, documentCommentReplyCapability, documentCommentSubscriptionCapability, } from "../platform/callback-capability.mjs";
|
|
4
5
|
const BOT_CREDENTIAL_FIELDS = new Set(["appId", "appSecret", "tenant", "ownerOpenId", "createdAt", "updatedAt", "capabilities"]);
|
|
5
6
|
function validDocumentCommentCapability(value) {
|
|
@@ -50,7 +51,8 @@ export function validCredentialRecord(value, appId) {
|
|
|
50
51
|
return true;
|
|
51
52
|
}
|
|
52
53
|
function isOwnedWithExactMode(stat, mode) {
|
|
53
|
-
return (typeof process.getuid !== "function" || stat.uid === process.getuid())
|
|
54
|
+
return (typeof process.getuid !== "function" || stat.uid === process.getuid())
|
|
55
|
+
&& (isWindows || (stat.mode & 0o777) === mode);
|
|
54
56
|
}
|
|
55
57
|
export function assertSecureBotsDirectory(botsDir) {
|
|
56
58
|
const stat = fs.lstatSync(botsDir);
|
|
@@ -6,6 +6,7 @@ import fs from "node:fs";
|
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import readline from "node:readline";
|
|
8
8
|
import { fileURLToPath } from "node:url";
|
|
9
|
+
import { isWindows } from "../platform/secure-metadata.mjs";
|
|
9
10
|
import { TargetRootLayout } from "../platform/root-layout.mjs";
|
|
10
11
|
import { planSingleRootBinding } from "./setup-binding.mjs";
|
|
11
12
|
import { discoverPiModelCatalog } from "../runtime/pi-model-catalog.mjs";
|
|
@@ -126,7 +127,7 @@ function readSetupSelection(fileArg) {
|
|
|
126
127
|
const stat = fs.lstatSync(file);
|
|
127
128
|
if (!stat.isFile() || stat.isSymbolicLink()
|
|
128
129
|
|| (typeof process.getuid === "function" && stat.uid !== process.getuid())
|
|
129
|
-
|| (stat.mode & 0o777) !== 0o600)
|
|
130
|
+
|| (!isWindows && (stat.mode & 0o777) !== 0o600))
|
|
130
131
|
die("setup Agent 选择文件必须是当前用户拥有的 0600 普通文件");
|
|
131
132
|
const bytes = fs.readFileSync(file, "utf8");
|
|
132
133
|
fs.unlinkSync(file);
|