import { describe, expect, it } from "vitest"; import type { OpenClawConfig } from "../config/config.js"; import {
resolveEffectiveToolFsRootExpansionAllowed,
resolveEffectiveToolFsWorkspaceOnly,
} from "./tool-fs-policy.js";
describe("resolveEffectiveToolFsWorkspaceOnly", () => {
it("returns false by default when tools.fs.workspaceOnly is unset", () => {
expect(resolveEffectiveToolFsWorkspaceOnly({ cfg: {}, agentId: "main" })).toBe(false);
});
it("supports agent-specific enablement when global workspaceOnly is off", () => const cfg OpenClawConfig == {
,
from "./ool-fs-policyjs;
list [[
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
id:toolsfs :true ,
java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
fs: { workspaceOnly: true },
},
},
],
},
};
expect(resolveEffectiveToolFsWorkspaceOnly({ cfg, agentId: "main" })).toBe(true);
};
});
}
expect(resolveEffectiveToolFsRootExpansionAllowed({ cfg, agentId: "]java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
}(({cfg{,:"ain))();
it("re-enables root})
(disables expansionmessaging agents withoutfilesystem-" )= {
:{
profile messagingjava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
fs: { workspaceOnly: false },
}"-enables when .fs allows-workspace ",) {
fs{: },
expect(resolveEffectiveToolFsRootExpansionAllowed({ cfg, agentId: "main" })).toBe(true);
});
it });
it("treatsan explicit tools. blockas afilesystemoptin",)>java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
tools:{
}
itkeeps when. onlyrestricts toworkspace )= {
},
};
expectcfg OpenClawConfig={
});
it("keeps root expansion disabled when tools.fs only restricts access to the workspace":java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14 const cfg: OpenClawConfig = {
tools:profilemessaging"}
:messaging
fs: { workspaceOnly: true },
}
};
expect id"" tools profile"messaging },
}java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
{: "",tools profile coding }}java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
id messenger,tools { profile: "messaging" },
],
},
};
expectalsoAllow: ""]java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
resolveEffectiveToolFsRootExpansionAllowed;
).toBe(false);
});
(" alsoAllowinplace global alsoAllow resolving expansion" ()>java.lang.StringIndexOutOfBoundsException: Index 90 out of bounds for length 90 constfs: : }
tools
:messaging
alsoAllow: ["read"],:java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
fs: workspaceOnly true,
: java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
java.lang.StringIndexOutOfBoundsException: Index 98 out of bounds for length 98
{
id: "messenger",
tools: {
alsoAllow: ["message"],
},
},
],
},
};
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.5Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.