mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-08 09:14:10 +00:00
chore(lint): enable stricter oxlint rules
This commit is contained in:
@@ -913,7 +913,7 @@ describe("hardenApprovedExecutionPaths", () => {
|
||||
withFakeRuntimeBins({
|
||||
binNames: ["pnpm", "eslint"],
|
||||
run: () => {
|
||||
const cases = [
|
||||
const casesResult = [
|
||||
{
|
||||
prefix: "openclaw-pnpm-dlx-package-bin-",
|
||||
command: ["pnpm", "dlx", "cowsay", "hello"],
|
||||
@@ -942,7 +942,7 @@ describe("hardenApprovedExecutionPaths", () => {
|
||||
},
|
||||
},
|
||||
];
|
||||
for (const testCase of cases) {
|
||||
for (const testCase of casesResult) {
|
||||
const tmp = createFixtureDir(testCase.prefix);
|
||||
testCase.setup?.(tmp);
|
||||
expectApprovalPlanWithoutMutableOperand(testCase.command, tmp);
|
||||
@@ -975,7 +975,7 @@ describe("hardenApprovedExecutionPaths", () => {
|
||||
});
|
||||
|
||||
it("captures the real shell script operand after value-taking shell flags", () => {
|
||||
const cases = [
|
||||
const casesValue = [
|
||||
{
|
||||
name: "separate set option",
|
||||
argv: ["/bin/bash", "-o", "errexit", "./run.sh"],
|
||||
@@ -1020,7 +1020,7 @@ describe("hardenApprovedExecutionPaths", () => {
|
||||
},
|
||||
];
|
||||
|
||||
for (const testCase of cases) {
|
||||
for (const testCase of casesValue) {
|
||||
runNamedCase(testCase.name, () => {
|
||||
const tmp = createFixtureDir("openclaw-shell-option-value-");
|
||||
const scriptPath = path.join(tmp, "run.sh");
|
||||
@@ -1055,7 +1055,7 @@ describe("hardenApprovedExecutionPaths", () => {
|
||||
});
|
||||
|
||||
it("captures fish script operands with plus-prefixed filenames", () => {
|
||||
const cases = [
|
||||
const casesLocal = [
|
||||
{
|
||||
name: "plus-prefixed fish script",
|
||||
argv: ["fish", "+setup.fish"],
|
||||
@@ -1066,7 +1066,7 @@ describe("hardenApprovedExecutionPaths", () => {
|
||||
},
|
||||
];
|
||||
|
||||
for (const testCase of cases) {
|
||||
for (const testCase of casesLocal) {
|
||||
runNamedCase(testCase.name, () => {
|
||||
const tmp = createFixtureDir("openclaw-fish-plus-script-");
|
||||
const scriptPath = path.join(tmp, "+setup.fish");
|
||||
|
||||
@@ -316,16 +316,16 @@ describe("handleSystemRunInvoke mac app exec host routing", () => {
|
||||
run: (ctx: { tempHome: string }) => Promise<T>;
|
||||
}): Promise<T> {
|
||||
const tempHome = sharedOpenClawHome;
|
||||
const previousOpenClawHome = process.env.OPENCLAW_HOME;
|
||||
const previousOpenClawHomeLocal = process.env.OPENCLAW_HOME;
|
||||
process.env.OPENCLAW_HOME = tempHome;
|
||||
saveExecApprovals(params.approvals);
|
||||
try {
|
||||
return await params.run({ tempHome });
|
||||
} finally {
|
||||
if (previousOpenClawHome === undefined) {
|
||||
if (previousOpenClawHomeLocal === undefined) {
|
||||
delete process.env.OPENCLAW_HOME;
|
||||
} else {
|
||||
process.env.OPENCLAW_HOME = previousOpenClawHome;
|
||||
process.env.OPENCLAW_HOME = previousOpenClawHomeLocal;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1143,7 +1143,7 @@ describe("handleSystemRunInvoke mac app exec host routing", () => {
|
||||
const sendInvokeResult = vi.fn(async () => {});
|
||||
await withPathTokenCommand({
|
||||
tmpPrefix: "openclaw-allowlist-path-pin-",
|
||||
run: async ({ link, expected }) => {
|
||||
run: async ({ link: _link, expected }) => {
|
||||
await withTempApprovalsHome({
|
||||
approvals: {
|
||||
version: 1,
|
||||
|
||||
@@ -265,9 +265,9 @@ async function handleSystemWhich(params: SystemWhichParams, env?: Record<string,
|
||||
const bins = normalizeStringEntries(params.bins);
|
||||
const found: Record<string, string> = {};
|
||||
for (const bin of bins) {
|
||||
const path = resolveExecutable(bin, env);
|
||||
if (path) {
|
||||
found[bin] = path;
|
||||
const pathLocal = resolveExecutable(bin, env);
|
||||
if (pathLocal) {
|
||||
found[bin] = pathLocal;
|
||||
}
|
||||
}
|
||||
return { bins: found };
|
||||
|
||||
Reference in New Issue
Block a user