Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): allow installed plugins to use connection auth
chenhong24380051662d
diff --git a/apps/desktop/src/main/cindy-brain/__tests__/connectionAudienceResolver.test.ts b/apps/desktop/src/main/cindy-brain/__tests__/connectionAudienceResolver.test.tsindex 4589b02217..53730e7609 100644--- a/apps/desktop/src/main/cindy-brain/__tests__/connectionAudienceResolver.test.ts+++ b/apps/desktop/src/main/cindy-brain/__tests__/connectionAudienceResolver.test.ts@@ -1,54 +1,65 @@import { describe, expect, it } from 'vitest';+import type { GhostManifest } from '../../../shared/ghost.js';import {- loadDevConnectionAudienceResolver,- parseDevConnectionTrustFile,+ isConnectionSecretReady,+ loadConnectionAudienceResolver,} from '../connectionAudienceResolver.js';-const TRUST_FILE = JSON.stringify({- schemaVersion: 1,- plugins: [- {- ghostId: 'plugin-a',- orgSlug: 'org-example',- pluginSlug: 'plugin-a',- hosts: ['service-a.x.test'],- },- {- ghostId: 'plugin-b',- orgSlug: 'org-example',- pluginSlug: 'plugin-b',- hosts: ['service-b.x.test'],- },- ],-});+const manifest: GhostManifest = {+ schemaVersion: 2,+ id: 'plugin-a',+ name: 'Plugin A',+ version: '1.0.0',+ kind: 'chip' as const,+ entry: 'index.js',+ slots: ['network'],+ network: {+ hosts: ['service-a.x.test'],+ secrets: [+ {+ key: 'cindy_identity',+ label: 'Cindy organization identity',+ source: 'oidc-token' as const,+ inject: {+ header: 'Authorization',+ format: 'Bearer {value}',+ hosts: ['service-a.x.test'],+ },+ },+ ],+ },+};-describe('development Connection audience resolver', () => {- it('derives audience only from the trusted ghost/org mapping', () => {- const resolver = loadDevConnectionAudienceResolver({- trustFilePath: '/tmp/connection-trust.json',- isPackaged: false,- desktopDevMode: 'local',- readFile: () => TRUST_FILE,+const identity = {+ membershipId: 'membership-1',+ membershipKind: 'org' as const,+ orgSlug: 'org-example',+};++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),});- expect(- resolver.resolve('plugin-a', {- membershipId: 'membership-1',- membershipKind: 'org',- orgSlug: 'org-example',- }),- ).toEqual({+ expect(resolver.resolve('plugin-a', identity)).toEqual({membershipId: 'membership-1',audience: 'org-example:plugin-a',pluginSlug: 'plugin-a',allowedHosts: ['service-a.x.test'],});- expect(- resolver.resolve('plugin-b', {- membershipId: 'membership-1',- membershipKind: 'org',- orgSlug: 'org-example',- })?.audience,- ).toBe('org-example:plugin-b');+ });++ 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 an organization identity and an installed oidc-token declaration', () => {+ const resolver = loadConnectionAudienceResolver({+ readInstalledManifest: (ghostId) => (ghostId === manifest.id ? manifest : null),+ });expect(resolver.resolve('plugin-a', {membershipId: 'membership-1',@@ -56,78 +67,21 @@ describe('development Connection audience resolver', () => {orgSlug: null,}),).toBeNull();+ expect(resolver.resolve('plugin-b', identity)).toBeNull();expect(- resolver.resolve('plugin-a', {- membershipId: 'membership-1',- membershipKind: 'org',- orgSlug: 'org-other',- }),+ loadConnectionAudienceResolver({+ readInstalledManifest: () => ({ ...manifest, network: { hosts: ['service-a.x.test'] } }),+ }).resolve('plugin-a', identity),).toBeNull();- expect(- resolver.resolve('unknown', {- membershipId: 'membership-1',- membershipKind: 'org',- orgSlug: 'org-example',- }),- ).toBeNull();- });-- it('fails closed for packaged/non-local/relative-path overrides', () => {- const base = {- trustFilePath: '/tmp/connection-trust.json',- desktopDevMode: 'local',- readFile: () => TRUST_FILE,- };- expect(() => loadDevConnectionAudienceResolver({ ...base, isPackaged: true })).toThrow(- /forbidden/,- );- expect(() =>- loadDevConnectionAudienceResolver({- ...base,- isPackaged: false,- desktopDevMode: 'remote',- }),- ).toThrow(/local mode/);- expect(() =>- loadDevConnectionAudienceResolver({- ...base,- trustFilePath: 'relative.json',- isPackaged: false,- }),- ).toThrow(/absolute/);});- it.each([- '{}',- JSON.stringify({ schemaVersion: 2, plugins: [] }),- JSON.stringify({ schemaVersion: 1, plugins: [] }),- JSON.stringify({ schemaVersion: 1, plugins: [{ ghostId: 'Bad_ID', orgSlug: 'org-example', pluginSlug: 'plugin-a' }] }),- JSON.stringify({ schemaVersion: 1, plugins: [{ ghostId: 'plugin-a', orgSlug: 'org-example', pluginSlug: 'Plugin-A' }] }),- JSON.stringify({- schemaVersion: 1,- plugins: [{ ghostId: 'plugin-a', orgSlug: 'org-example', pluginSlug: 'plugin-a', hosts: [] }],- }),- JSON.stringify({- schemaVersion: 1,- plugins: [{ ghostId: 'plugin-a', orgSlug: 'org-example', pluginSlug: 'plugin-a', hosts: ['*.x.test'] }],- }),- JSON.stringify({- schemaVersion: 1,- plugins: [{- ghostId: 'plugin-a',- orgSlug: 'org-example',- pluginSlug: 'plugin-a',- hosts: ['service-a.x.test', 'service-a.x.test'],- }],- }),- JSON.stringify({- schemaVersion: 1,- plugins: [- { ghostId: 'plugin-a', orgSlug: 'org-example', pluginSlug: 'plugin-a', hosts: ['service-a.x.test'] },- { ghostId: 'plugin-a', orgSlug: 'org-example', pluginSlug: 'plugin-b', hosts: ['service-b.x.test'] },- ],- }),- ])('rejects malformed trust input', (raw) => {- expect(() => parseDevConnectionTrustFile(raw)).toThrow();+ it('requires the managed secret target to match a declared exact host', () => {+ const resolver = loadConnectionAudienceResolver({+ readInstalledManifest: () => manifest,+ });+ const resolution = resolver.resolve('plugin-a', identity);+ expect(isConnectionSecretReady(['service-a.x.test'], resolution)).toBe(true);+ expect(isConnectionSecretReady(['service-b.x.test'], resolution)).toBe(false);+ expect(isConnectionSecretReady(['service-a.x.test'], null)).toBe(false);});});diff --git a/apps/desktop/src/main/cindy-brain/__tests__/networkSlot.connection.test.ts b/apps/desktop/src/main/cindy-brain/__tests__/networkSlot.connection.test.tsindex ce8d499646..38abeddcda 100644--- a/apps/desktop/src/main/cindy-brain/__tests__/networkSlot.connection.test.ts+++ b/apps/desktop/src/main/cindy-brain/__tests__/networkSlot.connection.test.ts@@ -98,7 +98,7 @@ describe('networkSlot Connection identity', () => {expect(JSON.stringify(result)).not.toContain('forged-by-plugin');});- it('fails closed when Host provenance does not authorize the plugin', async () => {+ it('fails closed when the audience resolver does not authorize the plugin', async () => {const h = makeSlot({connectionTokens: {resolve: () => null,@@ -114,7 +114,7 @@ describe('networkSlot Connection identity', () => {expect(JSON.stringify(result)).not.toContain('org-example');});- it('fails closed before issuance when the target host is absent from Host provenance', async () => {+ it('fails closed before issuance when the target host is absent from the manifest', async () => {const h = makeSlot({connectionTokens: {resolve: () => ({ ...INPUT, allowedHosts: ['other.x.test'] }),@@ -130,7 +130,7 @@ describe('networkSlot Connection identity', () => {expect(JSON.stringify(result)).not.toContain(INPUT.audience);});- it('blocks a redirect before the second request when its host is not in Host provenance', async () => {+ it('blocks a redirect before the second request when its host is not in the manifest', async () => {const h = makeSlot({getGhost: () =>ghost(@@ -240,7 +240,7 @@ describe('networkSlot Connection identity', () => {expect(JSON.stringify(result)).not.toContain('connection.jwt.value');});- it('cancels before fetch when Host provenance no longer authorizes the injected hostname', async () => {+ it('cancels before fetch when the manifest no longer authorizes the injected hostname', async () => {const h = makeSlot();h.resolve.mockReturnValueOnce(INPUT)diff --git a/apps/desktop/src/main/cindy-brain/connectionAudienceResolver.ts b/apps/desktop/src/main/cindy-brain/connectionAudienceResolver.tsindex 4190b29a04..f9e5123017 100644--- a/apps/desktop/src/main/cindy-brain/connectionAudienceResolver.ts+++ b/apps/desktop/src/main/cindy-brain/connectionAudienceResolver.ts@@ -1,14 +1,10 @@/**- * Host-owned Connection audience resolver. The development implementation- * replaces Plugin Market provenance with an explicit local trust file; plugin- * manifests and runtime messages never provide an audience.+ * 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.*/-import path from 'node:path';-import {- GHOST_NETWORK_MAX_HOSTS,- isValidGhostId,- isValidGhostNetworkHostPattern,-} from '../../shared/ghost.js';+import { isValidGhostId, isValidGhostNetworkHostPattern } from '../../shared/ghost.js';+import type { GhostManifest } from '../../shared/ghost.js';export interface ConnectionAudienceIdentity {membershipId: string;@@ -30,189 +26,76 @@ export interface ConnectionAudienceResolver {): ConnectionAudienceResolution | null;}-interface DevTrustRecord {- ghostId: string;- orgSlug: string;- pluginSlug: string;- hosts: string[];-}--const SLUG_RE = /^[a-z0-9][a-z0-9-]{0,31}$/;+const ORG_SLUG_RE = /^[a-z0-9][a-z0-9-]{0,31}$/;const PLUGIN_SLUG_RE = /^[a-z][a-z0-9-]{0,31}$/;-const MAX_TRUST_FILE_BYTES = 64 * 1024;-const MAX_TRUST_RECORDS = 64;--function exactKeys(value: Record<string, unknown>, expected: readonly string[]): boolean {- const actual = Object.keys(value).sort();- return (- actual.length === expected.length &&- actual.every((key, index) => key === [...expected].sort()[index])- );-}-export function parseDevConnectionTrustFile(raw: string): DevTrustRecord[] {- if (Buffer.byteLength(raw, 'utf8') > MAX_TRUST_FILE_BYTES) {- throw new Error('Connection development trust file is too large');- }- let parsed: unknown;- try {- parsed = JSON.parse(raw);- } catch {- throw new Error('Connection development trust file is not valid JSON');- }- if (- typeof parsed !== 'object' ||- parsed === null ||- Array.isArray(parsed) ||- !exactKeys(parsed as Record<string, unknown>, ['plugins', 'schemaVersion'])- ) {- throw new Error('Connection development trust file has an invalid root object');- }- const root = parsed as { schemaVersion?: unknown; plugins?: unknown };- if (root.schemaVersion !== 1) {- throw new Error('Connection development trust file schemaVersion must be 1');- }- if (- !Array.isArray(root.plugins) ||- root.plugins.length === 0 ||- root.plugins.length > MAX_TRUST_RECORDS- ) {- throw new Error('Connection development trust file plugins must be a non-empty bounded array');- }-- const seenGhostIds = new Set<string>();- return root.plugins.map((record, index) => {- if (- typeof record !== 'object' ||- record === null ||- Array.isArray(record) ||- !exactKeys(record as Record<string, unknown>, ['ghostId', 'hosts', 'orgSlug', 'pluginSlug'])- ) {- throw new Error(`Connection development trust record ${index} is invalid`);- }- const { ghostId, orgSlug, pluginSlug, hosts } = record as Record<string, unknown>;- if (typeof ghostId !== 'string' || !isValidGhostId(ghostId)) {- throw new Error(`Connection development trust record ${index} has an invalid ghostId`);- }- if (typeof orgSlug !== 'string' || !SLUG_RE.test(orgSlug)) {- throw new Error(`Connection development trust record ${index} has an invalid orgSlug`);- }- if (typeof pluginSlug !== 'string' || !PLUGIN_SLUG_RE.test(pluginSlug)) {- throw new Error(`Connection development trust record ${index} has an invalid pluginSlug`);- }- if (`${orgSlug}:${pluginSlug}`.length > 64) {- throw new Error(`Connection development trust record ${index} has an oversized audience`);- }- if (!Array.isArray(hosts) || hosts.length === 0 || hosts.length > GHOST_NETWORK_MAX_HOSTS) {- throw new Error(`Connection development trust record ${index} has invalid hosts`);- }- const normalizedHosts: string[] = [];- for (const host of hosts) {- const normalized = typeof host === 'string' ? host.trim().toLowerCase() : '';- if (- !isValidGhostNetworkHostPattern(normalized) ||- normalized.startsWith('*.') ||- normalizedHosts.includes(normalized)- ) {- throw new Error(`Connection development trust record ${index} has an invalid host`);- }- normalizedHosts.push(normalized);- }- if (seenGhostIds.has(ghostId)) {- throw new Error(`Connection development trust file repeats ghostId ${ghostId}`);- }- seenGhostIds.add(ghostId);- return { ghostId, orgSlug, pluginSlug, hosts: normalizedHosts };- });+/** A managed secret is ready only when its exact injection host is declared. */+export function isConnectionSecretReady(+ injectHosts: readonly string[],+ resolution: ConnectionAudienceResolution | null,+): boolean {+ return resolution !== null && injectHosts.some((host) => resolution.allowedHosts.includes(host));}-export interface LoadDevConnectionAudienceResolverOptions {- trustFilePath?: string;- isPackaged: boolean;- desktopDevMode?: string;- readFile(pathname: string): string;+export interface LoadConnectionAudienceResolverOptions {+ readInstalledManifest(ghostId: string): GhostManifest | null;log?: {info: (msg: string, meta?: Record<string, unknown>) => void;warn: (msg: string, meta?: Record<string, unknown>) => void;};}-const NO_CONNECTION_AUDIENCE_RESOLVER: ConnectionAudienceResolver = {- resolve: () => null,-};--export function loadDevConnectionAudienceResolver(- options: LoadDevConnectionAudienceResolverOptions,+export function loadConnectionAudienceResolver(+ options: LoadConnectionAudienceResolverOptions,): ConnectionAudienceResolver {- const trustFilePath = options.trustFilePath?.trim();- if (!trustFilePath) {- options.log?.warn('ghost Connection development trust file is not configured', {- isPackaged: options.isPackaged,- desktopDevMode: options.desktopDevMode ?? null,- });- return NO_CONNECTION_AUDIENCE_RESOLVER;- }- if (options.isPackaged) {- throw new Error('Connection development trust override is forbidden in packaged builds');- }- if (options.desktopDevMode !== 'local') {- throw new Error('Connection development trust override requires Desktop local mode');- }- if (!path.isAbsolute(trustFilePath)) {- throw new Error('Connection development trust file path must be absolute');- }-- let raw: string;- try {- raw = options.readFile(trustFilePath);- } catch {- // Do not echo the local absolute path into logs or plugin-visible errors.- options.log?.warn('ghost Connection development trust file read failed');- throw new Error('Connection development trust file cannot be read');- }- let records: DevTrustRecord[];- try {- records = parseDevConnectionTrustFile(raw);- } catch (error) {- options.log?.warn('ghost Connection development trust file parse failed', {- error: error instanceof Error ? error.message : String(error),- });- throw error;- }- const byGhostId = new Map(records.map((record) => [record.ghostId, record] as const));- options.log?.info('ghost Connection development trust loaded', {- recordCount: records.length,- });return {resolve(ghostId, identity) {- const record = byGhostId.get(ghostId);- if (!record) {- options.log?.warn('ghost Connection audience resolution rejected', {- ghostId,- reason: 'ghost-not-trusted',- });- return null;- }- const reason =- identity.membershipKind !== 'org'- ? 'membership-not-org'- : identity.membershipId.length === 0- ? 'membership-id-empty'- : identity.orgSlug !== record.orgSlug- ? 'org-mismatch'- : null;- if (reason) {+ const reject = (reason: string): null => {options.log?.warn('ghost Connection audience resolution rejected', {ghostId,reason,});return null;+ };+ if (!isValidGhostId(ghostId) || !PLUGIN_SLUG_RE.test(ghostId)) {+ return reject('plugin-id-invalid');}+ if (identity.membershipKind !== 'org') return reject('membership-not-org');+ if (!identity.membershipId) return reject('membership-id-empty');+ if (!identity.orgSlug || !ORG_SLUG_RE.test(identity.orgSlug)) {+ return reject('org-slug-unavailable');+ }++ let manifest: GhostManifest | null = null;+ try {+ manifest = options.readInstalledManifest(ghostId);+ } catch {+ return reject('installed-manifest-read-failed');+ }+ if (!manifest) return reject('plugin-not-installed');+ if (manifest.id !== ghostId) return reject('plugin-id-mismatch');++ const allowedHosts = [+ ...new Set(+ (manifest.network?.secrets ?? [])+ .filter((secret) => secret.source === 'oidc-token')+ .flatMap((secret) => secret.inject.hosts ?? [])+ .filter((host) => isValidGhostNetworkHostPattern(host) && !host.startsWith('*.')),+ ),+ ];+ if (allowedHosts.length === 0) return reject('oidc-host-declaration-missing');++ const audience = `${identity.orgSlug}:${ghostId}`;+ if (audience.length > 64) return reject('audience-too-long');+ options.log?.info('ghost Connection audience resolved', {+ ghostId,+ allowedHostCount: allowedHosts.length,+ });return {membershipId: identity.membershipId,- audience: `${record.orgSlug}:${record.pluginSlug}`,- pluginSlug: record.pluginSlug,- allowedHosts: record.hosts,+ audience,+ pluginSlug: ghostId,+ allowedHosts,};},};diff --git a/apps/desktop/src/main/cindy-brain/index.ts b/apps/desktop/src/main/cindy-brain/index.tsindex db3abd2f80..6b3e2eb672 100644--- a/apps/desktop/src/main/cindy-brain/index.ts+++ b/apps/desktop/src/main/cindy-brain/index.ts@@ -178,7 +178,8 @@ import {import { GhostNetworkSlot } from './networkSlot.js';import {type ConnectionAudienceResolution,- loadDevConnectionAudienceResolver,+ isConnectionSecretReady,+ loadConnectionAudienceResolver,type ConnectionAudienceResolver,} from './connectionAudienceResolver.js';import {@@ -1651,14 +1652,14 @@ let notifySlotSingleton: GhostNotifySlot | null = null;let connectionAudienceResolverSingleton: ConnectionAudienceResolver | null = null;let connectionTokenProviderSingleton: ConnectionTokenProvider | null = null;-/** Development-only provenance source; production will replace this resolver with Market records. */+/** Resolve Connection metadata from the currently installed plugin manifest. */function getConnectionAudienceResolver(): ConnectionAudienceResolver {if (!connectionAudienceResolverSingleton) {- connectionAudienceResolverSingleton = loadDevConnectionAudienceResolver({- trustFilePath: process.env.XDT_CONNECTION_DEV_TRUST_FILE,- isPackaged: app.isPackaged,- desktopDevMode: process.env.XDT_DESKTOP_DEV_MODE,- readFile: (pathname) => fs.readFileSync(pathname, 'utf8'),+ connectionAudienceResolverSingleton = loadConnectionAudienceResolver({+ readInstalledManifest: (ghostId) =>+ getGhostManager()+ .list()+ .find((candidate) => candidate.manifest.id === ghostId)?.manifest ?? null,log,});}@@ -3010,7 +3011,7 @@ export function getGhostNetworkSlot(): GhostNetworkSlot {invalidateAccessToken: (ghostId, secretKey, accountId) =>getGhostOauthAccountManager().invalidateAccessToken(ghostId, secretKey, accountId),},- // Cindy Connection JWT:audience 只由 Host 的可信映射推导,令牌只留在+ // Cindy Connection JWT:audience 只由 Host 根据组织和插件 id 推导,令牌只留在// Main 内存并由 networkSlot 直接注入,插件与 Node Worker 都拿不到。connectionTokens: {resolve: resolveConnectionAudienceForGhost,@@ -3595,19 +3596,19 @@ export function registerGhostIpc(): void {const managedSecretDecls = networkSecretDecls.filter((s) => s.source === 'oidc-token',);- const connectionIdentityReady =+ const connectionResolution =managedSecretDecls.length > 0? (() => {try {- return resolveConnectionAudienceForGhost(ghostId) !== null;+ return resolveConnectionAudienceForGhost(ghostId);} catch {- return false;+ return null;}})()- : false;+ : null;const managedSecretStates = managedSecretDecls.map((s) => ({key: s.key,- saved: connectionIdentityReady,+ saved: isConnectionSecretReady(s.inject.hosts ?? [], connectionResolution),}));return handleGhostSecretsRequest({method,diff --git a/apps/desktop/src/shared/__tests__/ghost.oidc-token.test.ts b/apps/desktop/src/shared/__tests__/ghost.oidc-token.test.tsindex 6e4426e3b4..5d01576017 100644--- a/apps/desktop/src/shared/__tests__/ghost.oidc-token.test.ts+++ b/apps/desktop/src/shared/__tests__/ghost.oidc-token.test.ts@@ -46,7 +46,7 @@ describe('ghost manifest oidc-token source', () => {});expect(ghostPermissionItems(result.manifest)).toContainEqual(expect.objectContaining({- key: 'network:secret:cindy_identity',+ key: 'network:secret:cindy_identity:oidc-token',labelKey: 'networkSecretOrganizationIdentity',}),);diff --git a/apps/desktop/src/shared/ghost.ts b/apps/desktop/src/shared/ghost.tsindex d106d3ecd0..728b82718c 100644--- a/apps/desktop/src/shared/ghost.ts+++ b/apps/desktop/src/shared/ghost.ts@@ -1606,8 +1606,8 @@ export function ghostPermissionItems(manifest: GhostManifest): GhostPermissionIt// 来源分档文案:登录邮箱派生 vs 用户自填(意识 settingsHtml 收单——宿主// 凭证渲染已退役,user 凭证只剩这一档)。收单档文案不许说"意识代码无法// 读取"这种过头话:录入瞬间明文经过意识页面,知情同意面要如实。- // key 不掺 source——同一凭证换档时更新 diff 显示为内容不变但文案已按- // 新版渲染,可接受。+ // user/login-email/oauth 保持历史 key,不影响存量插件;企业身份是新的高风险+ // Host 托管来源,单独带 source 后缀,从其它来源切换时必须重新确认。if (secret.source === 'oauth' && secret.oauth) {// OAuth 凭证:展示授权域名 + scopes 全量如实列出(通用声明式的知情// 同意面——平台不预设 provider,用户看到的就是全部授权事实)。detail@@ -1632,7 +1632,7 @@ export function ghostPermissionItems(manifest: GhostManifest): GhostPermissionIt}if (secret.source === 'oidc-token') {items.push({- key: `network:secret:${secret.key}`,+ key: `network:secret:${secret.key}:oidc-token`,kind: 'network',labelKey: 'networkSecretOrganizationIdentity',labelArgs: { name: secret.label },diff --git a/cindy-protocol b/cindy-protocolindex 4bb5d083fa..72160699ef 160000--- a/cindy-protocol+++ b/cindy-protocol@@ -1 +1 @@-Subproject commit 4bb5d083faecd8152bef081c8fdfff2a6e44c165+Subproject commit 72160699eff66604ec75f17fcd6eab500d9bf7dbdiff --git a/docs/dev-rules/plugin-security-and-authoring.md b/docs/dev-rules/plugin-security-and-authoring.mdindex 3ee9729c2f..b8a47f6a67 100644--- a/docs/dev-rules/plugin-security-and-authoring.md+++ b/docs/dev-rules/plugin-security-and-authoring.md@@ -75,10 +75,10 @@- network 只允许 manifest 白名单域名;凭证由主机保险库注入,**无明文读回**给沙箱。- `source: "oidc-token"` 是 Host 托管的短时 Cindy Connection JWT:只对当前企业- Membership 生效,audience 由 Host 的受信插件映射推导,插件和 Node Worker 都不能读取或- 保存令牌。声明必须固定使用 `Authorization: Bearer {value}` 并显式列出非空- `inject.hosts`;其中只允许精确域名,不允许通配。实际目标还必须精确命中 Host 受信安装- 映射里的服务域名,两层同时通过才签发和注入。它没有用户输入、`url`、`exchange` 或+ Membership 生效,audience 由 Host 根据当前组织和插件 id 推导,插件和 Node Worker+ 都不能读取或保存令牌。声明必须固定使用 `Authorization: Bearer {value}` 并显式列出+ 非空 `inject.hosts`;其中只允许精确域名,不允许通配。实际目标必须精确命中当前安装+ 插件 manifest 声明的服务域名才会签发和注入。它没有用户输入、`url`、`exchange` 或`setup.requires` 配置动作。Connection JWT 请求遇到 401 时,仅 GET / HEAD / OPTIONS可自动换令牌重试一次;非幂等请求只作废缓存,不自动重放。- 插件 setup 的完成状态只由 Host 读取真实持久化状态后判定。简单的