Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(desktop): 公证密码直接传值,去掉 --password @env: 间接 (#276)

guyong-zapo3add55e19b82
diff --git a/apps/desktop/scripts/ci/lib.mjs b/apps/desktop/scripts/ci/lib.mjs
index 924c15e56d..46bee4746d 100644
--- a/apps/desktop/scripts/ci/lib.mjs
+++ b/apps/desktop/scripts/ci/lib.mjs
@@ -632,19 +632,44 @@ export function notarizeMacApp(appPath, identity) {
exec(`/usr/bin/ditto -c -k --keepParent "${appPath}" "${zipPath}"`);
console.log(' Submitting to Apple notarization service (this may take a few minutes)...');
- // 密码不进 argv:notarytool 支持 --password @env:VAR,从子进程 env 读取——
- // 公证等待期间 ps 里只看得到 env 名,不再暴露 app-specific password;
- // 日志回显的命令也天然无密码,无需打码。
- const submitCmd =
- `/usr/bin/xcrun notarytool submit "${zipPath}" ` +
- `--apple-id "${identity.appleId}" --password "@env:CINDY_NOTARY_PASSWORD" ` +
- `--team-id "${identity.teamId}" --wait`;
- console.log(` $ ${submitCmd}`);
- execSync(submitCmd, {
+ // 密码作为 --password 值直接传给 notarytool——不再用 --password @env:VAR 间接:
+ // 旧版 notarytool 不认 @env: 前缀,会把字面量 "@env:..." 当密码本身发出去而 401。
+ // 走 spawnSync 参数数组:避免 shell 参与(无插值/无注入面),且日志回显时对密码
+ // 打码(credentials 规则:输出不得含凭证明文)。
+ // 注意暴露面:密码仍作为 xcrun 的明文 argv 传入,--wait 期间(最长 30min)同机同
+ // 用户进程经 ps/proc 仍可读到——构建机为受控单租户环境,取此权衡;若需彻底消除
+ // argv 暴露,后续可改用 notarytool 的 --keychain-profile(@keychain: 凭据)。
+ const submitArgs = [
+ 'notarytool',
+ 'submit',
+ zipPath,
+ '--apple-id',
+ identity.appleId,
+ '--password',
+ identity.applePassword,
+ '--team-id',
+ identity.teamId,
+ '--wait',
+ ];
+ console.log(
+ ` $ /usr/bin/xcrun notarytool submit "${zipPath}" ` +
+ `--apple-id "${identity.appleId}" --password "****" --team-id "${identity.teamId}" --wait`,
+ );
+ const submitResult = spawnSync('/usr/bin/xcrun', submitArgs, {
stdio: 'inherit',
timeout: 1800000, // 30 min
- env: { ...process.env, CINDY_NOTARY_PASSWORD: identity.applePassword },
});
+ if (submitResult.error) {
+ throw new Error(`notarytool submit 无法执行:${submitResult.error.message}`);
+ }
+ if (submitResult.signal) {
+ // 被信号终止(如 30min 超时 kill → SIGTERM):status 为 null,单看 exit 会显示
+ // "exit null",这里显式报出 signal 便于定位。
+ throw new Error(`notarytool submit 被信号 ${submitResult.signal} 终止(可能公证超时);公证未通过。`);
+ }
+ if (submitResult.status !== 0) {
+ throw new Error(`notarytool submit 失败(exit ${submitResult.status});公证未通过。`);
+ }
fs.unlinkSync(zipPath);