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

推荐订阅源

云风的 BLOG
云风的 BLOG
M
MIT News - Artificial intelligence
博客园 - Franky
J
Java Code Geeks
V
Visual Studio Blog
G
Google Developers Blog
罗磊的独立博客
MongoDB | Blog
MongoDB | Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Recent Announcements
Recent Announcements
Last Week in AI
Last Week in AI
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Stack Overflow Blog
Stack Overflow Blog
博客园 - 司徒正美
The GitHub Blog
The GitHub Blog
腾讯CDC
阮一峰的网络日志
阮一峰的网络日志
V
V2EX
博客园 - 【当耐特】
IT之家
IT之家
I
InfoQ
U
Unit 42
C
Check Point Blog
Martin Fowler
Martin Fowler

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: sandbox audit-exec-surface under HOME tempdir (#798...
omarshahine · 2026-05-10 · via Recent Commits to openclaw:main

@@ -1,4 +1,7 @@

1-

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

1+

import fs from "node:fs/promises";

2+

import os from "node:os";

3+

import path from "node:path";

4+

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

25

import type { OpenClawConfig } from "../config/config.js";

36

import { saveExecApprovals } from "../infra/exec-approvals.js";

47

import { collectExecRuntimeFindings } from "./audit.js";

@@ -27,11 +30,61 @@ function requireFinding(

2730

return finding;

2831

}

293230-

afterEach(() => {

31-

saveExecApprovals({ version: 1, agents: {} });

32-

});

33-3433

describe("security audit exec surface findings", () => {

34+

// Redirect the OpenClaw home (OPENCLAW_HOME wins over HOME/USERPROFILE in

35+

// `resolveRawHomeDir`) to a per-test tempdir so `saveExecApprovals` never

36+

// touches the real `~/.openclaw/exec-approvals.json` on the host running

37+

// the suite.

38+

let previousOpenClawHome: string | undefined;

39+

let previousHome: string | undefined;

40+

let previousUserProfile: string | undefined;

41+

let tempRoot = "";

42+

let tempCaseIndex = 0;

43+44+

beforeAll(async () => {

45+

tempRoot = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-exec-approvals-"));

46+

});

47+48+

beforeEach(async () => {

49+

previousOpenClawHome = process.env.OPENCLAW_HOME;

50+

previousHome = process.env.HOME;

51+

previousUserProfile = process.env.USERPROFILE;

52+

const tempDir = path.join(tempRoot, `case-${++tempCaseIndex}`);

53+

await fs.mkdir(path.join(tempDir, ".openclaw"), { recursive: true });

54+

// OPENCLAW_HOME takes precedence over HOME/USERPROFILE in resolveRawHomeDir,

55+

// so all three must point at the tempdir to neutralize whichever the host

56+

// happens to have set.

57+

process.env.OPENCLAW_HOME = tempDir;

58+

process.env.HOME = tempDir;

59+

// Windows uses USERPROFILE for os.homedir()

60+

process.env.USERPROFILE = tempDir;

61+

});

62+63+

afterEach(() => {

64+

saveExecApprovals({ version: 1, agents: {} });

65+

if (previousOpenClawHome === undefined) {

66+

delete process.env.OPENCLAW_HOME;

67+

} else {

68+

process.env.OPENCLAW_HOME = previousOpenClawHome;

69+

}

70+

if (previousHome === undefined) {

71+

delete process.env.HOME;

72+

} else {

73+

process.env.HOME = previousHome;

74+

}

75+

if (previousUserProfile === undefined) {

76+

delete process.env.USERPROFILE;

77+

} else {

78+

process.env.USERPROFILE = previousUserProfile;

79+

}

80+

});

81+82+

afterAll(async () => {

83+

if (tempRoot) {

84+

await fs.rm(tempRoot, { recursive: true, force: true, maxRetries: 5, retryDelay: 20 });

85+

}

86+

});

87+3588

it("warns when exec approvals enable autoAllowSkills", () => {

3689

saveExecApprovals({

3790

version: 1,