fix: resolve read-only review followups

This commit is contained in:
Gustavo Madeira Santana
2026-04-20 20:20:26 -04:00
parent a7f0ae9c07
commit 3ff4a374a0
2 changed files with 13 additions and 9 deletions

View File

@@ -1,7 +1,17 @@
import { createScopedDmSecurityResolver } from "openclaw/plugin-sdk/channel-config-helpers";
import type { ChannelPlugin } from "openclaw/plugin-sdk/channel-core";
import { createAllowlistProviderRouteAllowlistWarningCollector } from "openclaw/plugin-sdk/channel-policy";
import type { ResolvedTelegramAccount } from "./accounts.js";
import { collectTelegramSecurityAuditFindings } from "./security-audit.js";
const resolveTelegramDmPolicy = createScopedDmSecurityResolver<ResolvedTelegramAccount>({
channelKey: "telegram",
resolvePolicy: (account) => account.config.dmPolicy,
resolveAllowFrom: (account) => account.config.allowFrom,
policyPathSuffix: "dmPolicy",
normalizeEntry: (raw) => raw.replace(/^(telegram|tg):/i, ""),
});
const collectTelegramSecurityWarnings =
createAllowlistProviderRouteAllowlistWarningCollector<ResolvedTelegramAccount>({
providerConfigPresent: (cfg) => cfg.channels?.telegram !== undefined,
@@ -24,13 +34,7 @@ const collectTelegramSecurityWarnings =
});
export const telegramSecurityAdapter = {
dm: {
channelKey: "telegram",
resolvePolicy: (account: ResolvedTelegramAccount) => account.config.dmPolicy,
resolveAllowFrom: (account: ResolvedTelegramAccount) => account.config.allowFrom,
policyPathSuffix: "dmPolicy",
normalizeEntry: (raw: string) => raw.replace(/^(telegram|tg):/i, ""),
},
resolveDmPolicy: resolveTelegramDmPolicy,
collectWarnings: collectTelegramSecurityWarnings,
collectAuditFindings: collectTelegramSecurityAuditFindings,
};
} satisfies NonNullable<ChannelPlugin<ResolvedTelegramAccount>["security"]>;

View File

@@ -135,7 +135,7 @@ export function listReadOnlyChannelPluginsForConfig(
workspaceDir,
env,
cache: options.cache,
includePersistedAuthState: options.includePersistedAuthState,
includePersistedAuthState: options.includePersistedAuthState ?? false,
manifestRecords: externalManifestRecords,
}),
),