mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 04:17:42 +00:00
refactor: rename clawdbot to moltbot with legacy compat
This commit is contained in:
@@ -3,7 +3,7 @@ import path from "node:path";
|
||||
|
||||
import JSON5 from "json5";
|
||||
|
||||
import type { ClawdbotConfig, ConfigFileSnapshot } from "../config/config.js";
|
||||
import type { MoltbotConfig, ConfigFileSnapshot } from "../config/config.js";
|
||||
import { createConfigIO } from "../config/config.js";
|
||||
import { resolveNativeSkillsEnabled } from "../config/commands.js";
|
||||
import { resolveOAuthDir } from "../config/paths.js";
|
||||
@@ -48,7 +48,7 @@ function expandTilde(p: string, env: NodeJS.ProcessEnv): string | null {
|
||||
return null;
|
||||
}
|
||||
|
||||
function summarizeGroupPolicy(cfg: ClawdbotConfig): {
|
||||
function summarizeGroupPolicy(cfg: MoltbotConfig): {
|
||||
open: number;
|
||||
allowlist: number;
|
||||
other: number;
|
||||
@@ -69,7 +69,7 @@ function summarizeGroupPolicy(cfg: ClawdbotConfig): {
|
||||
return { open, allowlist, other };
|
||||
}
|
||||
|
||||
export function collectAttackSurfaceSummaryFindings(cfg: ClawdbotConfig): SecurityAuditFinding[] {
|
||||
export function collectAttackSurfaceSummaryFindings(cfg: MoltbotConfig): SecurityAuditFinding[] {
|
||||
const group = summarizeGroupPolicy(cfg);
|
||||
const elevated = cfg.tools?.elevated?.enabled !== false;
|
||||
const hooksEnabled = cfg.hooks?.enabled === true;
|
||||
@@ -116,7 +116,7 @@ export function collectSyncedFolderFindings(params: {
|
||||
severity: "warn",
|
||||
title: "State/config path looks like a synced folder",
|
||||
detail: `stateDir=${params.stateDir}, configPath=${params.configPath}. Synced folders (iCloud/Dropbox/OneDrive/Google Drive) can leak tokens and transcripts onto other devices.`,
|
||||
remediation: `Keep CLAWDBOT_STATE_DIR on a local-only volume and re-run "${formatCliCommand("clawdbot security audit --fix")}".`,
|
||||
remediation: `Keep CLAWDBOT_STATE_DIR on a local-only volume and re-run "${formatCliCommand("moltbot security audit --fix")}".`,
|
||||
});
|
||||
}
|
||||
return findings;
|
||||
@@ -127,7 +127,7 @@ function looksLikeEnvRef(value: string): boolean {
|
||||
return v.startsWith("${") && v.endsWith("}");
|
||||
}
|
||||
|
||||
export function collectSecretsInConfigFindings(cfg: ClawdbotConfig): SecurityAuditFinding[] {
|
||||
export function collectSecretsInConfigFindings(cfg: MoltbotConfig): SecurityAuditFinding[] {
|
||||
const findings: SecurityAuditFinding[] = [];
|
||||
const password =
|
||||
typeof cfg.gateway?.auth?.password === "string" ? cfg.gateway.auth.password.trim() : "";
|
||||
@@ -157,7 +157,7 @@ export function collectSecretsInConfigFindings(cfg: ClawdbotConfig): SecurityAud
|
||||
return findings;
|
||||
}
|
||||
|
||||
export function collectHooksHardeningFindings(cfg: ClawdbotConfig): SecurityAuditFinding[] {
|
||||
export function collectHooksHardeningFindings(cfg: MoltbotConfig): SecurityAuditFinding[] {
|
||||
const findings: SecurityAuditFinding[] = [];
|
||||
if (cfg.hooks?.enabled !== true) return findings;
|
||||
|
||||
@@ -215,7 +215,7 @@ function addModel(models: ModelRef[], raw: unknown, source: string) {
|
||||
models.push({ id, source });
|
||||
}
|
||||
|
||||
function collectModels(cfg: ClawdbotConfig): ModelRef[] {
|
||||
function collectModels(cfg: MoltbotConfig): ModelRef[] {
|
||||
const out: ModelRef[] = [];
|
||||
addModel(out, cfg.agents?.defaults?.model?.primary, "agents.defaults.model.primary");
|
||||
for (const f of cfg.agents?.defaults?.model?.fallbacks ?? [])
|
||||
@@ -283,7 +283,7 @@ function isClaude45OrHigher(id: string): boolean {
|
||||
return /\bclaude-[^\s/]*?(?:-4-5\b|4\.5\b)/i.test(id);
|
||||
}
|
||||
|
||||
export function collectModelHygieneFindings(cfg: ClawdbotConfig): SecurityAuditFinding[] {
|
||||
export function collectModelHygieneFindings(cfg: MoltbotConfig): SecurityAuditFinding[] {
|
||||
const findings: SecurityAuditFinding[] = [];
|
||||
const models = collectModels(cfg);
|
||||
if (models.length === 0) return findings;
|
||||
@@ -378,7 +378,7 @@ function pickToolPolicy(config?: { allow?: string[]; deny?: string[] }): Sandbox
|
||||
}
|
||||
|
||||
function resolveToolPolicies(params: {
|
||||
cfg: ClawdbotConfig;
|
||||
cfg: MoltbotConfig;
|
||||
agentTools?: AgentToolsConfig;
|
||||
sandboxMode?: "off" | "non-main" | "all";
|
||||
agentId?: string | null;
|
||||
@@ -402,7 +402,7 @@ function resolveToolPolicies(params: {
|
||||
return policies;
|
||||
}
|
||||
|
||||
function hasWebSearchKey(cfg: ClawdbotConfig, env: NodeJS.ProcessEnv): boolean {
|
||||
function hasWebSearchKey(cfg: MoltbotConfig, env: NodeJS.ProcessEnv): boolean {
|
||||
const search = cfg.tools?.web?.search;
|
||||
return Boolean(
|
||||
search?.apiKey ||
|
||||
@@ -413,20 +413,20 @@ function hasWebSearchKey(cfg: ClawdbotConfig, env: NodeJS.ProcessEnv): boolean {
|
||||
);
|
||||
}
|
||||
|
||||
function isWebSearchEnabled(cfg: ClawdbotConfig, env: NodeJS.ProcessEnv): boolean {
|
||||
function isWebSearchEnabled(cfg: MoltbotConfig, env: NodeJS.ProcessEnv): boolean {
|
||||
const enabled = cfg.tools?.web?.search?.enabled;
|
||||
if (enabled === false) return false;
|
||||
if (enabled === true) return true;
|
||||
return hasWebSearchKey(cfg, env);
|
||||
}
|
||||
|
||||
function isWebFetchEnabled(cfg: ClawdbotConfig): boolean {
|
||||
function isWebFetchEnabled(cfg: MoltbotConfig): boolean {
|
||||
const enabled = cfg.tools?.web?.fetch?.enabled;
|
||||
if (enabled === false) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
function isBrowserEnabled(cfg: ClawdbotConfig): boolean {
|
||||
function isBrowserEnabled(cfg: MoltbotConfig): boolean {
|
||||
try {
|
||||
return resolveBrowserConfig(cfg.browser, cfg).enabled;
|
||||
} catch {
|
||||
@@ -435,7 +435,7 @@ function isBrowserEnabled(cfg: ClawdbotConfig): boolean {
|
||||
}
|
||||
|
||||
export function collectSmallModelRiskFindings(params: {
|
||||
cfg: ClawdbotConfig;
|
||||
cfg: MoltbotConfig;
|
||||
env: NodeJS.ProcessEnv;
|
||||
}): SecurityAuditFinding[] {
|
||||
const findings: SecurityAuditFinding[] = [];
|
||||
@@ -514,7 +514,7 @@ export function collectSmallModelRiskFindings(params: {
|
||||
}
|
||||
|
||||
export async function collectPluginsTrustFindings(params: {
|
||||
cfg: ClawdbotConfig;
|
||||
cfg: MoltbotConfig;
|
||||
stateDir: string;
|
||||
}): Promise<SecurityAuditFinding[]> {
|
||||
const findings: SecurityAuditFinding[] = [];
|
||||
@@ -747,7 +747,7 @@ export async function collectIncludeFilePermFindings(params: {
|
||||
}
|
||||
|
||||
export async function collectStateDeepFilesystemFindings(params: {
|
||||
cfg: ClawdbotConfig;
|
||||
cfg: MoltbotConfig;
|
||||
env: NodeJS.ProcessEnv;
|
||||
stateDir: string;
|
||||
platform?: NodeJS.Platform;
|
||||
@@ -902,7 +902,7 @@ export async function collectStateDeepFilesystemFindings(params: {
|
||||
return findings;
|
||||
}
|
||||
|
||||
function listGroupPolicyOpen(cfg: ClawdbotConfig): string[] {
|
||||
function listGroupPolicyOpen(cfg: MoltbotConfig): string[] {
|
||||
const out: string[] = [];
|
||||
const channels = cfg.channels as Record<string, unknown> | undefined;
|
||||
if (!channels || typeof channels !== "object") return out;
|
||||
@@ -923,7 +923,7 @@ function listGroupPolicyOpen(cfg: ClawdbotConfig): string[] {
|
||||
return out;
|
||||
}
|
||||
|
||||
export function collectExposureMatrixFindings(cfg: ClawdbotConfig): SecurityAuditFinding[] {
|
||||
export function collectExposureMatrixFindings(cfg: MoltbotConfig): SecurityAuditFinding[] {
|
||||
const findings: SecurityAuditFinding[] = [];
|
||||
const openGroups = listGroupPolicyOpen(cfg);
|
||||
if (openGroups.length === 0) return findings;
|
||||
|
||||
Reference in New Issue
Block a user