mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 07:12:42 +00:00
chore: migrate to oxlint and oxfmt
Co-authored-by: Christoph Nakazawa <christoph.pojer@gmail.com>
This commit is contained in:
@@ -20,13 +20,9 @@ export async function noteSecurityWarnings(cfg: ClawdbotConfig) {
|
||||
}) => {
|
||||
const dmPolicy = params.dmPolicy;
|
||||
const policyPath = params.policyPath ?? `${params.allowFromPath}policy`;
|
||||
const configAllowFrom = (params.allowFrom ?? []).map((v) =>
|
||||
String(v).trim(),
|
||||
);
|
||||
const configAllowFrom = (params.allowFrom ?? []).map((v) => String(v).trim());
|
||||
const hasWildcard = configAllowFrom.includes("*");
|
||||
const storeAllowFrom = await readChannelAllowFromStore(
|
||||
params.provider,
|
||||
).catch(() => []);
|
||||
const storeAllowFrom = await readChannelAllowFromStore(params.provider).catch(() => []);
|
||||
const normalizedCfg = configAllowFrom
|
||||
.filter((v) => v !== "*")
|
||||
.map((v) => (params.normalizeEntry ? params.normalizeEntry(v) : v))
|
||||
@@ -36,15 +32,11 @@ export async function noteSecurityWarnings(cfg: ClawdbotConfig) {
|
||||
.map((v) => (params.normalizeEntry ? params.normalizeEntry(v) : v))
|
||||
.map((v) => v.trim())
|
||||
.filter(Boolean);
|
||||
const allowCount = Array.from(
|
||||
new Set([...normalizedCfg, ...normalizedStore]),
|
||||
).length;
|
||||
const allowCount = Array.from(new Set([...normalizedCfg, ...normalizedStore])).length;
|
||||
|
||||
if (dmPolicy === "open") {
|
||||
const allowFromPath = `${params.allowFromPath}allowFrom`;
|
||||
warnings.push(
|
||||
`- ${params.label} DMs: OPEN (${policyPath}="open"). Anyone can DM it.`,
|
||||
);
|
||||
warnings.push(`- ${params.label} DMs: OPEN (${policyPath}="open"). Anyone can DM it.`);
|
||||
if (!hasWildcard) {
|
||||
warnings.push(
|
||||
`- ${params.label} DMs: config invalid — "open" requires ${allowFromPath} to include "*".`,
|
||||
@@ -54,9 +46,7 @@ export async function noteSecurityWarnings(cfg: ClawdbotConfig) {
|
||||
}
|
||||
|
||||
if (dmPolicy === "disabled") {
|
||||
warnings.push(
|
||||
`- ${params.label} DMs: disabled (${policyPath}="disabled").`,
|
||||
);
|
||||
warnings.push(`- ${params.label} DMs: disabled (${policyPath}="disabled").`);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -77,9 +67,7 @@ export async function noteSecurityWarnings(cfg: ClawdbotConfig) {
|
||||
accountIds,
|
||||
});
|
||||
const account = plugin.config.resolveAccount(cfg, defaultAccountId);
|
||||
const enabled = plugin.config.isEnabled
|
||||
? plugin.config.isEnabled(account, cfg)
|
||||
: true;
|
||||
const enabled = plugin.config.isEnabled ? plugin.config.isEnabled(account, cfg) : true;
|
||||
if (!enabled) continue;
|
||||
const configured = plugin.config.isConfigured
|
||||
? await plugin.config.isConfigured(account, cfg)
|
||||
|
||||
Reference in New Issue
Block a user