惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

IT之家
IT之家
腾讯CDC
博客园 - Franky
S
SegmentFault 最新的问题
美团技术团队
阮一峰的网络日志
阮一峰的网络日志
J
Java Code Geeks
Y
Y Combinator Blog
Engineering at Meta
Engineering at Meta
Microsoft Security Blog
Microsoft Security Blog
MongoDB | Blog
MongoDB | Blog
I
InfoQ
T
Tailwind CSS Blog
Hugging Face - Blog
Hugging Face - Blog
B
Blog RSS Feed
博客园 - 叶小钗
博客园_首页
有赞技术团队
有赞技术团队
雷峰网
雷峰网
量子位
小众软件
小众软件
月光博客
月光博客
U
Unit 42
D
DataBreaches.Net

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
test(mac): exercise codesign entitlement use · openclaw/o...
vincentkoc · 2026-06-02 · via Recent Commits to openclaw:main
11

import { spawnSync } from "node:child_process";

2-

import { mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync } from "node:fs";

2+

import {

3+

chmodSync,

4+

existsSync,

5+

mkdirSync,

6+

mkdtempSync,

7+

readFileSync,

8+

readdirSync,

9+

rmSync,

10+

writeFileSync,

11+

} from "node:fs";

312

import { tmpdir } from "node:os";

413

import path from "node:path";

514

import { afterEach, describe, expect, it } from "vitest";

@@ -28,6 +37,50 @@ function runCodesign(args: string[], tempRoot: string) {

2837

});

2938

}

303940+

function installFakeCodesign(binDir: string) {

41+

const fakeCodesign = path.join(binDir, "codesign");

42+

writeFileSync(

43+

fakeCodesign,

44+

`#!/usr/bin/env bash

45+

set -euo pipefail

46+47+

entitlements=""

48+

target=""

49+

while [ "$#" -gt 0 ]; do

50+

case "$1" in

51+

--entitlements)

52+

shift

53+

entitlements="$1"

54+

;;

55+

esac

56+

target="$1"

57+

shift || true

58+

done

59+60+

if [ -z "$target" ]; then

61+

echo "missing codesign target" >&2

62+

exit 2

63+

fi

64+65+

if [ -n "$entitlements" ]; then

66+

count_file="$CODESIGN_CAPTURE_DIR/count"

67+

count=0

68+

if [ -f "$count_file" ]; then

69+

count="$(cat "$count_file")"

70+

fi

71+

count=$((count + 1))

72+

printf '%s' "$count" >"$count_file"

73+

copy="$CODESIGN_CAPTURE_DIR/entitlements-$count.plist"

74+

cp "$entitlements" "$copy"

75+

printf 'entitled\\t%s\\t%s\\t%s\\n' "$target" "$entitlements" "$copy" >>"$CODESIGN_LOG"

76+

else

77+

printf 'plain\\t%s\\n' "$target" >>"$CODESIGN_LOG"

78+

fi

79+

`,

80+

);

81+

chmodSync(fakeCodesign, 0o755);

82+

}

83+3184

afterEach(() => {

3285

for (const dir of tempDirs.splice(0)) {

3386

rmSync(dir, { recursive: true, force: true });

@@ -82,4 +135,48 @@ describe("codesign-mac-app temp file hygiene", () => {

82135

expect(result.status).not.toBe(0);

83136

expect(entitlementTemps(tempRoot)).toEqual([]);

84137

});

138+139+

it("passes generated app entitlements to signing commands and cleans them", () => {

140+

const tempRoot = makeTempDir("openclaw-codesign-success-");

141+

const app = path.join(tempRoot, "Fake.app");

142+

const binDir = path.join(tempRoot, "bin");

143+

const captureDir = path.join(tempRoot, "capture");

144+

const logPath = path.join(captureDir, "codesign.log");

145+

mkdirSync(path.join(app, "Contents", "MacOS"), { recursive: true });

146+

mkdirSync(binDir);

147+

mkdirSync(captureDir);

148+

writeFileSync(path.join(app, "Contents", "MacOS", "OpenClaw"), "#!/bin/sh\n");

149+

installFakeCodesign(binDir);

150+151+

const result = spawnSync("bash", [scriptPath, app], {

152+

cwd: process.cwd(),

153+

encoding: "utf8",

154+

env: {

155+

...process.env,

156+

CODESIGN_CAPTURE_DIR: captureDir,

157+

CODESIGN_LOG: logPath,

158+

PATH: `${binDir}${path.delimiter}${process.env.PATH ?? ""}`,

159+

SIGN_IDENTITY: "-",

160+

SKIP_TEAM_ID_CHECK: "1",

161+

TMPDIR: tempRoot,

162+

},

163+

});

164+165+

expect(result.status).toBe(0);

166+

expect(result.stdout).toContain(`Codesign complete for ${app}`);

167+168+

const signLines = readFileSync(logPath, "utf8").trim().split("\n");

169+

expect(signLines).toHaveLength(2);

170+

expect(signLines[0]).toContain(`${path.join(app, "Contents", "MacOS", "OpenClaw")}\t`);

171+

expect(signLines[1]).toContain(`${app}\t`);

172+

for (const line of signLines) {

173+

const [, , entitlementPath, copiedEntitlementsPath] = line.split("\t");

174+

const copiedEntitlements = readFileSync(copiedEntitlementsPath, "utf8");

175+

expect(entitlementPath).toContain("openclaw-entitlements");

176+

expect(existsSync(entitlementPath)).toBe(false);

177+

expect(copiedEntitlements).toContain("com.apple.security.automation.apple-events");

178+

expect(copiedEntitlements).toContain("com.apple.security.device.camera");

179+

}

180+

expect(entitlementTemps(tempRoot)).toEqual([]);

181+

});

85182

});