Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): organization 分支漏了 source 检查,legacy-adopted 能冒充本组织市场安装
fmfsaisai03d6c71a564d
diff --git a/apps/desktop/src/main/cindy-brain/__tests__/ghostFirstPartyPrivilege.test.ts b/apps/desktop/src/main/cindy-brain/__tests__/ghostFirstPartyPrivilege.test.tsindex 837438355e..5ba7ee26c0 100644--- a/apps/desktop/src/main/cindy-brain/__tests__/ghostFirstPartyPrivilege.test.ts+++ b/apps/desktop/src/main/cindy-brain/__tests__/ghostFirstPartyPrivilege.test.ts@@ -289,6 +289,27 @@ describe('resolveGhostFirstPartyPrivilege', () => {scope,).toMatchObject({ brokerEligible: false, hostPrimitiveEligible: false });}+ // ⚠️ 上面那组用的 id 是 `cindy-art`,而当前组织前缀是 `acme`——它其实死在+ // 「前缀不匹配」那一步,**根本没走到 source 判断**,所以单靠它会给出假信心+ // (reviewer 指出)。下面这组前缀真的匹配,才是实际验证 organization 分支+ // 必须同时要求 `source === 'market'` 的用例:少了那个检查,`legacy-adopted`+ // 与自定义来源的 organization 行都会被判成「本组织市场安装」而拿到 Broker。+ for (const source of ['legacy-adopted', 'git-market', 'local-market'] as const) {+ expect(+ resolveGhostFirstPartyPrivilege(+ facts({+ ghostId: 'acme-feishu',+ marketRecord: market({ scope: 'organization', organizationId: 'org-acme', source }),+ currentOrganization: CURRENT_ORG,+ }),+ ),+ source,+ ).toEqual({+ brokerEligible: false,+ hostPrimitiveEligible: false,+ basis: 'denied-unknown-origin',+ });+ }// 同一个 id 只要 builtin 为真就走优先级 1,台账怎么写都不影响——这才是// 随包插件今天的实际路径。expect(diff --git a/apps/desktop/src/main/cindy-brain/ghostFirstPartyPrivilege.ts b/apps/desktop/src/main/cindy-brain/ghostFirstPartyPrivilege.tsindex 99efc0c1a0..9e7055d7b7 100644--- a/apps/desktop/src/main/cindy-brain/ghostFirstPartyPrivilege.ts+++ b/apps/desktop/src/main/cindy-brain/ghostFirstPartyPrivilege.ts@@ -140,6 +140,14 @@ export function resolveGhostFirstPartyPrivilege(facts: GhostFirstPartyFacts): Gh: deny('denied-unknown-origin');}if (record.scope === 'organization') {+ // Same discipline as the public branch: scope is only meaningful together+ // with source. `legacy-adopted` rows are synthesized after a successful+ // market listing for official-prefix plugins that predate the market+ // (`plugin-market/service.ts::adoptLegacyInstallations`) — they attest+ // "this id exists on this machine", not "these bytes were distributed by+ // that organization's server market". `git-market` / `local-market` rows+ // carry a placeholder scope, which is likewise not a trust statement.+ if (record.source !== 'market') return deny('denied-unknown-origin');if (!isCurrentOrganizationRecord(record, facts.currentOrganization)) {return deny('denied-foreign-org');}