mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 05:10:44 +00:00
fix(secrets): stabilize credential matrix docs
This commit is contained in:
@@ -90,6 +90,8 @@ Scope intent:
|
||||
- `channels.feishu.accounts.*.appSecret`
|
||||
- `channels.feishu.accounts.*.encryptKey`
|
||||
- `channels.feishu.accounts.*.verificationToken`
|
||||
- `channels.qqbot.clientSecret`
|
||||
- `channels.qqbot.accounts.*.clientSecret`
|
||||
- `channels.msteams.appPassword`
|
||||
- `channels.mattermost.botToken`
|
||||
- `channels.mattermost.accounts.*.botToken`
|
||||
|
||||
@@ -281,6 +281,20 @@
|
||||
"secretShape": "secret_input",
|
||||
"optIn": true
|
||||
},
|
||||
{
|
||||
"id": "channels.qqbot.accounts.*.clientSecret",
|
||||
"configFile": "openclaw.json",
|
||||
"path": "channels.qqbot.accounts.*.clientSecret",
|
||||
"secretShape": "secret_input",
|
||||
"optIn": true
|
||||
},
|
||||
{
|
||||
"id": "channels.qqbot.clientSecret",
|
||||
"configFile": "openclaw.json",
|
||||
"path": "channels.qqbot.clientSecret",
|
||||
"secretShape": "secret_input",
|
||||
"optIn": true
|
||||
},
|
||||
{
|
||||
"id": "channels.slack.accounts.*.appToken",
|
||||
"configFile": "openclaw.json",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { listSecretTargetRegistryEntries } from "./target-registry.js";
|
||||
import { getSourceSecretTargetRegistry } from "./target-registry-data.js";
|
||||
import { getUnsupportedSecretRefSurfacePatterns } from "./unsupported-surface-policy.js";
|
||||
|
||||
type CredentialMatrixEntry = {
|
||||
@@ -22,7 +22,7 @@ export type SecretRefCredentialMatrixDocument = {
|
||||
};
|
||||
|
||||
export function buildSecretRefCredentialMatrix(): SecretRefCredentialMatrixDocument {
|
||||
const entries: CredentialMatrixEntry[] = listSecretTargetRegistryEntries()
|
||||
const entries: CredentialMatrixEntry[] = getSourceSecretTargetRegistry()
|
||||
.map((entry) => {
|
||||
const isCanonicalFirecrawlWebFetchEntry =
|
||||
entry.id === "plugins.entries.firecrawl.config.webFetch.apiKey";
|
||||
|
||||
@@ -441,6 +441,25 @@ const CORE_SECRET_TARGET_REGISTRY: SecretTargetRegistryEntry[] = [
|
||||
|
||||
let cachedSecretTargetRegistry: SecretTargetRegistryEntry[] | null = null;
|
||||
|
||||
function loadSecretTargetRegistryFromPluginMetadata(params: {
|
||||
env: NodeJS.ProcessEnv;
|
||||
preferPersisted?: boolean;
|
||||
}): SecretTargetRegistryEntry[] {
|
||||
const plugins = loadPluginMetadataSnapshot({
|
||||
config: {},
|
||||
env: params.env,
|
||||
...(params.preferPersisted !== undefined ? { preferPersisted: params.preferPersisted } : {}),
|
||||
}).plugins;
|
||||
const bundledPlugins = plugins.filter((record) => record.origin === "bundled");
|
||||
const channelPlugins = plugins.filter((record) => record.channels.length > 0);
|
||||
return [
|
||||
...CORE_SECRET_TARGET_REGISTRY,
|
||||
...listBundledWebProviderSecretTargetRegistryEntries(bundledPlugins),
|
||||
...listBundledPluginConfigSecretTargetRegistryEntries(bundledPlugins),
|
||||
...listChannelSecretTargetRegistryEntries(channelPlugins),
|
||||
];
|
||||
}
|
||||
|
||||
export function getCoreSecretTargetRegistry(): SecretTargetRegistryEntry[] {
|
||||
return CORE_SECRET_TARGET_REGISTRY;
|
||||
}
|
||||
@@ -449,17 +468,18 @@ export function getSecretTargetRegistry(): SecretTargetRegistryEntry[] {
|
||||
if (cachedSecretTargetRegistry) {
|
||||
return cachedSecretTargetRegistry;
|
||||
}
|
||||
const plugins = loadPluginMetadataSnapshot({
|
||||
config: {},
|
||||
cachedSecretTargetRegistry = loadSecretTargetRegistryFromPluginMetadata({
|
||||
env: process.env,
|
||||
}).plugins;
|
||||
const bundledPlugins = plugins.filter((record) => record.origin === "bundled");
|
||||
const channelPlugins = plugins.filter((record) => record.channels.length > 0);
|
||||
cachedSecretTargetRegistry = [
|
||||
...CORE_SECRET_TARGET_REGISTRY,
|
||||
...listBundledWebProviderSecretTargetRegistryEntries(bundledPlugins),
|
||||
...listBundledPluginConfigSecretTargetRegistryEntries(bundledPlugins),
|
||||
...listChannelSecretTargetRegistryEntries(channelPlugins),
|
||||
];
|
||||
});
|
||||
return cachedSecretTargetRegistry;
|
||||
}
|
||||
|
||||
export function getSourceSecretTargetRegistry(): SecretTargetRegistryEntry[] {
|
||||
return loadSecretTargetRegistryFromPluginMetadata({
|
||||
env: {
|
||||
...process.env,
|
||||
OPENCLAW_BUNDLED_PLUGINS_DIR: process.env.OPENCLAW_BUNDLED_PLUGINS_DIR ?? "extensions",
|
||||
},
|
||||
preferPersisted: false,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user