openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
20 lines (19 loc) • 929 B
JavaScript
import { C as resolveIsNixMode } from "./paths-DAcAg5aV.mjs";
import { a as pluginCacheRealpathSync } from "./plugin-cache-files-e1aGp2KM.mjs";
import path from "node:path";
//#region src/plugins/hardlink-policy.ts
/** Enforces plugin root hardlink policy with bundled and immutable Nix-store exceptions. */
const NIX_STORE_ROOT = "/nix/store";
/** Returns true when a plugin root resolves inside the immutable Nix store. */
function isNixStorePluginRoot(e) {
const t = pluginCacheRealpathSync(e) ?? path.resolve(e);
return t === NIX_STORE_ROOT || t.startsWith(`${NIX_STORE_ROOT}/`);
}
/** Decides whether plugin file hardlinks should fail boundary validation for one root. */
function shouldRejectHardlinkedPluginFiles(e) {
if (e.origin === "bundled") return false;
if (resolveIsNixMode(e.env) && isNixStorePluginRoot(e.rootDir)) return false;
return true;
}
//#endregion
export { shouldRejectHardlinkedPluginFiles as t };