mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 10:01:24 +00:00
refactor: rename to openclaw
This commit is contained in:
@@ -18,12 +18,12 @@ const expectPerms = (actual: number, expected: number) => {
|
||||
|
||||
describe("security fix", () => {
|
||||
it("tightens groupPolicy + filesystem perms", async () => {
|
||||
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-security-fix-"));
|
||||
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-security-fix-"));
|
||||
const stateDir = path.join(tmp, "state");
|
||||
await fs.mkdir(stateDir, { recursive: true });
|
||||
await fs.chmod(stateDir, 0o755);
|
||||
|
||||
const configPath = path.join(stateDir, "moltbot.json");
|
||||
const configPath = path.join(stateDir, "openclaw.json");
|
||||
await fs.writeFile(
|
||||
configPath,
|
||||
`${JSON.stringify(
|
||||
@@ -54,8 +54,8 @@ describe("security fix", () => {
|
||||
|
||||
const env = {
|
||||
...process.env,
|
||||
CLAWDBOT_STATE_DIR: stateDir,
|
||||
CLAWDBOT_CONFIG_PATH: "",
|
||||
OPENCLAW_STATE_DIR: stateDir,
|
||||
OPENCLAW_CONFIG_PATH: "",
|
||||
};
|
||||
|
||||
const res = await fixSecurityFootguns({ env });
|
||||
@@ -90,11 +90,11 @@ describe("security fix", () => {
|
||||
});
|
||||
|
||||
it("applies allowlist per-account and seeds WhatsApp groupAllowFrom from store", async () => {
|
||||
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-security-fix-"));
|
||||
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-security-fix-"));
|
||||
const stateDir = path.join(tmp, "state");
|
||||
await fs.mkdir(stateDir, { recursive: true });
|
||||
|
||||
const configPath = path.join(stateDir, "moltbot.json");
|
||||
const configPath = path.join(stateDir, "openclaw.json");
|
||||
await fs.writeFile(
|
||||
configPath,
|
||||
`${JSON.stringify(
|
||||
@@ -123,8 +123,8 @@ describe("security fix", () => {
|
||||
|
||||
const env = {
|
||||
...process.env,
|
||||
CLAWDBOT_STATE_DIR: stateDir,
|
||||
CLAWDBOT_CONFIG_PATH: "",
|
||||
OPENCLAW_STATE_DIR: stateDir,
|
||||
OPENCLAW_CONFIG_PATH: "",
|
||||
};
|
||||
|
||||
const res = await fixSecurityFootguns({ env });
|
||||
@@ -140,11 +140,11 @@ describe("security fix", () => {
|
||||
});
|
||||
|
||||
it("does not seed WhatsApp groupAllowFrom if allowFrom is set", async () => {
|
||||
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-security-fix-"));
|
||||
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-security-fix-"));
|
||||
const stateDir = path.join(tmp, "state");
|
||||
await fs.mkdir(stateDir, { recursive: true });
|
||||
|
||||
const configPath = path.join(stateDir, "moltbot.json");
|
||||
const configPath = path.join(stateDir, "openclaw.json");
|
||||
await fs.writeFile(
|
||||
configPath,
|
||||
`${JSON.stringify(
|
||||
@@ -169,8 +169,8 @@ describe("security fix", () => {
|
||||
|
||||
const env = {
|
||||
...process.env,
|
||||
CLAWDBOT_STATE_DIR: stateDir,
|
||||
CLAWDBOT_CONFIG_PATH: "",
|
||||
OPENCLAW_STATE_DIR: stateDir,
|
||||
OPENCLAW_CONFIG_PATH: "",
|
||||
};
|
||||
|
||||
const res = await fixSecurityFootguns({ env });
|
||||
@@ -183,19 +183,19 @@ describe("security fix", () => {
|
||||
});
|
||||
|
||||
it("returns ok=false for invalid config but still tightens perms", async () => {
|
||||
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-security-fix-"));
|
||||
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-security-fix-"));
|
||||
const stateDir = path.join(tmp, "state");
|
||||
await fs.mkdir(stateDir, { recursive: true });
|
||||
await fs.chmod(stateDir, 0o755);
|
||||
|
||||
const configPath = path.join(stateDir, "moltbot.json");
|
||||
const configPath = path.join(stateDir, "openclaw.json");
|
||||
await fs.writeFile(configPath, "{ this is not json }\n", "utf-8");
|
||||
await fs.chmod(configPath, 0o644);
|
||||
|
||||
const env = {
|
||||
...process.env,
|
||||
CLAWDBOT_STATE_DIR: stateDir,
|
||||
CLAWDBOT_CONFIG_PATH: "",
|
||||
OPENCLAW_STATE_DIR: stateDir,
|
||||
OPENCLAW_CONFIG_PATH: "",
|
||||
};
|
||||
|
||||
const res = await fixSecurityFootguns({ env });
|
||||
@@ -209,7 +209,7 @@ describe("security fix", () => {
|
||||
});
|
||||
|
||||
it("tightens perms for credentials + agent auth/sessions + include files", async () => {
|
||||
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-security-fix-"));
|
||||
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-security-fix-"));
|
||||
const stateDir = path.join(tmp, "state");
|
||||
await fs.mkdir(stateDir, { recursive: true });
|
||||
|
||||
@@ -219,7 +219,7 @@ describe("security fix", () => {
|
||||
await fs.writeFile(includePath, "{ logging: { redactSensitive: 'off' } }\n", "utf-8");
|
||||
await fs.chmod(includePath, 0o644);
|
||||
|
||||
const configPath = path.join(stateDir, "moltbot.json");
|
||||
const configPath = path.join(stateDir, "openclaw.json");
|
||||
await fs.writeFile(
|
||||
configPath,
|
||||
`{ "$include": "./includes/extra.json5", channels: { whatsapp: { groupPolicy: "open" } } }\n`,
|
||||
@@ -251,8 +251,8 @@ describe("security fix", () => {
|
||||
|
||||
const env = {
|
||||
...process.env,
|
||||
CLAWDBOT_STATE_DIR: stateDir,
|
||||
CLAWDBOT_CONFIG_PATH: "",
|
||||
OPENCLAW_STATE_DIR: stateDir,
|
||||
OPENCLAW_CONFIG_PATH: "",
|
||||
};
|
||||
|
||||
const res = await fixSecurityFootguns({ env });
|
||||
|
||||
Reference in New Issue
Block a user