branding: default to clawdis paths and launchd label

This commit is contained in:
Peter Steinberger
2025-12-04 18:01:30 +00:00
parent 9797a9993a
commit 916a41ed60
12 changed files with 36 additions and 27 deletions

View File

@@ -22,7 +22,9 @@ afterEach(() => {
describe("ipc hardening", () => {
it("creates private socket dir and socket with tight perms", async () => {
const tmpHome = fs.mkdtempSync(path.join(os.tmpdir(), "warelay-home-"));
const tmpHome = fs.mkdtempSync(path.join(os.tmpdir(), "clawdis-home-"));
const clawdisDir = path.join(tmpHome, ".clawdis");
fs.mkdirSync(clawdisDir, { recursive: true });
process.env.HOME = tmpHome;
vi.resetModules();
@@ -31,7 +33,7 @@ describe("ipc hardening", () => {
const sendHandler = vi.fn().mockResolvedValue({ messageId: "msg1" });
ipc.startIpcServer(sendHandler);
const dirStat = fs.lstatSync(path.join(tmpHome, ".warelay", "ipc"));
const dirStat = fs.lstatSync(path.join(tmpHome, ".clawdis", "ipc"));
expect(dirStat.mode & 0o777).toBe(0o700);
expect(ipc.isRelayRunning()).toBe(true);
@@ -47,10 +49,10 @@ describe("ipc hardening", () => {
});
it("refuses to start when IPC dir is a symlink", async () => {
const tmpHome = fs.mkdtempSync(path.join(os.tmpdir(), "warelay-home-"));
const warelayDir = path.join(tmpHome, ".warelay");
fs.mkdirSync(warelayDir, { recursive: true });
fs.symlinkSync("/tmp", path.join(warelayDir, "ipc"));
const tmpHome = fs.mkdtempSync(path.join(os.tmpdir(), "clawdis-home-"));
const clawdisDir = path.join(tmpHome, ".clawdis");
fs.mkdirSync(clawdisDir, { recursive: true });
fs.symlinkSync("/tmp", path.join(clawdisDir, "ipc"));
process.env.HOME = tmpHome;
vi.resetModules();

View File

@@ -10,12 +10,12 @@
import fs from "node:fs";
import net from "node:net";
import os from "node:os";
import path from "node:path";
import { getChildLogger } from "../logging.js";
import { CONFIG_DIR } from "../utils.js";
const SOCKET_DIR = path.join(os.homedir(), ".warelay", "ipc");
const SOCKET_DIR = path.join(CONFIG_DIR, "ipc");
const SOCKET_PATH = path.join(SOCKET_DIR, "relay.sock");
export interface IpcSendRequest {

View File

@@ -1,7 +1,6 @@
import { randomUUID } from "node:crypto";
import fsSync from "node:fs";
import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import {
DisconnectReason,
@@ -17,14 +16,10 @@ import { danger, info, success } from "../globals.js";
import { getChildLogger } from "../logging.js";
import { defaultRuntime, type RuntimeEnv } from "../runtime.js";
import type { Provider } from "../utils.js";
import { ensureDir, jidToE164 } from "../utils.js";
import { CONFIG_DIR, ensureDir, jidToE164 } from "../utils.js";
import { VERSION } from "../version.js";
export const WA_WEB_AUTH_DIR = path.join(
os.homedir(),
".warelay",
"credentials",
);
export const WA_WEB_AUTH_DIR = path.join(CONFIG_DIR, "credentials");
/**
* Create a Baileys socket backed by the multi-file auth store we keep on disk.