Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): bind connection auth to trusted market installs
chenhong6168d5de954c
diff --git a/apps/desktop/src/main/cindy-brain/__tests__/connectionAudienceResolver.test.ts b/apps/desktop/src/main/cindy-brain/__tests__/connectionAudienceResolver.test.tsindex 53730e7609..d4ab8b7b28 100644--- a/apps/desktop/src/main/cindy-brain/__tests__/connectionAudienceResolver.test.ts+++ b/apps/desktop/src/main/cindy-brain/__tests__/connectionAudienceResolver.test.ts@@ -1,5 +1,9 @@import { describe, expect, it } from 'vitest';import type { GhostManifest } from '../../../shared/ghost.js';+import {+ ghostManifestDigest,+ type PluginMarketInstallationRecord,+} from '../../plugin-market/ledger.js';import {isConnectionSecretReady,loadConnectionAudienceResolver,@@ -33,13 +37,40 @@ const manifest: GhostManifest = {const identity = {membershipId: 'membership-1',membershipKind: 'org' as const,+ orgId: 'org-id-1',orgSlug: 'org-example',};+const marketInstallation: PluginMarketInstallationRecord = {+ pluginId: 'plugin-market-1',+ ghostId: manifest.id,+ releaseId: 'release-1',+ version: manifest.version,+ sha256: 'a'.repeat(64),+ scope: 'organization',+ organizationId: identity.orgId,+ source: 'market',+ installed: true,+ updatedAt: '2026-08-04T00:00:00.000Z',+ manifestDigest: ghostManifestDigest(manifest),+};++function resolverOptions(+ installedManifest: GhostManifest | null = manifest,+ installation: PluginMarketInstallationRecord | null = marketInstallation,+) {+ return {+ readInstalledManifest: () => installedManifest,+ readInstalledManifestDigest: () =>+ installedManifest ? ghostManifestDigest(installedManifest) : null,+ readMarketInstallation: () => installation,+ };+}+describe('installed Plugin Connection audience resolver', () => {it('derives audience and hosts from the installed manifest and current organization', () => {const resolver = loadConnectionAudienceResolver({- readInstalledManifest: (ghostId) => (ghostId === manifest.id ? manifest : null),+ ...resolverOptions(),});expect(resolver.resolve('plugin-a', identity)).toEqual({membershipId: 'membership-1',@@ -49,35 +80,58 @@ describe('installed Plugin Connection audience resolver', () => {});});- it('does not require Market provenance or a development trust file', () => {- const resolver = loadConnectionAudienceResolver({- readInstalledManifest: () => manifest,- });- expect(resolver.resolve('plugin-a', identity)?.audience).toBe('org-example:plugin-a');+ it('requires a current organization market installation record', () => {+ const resolver = loadConnectionAudienceResolver(+ resolverOptions(manifest, { ...marketInstallation, source: 'local-market' }),+ );+ expect(resolver.resolve('plugin-a', identity)).toBeNull();++ expect(+ loadConnectionAudienceResolver(+ resolverOptions(manifest, { ...marketInstallation, scope: 'public', organizationId: null }),+ ).resolve('plugin-a', identity),+ ).toBeNull();+ expect(+ loadConnectionAudienceResolver(+ resolverOptions(manifest, { ...marketInstallation, organizationId: 'org-other' }),+ ).resolve('plugin-a', identity),+ ).toBeNull();+ expect(+ loadConnectionAudienceResolver(+ resolverOptions(manifest, { ...marketInstallation, manifestDigest: undefined }),+ ).resolve('plugin-a', identity),+ ).toBeNull();+ });++ it('rejects a changed installed manifest digest', () => {+ const changedManifest = { ...manifest, version: '2.0.0' };+ const resolver = loadConnectionAudienceResolver(resolverOptions(changedManifest));+ expect(resolver.resolve('plugin-a', identity)).toBeNull();});it('requires an organization identity and an installed oidc-token declaration', () => {const resolver = loadConnectionAudienceResolver({- readInstalledManifest: (ghostId) => (ghostId === manifest.id ? manifest : null),+ ...resolverOptions(),});expect(resolver.resolve('plugin-a', {membershipId: 'membership-1',membershipKind: 'personal',+ orgId: null,orgSlug: null,}),).toBeNull();expect(resolver.resolve('plugin-b', identity)).toBeNull();expect(loadConnectionAudienceResolver({- readInstalledManifest: () => ({ ...manifest, network: { hosts: ['service-a.x.test'] } }),+ ...resolverOptions({ ...manifest, network: { hosts: ['service-a.x.test'] } }),}).resolve('plugin-a', identity),).toBeNull();});it('requires the managed secret target to match a declared exact host', () => {const resolver = loadConnectionAudienceResolver({- readInstalledManifest: () => manifest,+ ...resolverOptions(),});const resolution = resolver.resolve('plugin-a', identity);expect(isConnectionSecretReady(['service-a.x.test'], resolution)).toBe(true);diff --git a/apps/desktop/src/main/cindy-brain/connectionAudienceResolver.ts b/apps/desktop/src/main/cindy-brain/connectionAudienceResolver.tsindex f9e5123017..0e79f9f10f 100644--- a/apps/desktop/src/main/cindy-brain/connectionAudienceResolver.ts+++ b/apps/desktop/src/main/cindy-brain/connectionAudienceResolver.ts@@ -1,14 +1,16 @@/**- * Host-owned Connection audience resolution. Plugins declare where the managed- * token is injected, while the Host derives the audience from the current- * organization and the installed plugin id.+ * Host-owned Connection audience resolution. Only organization-scoped Plugin+ * Market installs with an intact manifest may receive a token; the Host derives+ * the audience from the current organization and the installed plugin id.*/import { isValidGhostId, isValidGhostNetworkHostPattern } from '../../shared/ghost.js';import type { GhostManifest } from '../../shared/ghost.js';+import type { PluginMarketInstallationRecord } from '../plugin-market/ledger.js';export interface ConnectionAudienceIdentity {membershipId: string;membershipKind: 'personal' | 'org';+ orgId: string | null;orgSlug: string | null;}@@ -39,6 +41,8 @@ export function isConnectionSecretReady(export interface LoadConnectionAudienceResolverOptions {readInstalledManifest(ghostId: string): GhostManifest | null;+ readInstalledManifestDigest(ghostId: string): string | null;+ readMarketInstallation(ghostId: string): PluginMarketInstallationRecord | null;log?: {info: (msg: string, meta?: Record<string, unknown>) => void;warn: (msg: string, meta?: Record<string, unknown>) => void;@@ -62,10 +66,31 @@ export function loadConnectionAudienceResolver(}if (identity.membershipKind !== 'org') return reject('membership-not-org');if (!identity.membershipId) return reject('membership-id-empty');+ if (!identity.orgId) return reject('org-id-unavailable');if (!identity.orgSlug || !ORG_SLUG_RE.test(identity.orgSlug)) {return reject('org-slug-unavailable');}+ let installation: PluginMarketInstallationRecord | null = null;+ try {+ installation = options.readMarketInstallation(ghostId);+ } catch {+ return reject('market-installation-read-failed');+ }+ if (!installation || !installation.installed) {+ return reject('market-installation-missing');+ }+ if (installation.source !== 'market') return reject('market-installation-untrusted');+ if (installation.scope !== 'organization') {+ return reject('market-installation-not-organization');+ }+ if (installation.organizationId !== identity.orgId) {+ return reject('market-installation-org-mismatch');+ }+ if (!installation.manifestDigest) {+ return reject('market-manifest-digest-missing');+ }+let manifest: GhostManifest | null = null;try {manifest = options.readInstalledManifest(ghostId);@@ -74,6 +99,15 @@ export function loadConnectionAudienceResolver(}if (!manifest) return reject('plugin-not-installed');if (manifest.id !== ghostId) return reject('plugin-id-mismatch');+ let installedManifestDigest: string | null = null;+ try {+ installedManifestDigest = options.readInstalledManifestDigest(ghostId);+ } catch {+ return reject('installed-manifest-digest-read-failed');+ }+ if (installedManifestDigest !== installation.manifestDigest) {+ return reject('installed-manifest-digest-mismatch');+ }const allowedHosts = [...new Set(diff --git a/apps/desktop/src/main/cindy-brain/forge.ts b/apps/desktop/src/main/cindy-brain/forge.tsindex f7a113a2b0..0236e03583 100644--- a/apps/desktop/src/main/cindy-brain/forge.ts+++ b/apps/desktop/src/main/cindy-brain/forge.ts@@ -2111,13 +2111,14 @@ BroadcastChannel、日志或任何自存路径(review 必查)。凭证只会注PUT/DELETE 一律 405(派生身份不可配置)。**Cindy 企业身份断言(source:"oidc-token",可选)**:适用于接入 Cindy Connection-Auth 的企业服务。主机只在当前登录账号属于组织 Membership、且该插件已安装并声明了目标服务域名时,+Auth 的企业服务。主机只在当前登录账号属于组织 Membership、且该插件拥有当前组织的+Plugin Market organization 安装记录、安装 manifest digest 未被篡改并声明了目标服务域名时,按需向 auth-server 换取短时 Connection JWT;audience 与组织身份由主机推导,插件清单和运行时代码都不能选择、读取或保存 audience/token。该凭证必须固定声明\`"inject": { "header": "Authorization", "format": "Bearer {value}", "hosts": [...] }\`,且 \`hosts\` 必须是非空的显式子集,只允许把断言发给列出的企业服务域名。\`oidc-token\` 的 \`inject.hosts\` 只接受精确域名,不允许 \`*.example.com\` 通配;Host-会从当前已安装插件 manifest 读取这些声明,目标请求必须精确命中声明域名才会签发并注入。+会从通过 digest 校验的市场 manifest 读取这些声明,目标请求必须精确命中声明域名才会签发并注入。它没有用户输入、\`url\`、\`exchange\` 或 \`oauth\` 详单,也不要放进 \`setup.requires\`;没有企业身份时 cindy.fetch 会 fail-closed 并返回结构化错误。企业服务应使用 Connection JWT中的 \`sub\`、\`email\` 或 \`identities\` 等声明自行选择业务身份,不要要求 Cindy 客户端先把diff --git a/apps/desktop/src/main/cindy-brain/index.ts b/apps/desktop/src/main/cindy-brain/index.tsindex 7dce500bfd..2bcb86743d 100644--- a/apps/desktop/src/main/cindy-brain/index.ts+++ b/apps/desktop/src/main/cindy-brain/index.ts@@ -11,6 +11,8 @@ import {GHOST_CARD_HEIGHT_DEFAULT,GHOST_CARD_HEIGHT_MAX,GHOST_CARD_HEIGHT_MIN,+ GHOST_INSTALL_MANIFEST_MAX_BYTES,+ GHOST_MANIFEST_FILE,GHOST_NETWORK_MAX_CONNECTIONS_PER_DECL,GHOST_NOTIFY_MIN_INTERVAL_MS,diffGhostPermissionItems,@@ -20,6 +22,7 @@ import {isOfficialGhostId,isValidGhostId,layoutWithGhostPanel,+ validateGhostManifest,type GhostHostNoticeKey,type GhostImageAspectRatio,type GhostManifest,@@ -199,6 +202,8 @@ import { GhostFsSlot } from './fsSlot.js';import { getGhostGrantConfirmBridge } from './ghostGrantConfirmBridge.js';import { getSessionFsSnapshot } from '../localDb/ipc/sessions.js';import { getDirDepositVault, getSaveDepositVault, isPathInsideDir } from './dirDeposit.js';+import { readBoundedFileNoFollowSync } from '../utils/readBoundedFile.js';+import { ghostManifestDigest, PluginMarketLedger } from '../plugin-market/ledger.js';import {GhostSubscriptionGateway,GhostActivityTracker,@@ -1660,8 +1665,35 @@ let networkSlotSingleton: GhostNetworkSlot | null = null;let notifySlotSingleton: GhostNotifySlot | null = null;let connectionAudienceResolverSingleton: ConnectionAudienceResolver | null = null;let connectionTokenProviderSingleton: ConnectionTokenProvider | null = null;+let pluginMarketLedgerSingleton: PluginMarketLedger | null = null;-/** Resolve Connection metadata from the currently installed plugin manifest. */+function getPluginMarketLedger(): PluginMarketLedger {+ if (!pluginMarketLedgerSingleton) {+ pluginMarketLedgerSingleton = new PluginMarketLedger(() =>+ ownerScopedUserDataPath('plugin-market', 'ledger.v1.json'),+ );+ }+ return pluginMarketLedgerSingleton;+}++/** Read the locale-independent manifest digest from the installed package. */+function readInstalledGhostManifestDigest(ghostId: string): string | null {+ const ghost = getGhostManager().list().find((candidate) => candidate.manifest.id === ghostId);+ if (!ghost) return null;+ try {+ const bytes = readBoundedFileNoFollowSync(+ path.join(ghost.dir, GHOST_MANIFEST_FILE),+ GHOST_INSTALL_MANIFEST_MAX_BYTES,+ );+ if (bytes === null) return null;+ const validated = validateGhostManifest(JSON.parse(bytes.toString('utf8')) as unknown);+ return validated.ok ? ghostManifestDigest(validated.manifest) : null;+ } catch {+ return null;+ }+}++/** Resolve Connection metadata only from a trusted organization market install. */function getConnectionAudienceResolver(): ConnectionAudienceResolver {if (!connectionAudienceResolverSingleton) {connectionAudienceResolverSingleton = loadConnectionAudienceResolver({@@ -1669,6 +1701,8 @@ function getConnectionAudienceResolver(): ConnectionAudienceResolver {getGhostManager().list().find((candidate) => candidate.manifest.id === ghostId)?.manifest ?? null,+ readInstalledManifestDigest: readInstalledGhostManifestDigest,+ readMarketInstallation: (ghostId) => getPluginMarketLedger().installationForGhost(ghostId),log,});}@@ -1684,6 +1718,7 @@ function resolveConnectionAudienceForGhost(return getConnectionAudienceResolver().resolve(ghostId, {membershipId: user.id,membershipKind: user.membershipKind,+ orgId: user.orgId,orgSlug: user.orgSlug,});}diff --git a/apps/desktop/src/main/plugin-market/__tests__/service.test.ts b/apps/desktop/src/main/plugin-market/__tests__/service.test.tsindex d8bd711687..c5f09d2b1d 100644--- a/apps/desktop/src/main/plugin-market/__tests__/service.test.ts+++ b/apps/desktop/src/main/plugin-market/__tests__/service.test.ts@@ -61,7 +61,7 @@ import type { VisiblePluginDetail, VisiblePluginSummary } from '@cindy/plugin-primport { withGhostInstallLock } from '../../cindy-brain/ghostInstallLock';import { GhostPackagePermissionReviewRequiredError } from '../../cindy-brain/packagePermissionReview';-import { PluginMarketLedger } from '../ledger';+import { ghostManifestDigest, PluginMarketLedger } from '../ledger';import { PluginMarketService } from '../service';import type { PluginMarketApi } from '../api';@@ -371,10 +371,13 @@ describe('PluginMarketService migration and defaultInstall', () => {it('installs and enables a unique defaultInstall package and records its release', async () => {const item = summary({ defaultInstall: true });+ const installDir = fs.mkdtempSync(path.join(os.tmpdir(), 'cindy-market-installed-'));+ roots.push(installDir);+ fs.writeFileSync(path.join(installDir, 'ghost.json'), JSON.stringify(manifest()));runtime.install.mockImplementation(async () => {const ghost = {manifest: manifest(),- dir: '/userData/cindy-brain/cindy-test',+ dir: installDir,enabled: true,};runtime.ghosts = [ghost];@@ -399,7 +402,62 @@ describe('PluginMarketService migration and defaultInstall', () => {expect(h.ledger.installationForGhost('cindy-test')).toMatchObject({source: 'market',releaseId: 'release-1',+ manifestDigest: ghostManifestDigest(manifest()),+ });+ });++ it('backfills a missing digest only for an unchanged current market release', async () => {+ const item = summary({ scope: 'organization', organizationId: 'org-1' });+ const installDir = fs.mkdtempSync(path.join(os.tmpdir(), 'cindy-market-installed-'));+ roots.push(installDir);+ fs.writeFileSync(path.join(installDir, 'ghost.json'), JSON.stringify(manifest()));+ runtime.ghosts = [{ manifest: manifest(), dir: installDir, enabled: true }];+ const h = harness([item]);+ h.ledger.upsertInstallation({+ pluginId: item.id,+ ghostId: item.ghostId,+ releaseId: item.currentRelease.id,+ version: item.currentRelease.version,+ sha256: item.currentRelease.sha256,+ scope: item.scope,+ organizationId: item.organizationId,+ source: 'market',+ installed: true,+ updatedAt: '2026-07-27T00:00:00.000Z',+ });++ await h.service.snapshot();++ expect(h.ledger.installationForGhost(item.ghostId)).toMatchObject({+ source: 'market',+ manifestDigest: ghostManifestDigest(manifest()),+ });+ });++ it('does not backfill provenance when the installed manifest differs', async () => {+ const item = summary({ scope: 'organization', organizationId: 'org-1' });+ const changedManifest = manifest('cindy-test', '1.0.0', ['notify', 'fs']);+ const installDir = fs.mkdtempSync(path.join(os.tmpdir(), 'cindy-market-installed-'));+ roots.push(installDir);+ fs.writeFileSync(path.join(installDir, 'ghost.json'), JSON.stringify(changedManifest));+ runtime.ghosts = [{ manifest: changedManifest, dir: installDir, enabled: true }];+ const h = harness([item]);+ h.ledger.upsertInstallation({+ pluginId: item.id,+ ghostId: item.ghostId,+ releaseId: item.currentRelease.id,+ version: item.currentRelease.version,+ sha256: item.currentRelease.sha256,+ scope: item.scope,+ organizationId: item.organizationId,+ source: 'market',+ installed: true,+ updatedAt: '2026-07-27T00:00:00.000Z',});++ await h.service.snapshot();++ expect(h.ledger.installationForGhost(item.ghostId)?.manifestDigest).toBeUndefined();});// 2026-07-26 定案:市场首装一律装完即开,手动安装与 defaultInstall 归一,diff --git a/apps/desktop/src/main/plugin-market/service.ts b/apps/desktop/src/main/plugin-market/service.tsindex c0f0720709..6b96ae8a0b 100644--- a/apps/desktop/src/main/plugin-market/service.ts+++ b/apps/desktop/src/main/plugin-market/service.ts@@ -156,8 +156,9 @@ function defaultInstallSubject(owner: ActiveAppSession): string {}function recordFrom(- plugin: VisiblePluginSummary | VisiblePluginDetail,+ plugin: VisiblePluginDetail,source: PluginMarketInstallationRecord['source'],+ manifestDigest?: string | null,): PluginMarketInstallationRecord {return {pluginId: plugin.id,@@ -170,6 +171,9 @@ function recordFrom(source,installed: true,updatedAt: new Date().toISOString(),+ ...(source === 'market' && manifestDigest+ ? { manifestDigest }+ : {}),};}@@ -349,6 +353,7 @@ export class PluginMarketService {// 而列表随后又把它标成 conflict —— 既定事实已经发生。const duplicateGhostIds = combinedDuplicateGhostIds(plugins, customEntries);await this.adoptLegacyInstallations(plugins, ledger, owner);+ await this.migrateMarketManifestDigests(plugins, ledger, owner);await this.reconcileRemovedInstallations(ledger, owner);// 自定义目录不完整(某来源暂时不可读)时跳过全部默认安装:此刻的合并冲突// 集合缺了坏来源声明的 ghostId,自动安装会在它恢复前抢占所有权。@@ -1203,7 +1208,9 @@ export class PluginMarketService {// changes. The bound ledger prevents this write from leaking into the// new owner.await this.withCapturedLedgerMutation(ledger, () => {- ledger.upsertInstallation(recordFrom(plugin, 'market'));+ ledger.upsertInstallation(+ recordFrom(plugin, 'market', installedGhostRawManifestDigest(installed.dir)),+ );});return installed;}),@@ -1294,6 +1301,95 @@ export class PluginMarketService {}}+ /**+ * Backfill the digest added by the trusted-install provenance check without+ * trusting a mutable installed manifest on its own. Only an old market+ * record whose exact release is still current can be migrated, and the+ * installed manifest's canonical digest must match the server manifest.+ * Older or replaced packages stay fail-closed until the user installs a+ * current release.+ */+ private async migrateMarketManifestDigests(+ summaries: readonly VisiblePluginSummary[],+ ledger: PluginMarketLedger,+ owner: ActiveAppSession,+ ): Promise<void> {+ const candidates = Object.values(ledger.read().installations).filter(+ (record) =>+ record.source === 'market' &&+ record.installed &&+ record.manifestDigest === undefined,+ );+ for (const record of candidates) {+ const summary = summaries.find(+ (plugin) =>+ plugin.id === record.pluginId &&+ plugin.ghostId === record.ghostId &&+ plugin.currentRelease.id === record.releaseId &&+ plugin.currentRelease.version === record.version &&+ plugin.currentRelease.sha256 === record.sha256,+ );+ if (!summary) continue;++ let plugin: VisiblePluginDetail;+ try {+ plugin = await this.api.detail(record.pluginId);+ } catch (error) {+ log.warn('market manifest digest migration detail unavailable', {+ ghostId: record.ghostId,+ pluginId: record.pluginId,+ error: error instanceof Error ? error.message : String(error),+ });+ continue;+ }+ requireSameMarketOwner(owner);+ if (+ plugin.ghostId !== record.ghostId ||+ plugin.currentRelease.id !== record.releaseId ||+ plugin.currentRelease.version !== record.version ||+ plugin.currentRelease.sha256 !== record.sha256 ||+ plugin.scope !== record.scope ||+ plugin.organizationId !== record.organizationId+ ) {+ continue;+ }+ const releaseDigest = ghostManifestDigest(plugin.currentRelease.manifest);+ let migrated = false;+ await withGhostInstallLock(record.ghostId, async () => {+ const installed = getGhostManager()+ .list()+ .find((ghost) => ghost.manifest.id === record.ghostId);+ const installedDigest = installed+ ? installedGhostRawManifestDigest(installed.dir)+ : null;+ if (!installedDigest || installedDigest !== releaseDigest) return;+ await this.withLedgerMutation(owner, () => {+ const current = ledger.installationForGhost(record.ghostId);+ if (+ !current ||+ !current.installed ||+ current.source !== 'market' ||+ current.manifestDigest !== undefined ||+ current.pluginId !== record.pluginId ||+ current.releaseId !== record.releaseId ||+ current.sha256 !== record.sha256+ ) {+ return;+ }+ ledger.upsertInstallation({ ...current, manifestDigest: installedDigest });+ migrated = true;+ });+ });+ if (migrated) {+ log.info('migrated market installation manifest digest', {+ ghostId: record.ghostId,+ pluginId: record.pluginId,+ releaseId: record.releaseId,+ });+ }+ }+ }+private async reconcileRemovedInstallations(ledger: PluginMarketLedger,owner: ActiveAppSession,diff --git a/apps/desktop/src/shared/ghost.ts b/apps/desktop/src/shared/ghost.tsindex 65a3af56f2..1511cb360c 100644--- a/apps/desktop/src/shared/ghost.ts+++ b/apps/desktop/src/shared/ghost.ts@@ -731,7 +731,8 @@ export const GHOST_OAUTH_BOUNCE_PATH_RE = /^\/[A-Za-z0-9_-]+(?:\/[A-Za-z0-9_-]+)* 主机跑授权流程并保管全部令牌,出网时现取新鲜 token 注入(见* GhostSecretOauthDecl;必须同时声明 oauth 详单)。* - 'oidc-token':值 = Cindy 为当前企业 Membership 签发的短时 Connection- * JWT。audience 由 Host 根据当前组织和已安装插件 id 推导,插件不能声明或读取;+ * JWT。只有当前组织的 Plugin Market organization 安装记录和 manifest digest+ * 校验通过时,Host 才根据当前组织和插件 id 推导 audience;插件不能声明或读取。* 令牌只在 networkSlot 发请求时注入,且永不进入 Node Worker。** ('login-feishu-token' 已于 2026-07-17 随飞书登录整体下线退役——xd-feishudiff --git a/docs/dev-rules/plugin-security-and-authoring.md b/docs/dev-rules/plugin-security-and-authoring.mdindex b8a47f6a67..a55208acd4 100644--- a/docs/dev-rules/plugin-security-and-authoring.md+++ b/docs/dev-rules/plugin-security-and-authoring.md@@ -75,10 +75,11 @@- network 只允许 manifest 白名单域名;凭证由主机保险库注入,**无明文读回**给沙箱。- `source: "oidc-token"` 是 Host 托管的短时 Cindy Connection JWT:只对当前企业- Membership 生效,audience 由 Host 根据当前组织和插件 id 推导,插件和 Node Worker- 都不能读取或保存令牌。声明必须固定使用 `Authorization: Bearer {value}` 并显式列出- 非空 `inject.hosts`;其中只允许精确域名,不允许通配。实际目标必须精确命中当前安装- 插件 manifest 声明的服务域名才会签发和注入。它没有用户输入、`url`、`exchange` 或+ Membership 生效;只有当前组织的 Plugin Market organization 安装记录仍有效、且+ 安装目录 manifest digest 与记录一致时,Host 才会根据当前组织和插件 id 推导 audience。+ 插件和 Node Worker 都不能读取或保存令牌。声明必须固定使用+ `Authorization: Bearer {value}` 并显式列出非空 `inject.hosts`;其中只允许精确域名,+ 不允许通配。实际目标必须精确命中这份可信 manifest 声明的服务域名才会签发和注入。它没有用户输入、`url`、`exchange` 或`setup.requires` 配置动作。Connection JWT 请求遇到 401 时,仅 GET / HEAD / OPTIONS可自动换令牌重试一次;非幂等请求只作废缓存,不自动重放。- 插件 setup 的完成状态只由 Host 读取真实持久化状态后判定。简单的