perf(secrets): drop bootstrap fallback from target registry

This commit is contained in:
Vincent Koc
2026-04-07 08:46:16 +01:00
parent 86361f4fca
commit a543c240c9
4 changed files with 11 additions and 24 deletions

View File

@@ -0,0 +1 @@
// Intentionally empty: Line does not expose runtime secret-contract surfaces.

View File

@@ -0,0 +1 @@
// Intentionally empty: Signal does not expose runtime secret-contract surfaces.

View File

@@ -0,0 +1 @@
// Intentionally empty: Zalo User does not expose runtime secret-contract surfaces.

View File

@@ -1,5 +1,4 @@
import { iterateBootstrapChannelPlugins } from "../channels/plugins/bootstrap-registry.js";
import { listBundledPluginMetadata } from "../plugins/bundled-plugin-metadata.js";
import { loadPluginManifestRegistry } from "../plugins/manifest-registry.js";
import { loadBundledChannelSecretContractApi } from "./channel-contract-api.js";
import type { SecretTargetRegistryEntry } from "./target-registry-types.js";
@@ -8,37 +7,22 @@ const SIBLING_REF_SHAPE = "sibling_ref"; // pragma: allowlist secret
function listChannelSecretTargetRegistryEntries(): SecretTargetRegistryEntry[] {
const entries: SecretTargetRegistryEntry[] = [];
const handledChannelIds = new Set<string>();
for (const metadata of listBundledPluginMetadata({
includeChannelConfigs: false,
includeSyntheticChannelConfigs: false,
})) {
const channelIds = metadata.manifest.channels ?? [];
for (const record of loadPluginManifestRegistry({}).plugins) {
if (record.origin !== "bundled") {
continue;
}
const channelIds = record.channels;
if (channelIds.length === 0) {
continue;
}
if (!metadata.publicSurfaceArtifacts?.includes("contract-api.js")) {
if (!metadata.publicSurfaceArtifacts?.includes("secret-contract-api.js")) {
continue;
}
}
try {
const contractApi = loadBundledChannelSecretContractApi(metadata.manifest.id);
const contractApi = loadBundledChannelSecretContractApi(record.id);
entries.push(...(contractApi?.secretTargetRegistryEntries ?? []));
channelIds.forEach((channelId) => handledChannelIds.add(channelId));
} catch {
// Fall back to the full bootstrap plugin surface for channels that do not
// expose a usable secret contract artifact.
// Ignore bundled channels that do not expose a usable secret contract artifact.
}
}
for (const plugin of iterateBootstrapChannelPlugins()) {
if (handledChannelIds.has(plugin.id)) {
continue;
}
entries.push(...(plugin.secrets?.secretTargetRegistryEntries ?? []));
}
return entries;
}