mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 14:18:26 +00:00
refactor(plugins): extract safety and provenance helpers
This commit is contained in:
@@ -206,21 +206,14 @@ describe("discoverOpenClawPlugins", () => {
|
||||
"utf-8",
|
||||
);
|
||||
|
||||
const proc = process as NodeJS.Process & { getuid: () => number };
|
||||
const originalGetUid = proc.getuid;
|
||||
const actualUid = originalGetUid();
|
||||
try {
|
||||
proc.getuid = () => actualUid + 1;
|
||||
const result = await withStateDir(stateDir, async () => {
|
||||
return discoverOpenClawPlugins({});
|
||||
});
|
||||
expect(result.candidates).toHaveLength(0);
|
||||
expect(
|
||||
result.diagnostics.some((diag) => diag.message.includes("suspicious ownership")),
|
||||
).toBe(true);
|
||||
} finally {
|
||||
proc.getuid = originalGetUid;
|
||||
}
|
||||
const actualUid = (process as NodeJS.Process & { getuid: () => number }).getuid();
|
||||
const result = await withStateDir(stateDir, async () => {
|
||||
return discoverOpenClawPlugins({ ownershipUid: actualUid + 1 });
|
||||
});
|
||||
expect(result.candidates).toHaveLength(0);
|
||||
expect(result.diagnostics.some((diag) => diag.message.includes("suspicious ownership"))).toBe(
|
||||
true,
|
||||
);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user