Embed the Composio key in the app bundle instead of shipping cred.txt

Root cause of the recurring 401: a revoked key was hardcoded in
startup-recovery.ts and onboarding-service.ts and reseeded into
composio_settings on every launch, and the interim fix shipped cred.txt
as a visible file under resources/.

- electron.vite.config.ts reads the gitignored cred.txt at build time
  and injects the key into the main-process bundle as
  __COMPOSIO_API_KEY__; no credential file is packaged and the key is
  not user-visible or configurable. The renderer bundle never sees it.
- Delete both hardcoded-key seeders; migration 046 purges stored
  api_key and never-read toolkits rows while keeping entity_id and
  auth_config state.
- Stop shipping composio_settings in the renderer snapshot.
This commit is contained in:
ZacharyZhang-NY committed 2026-07-07 01:40:19 -04:00
1 parent 2d43950123
commit a2de132083
16 files changed
+105 -181

No files matched your search

@@ -0,0 +1,10 @@
/**
* The Composio API key used to be seeded into composio_settings per
* organization — including a revoked hardcoded key that kept resurfacing.
* The key now ships embedded in the main-process bundle and is never
* persisted, so stored copies (and the never-read toolkits rows) are purged.
* entity_id and auth_config:* rows stay: connections still use them.
*/
export const composioKeyPurgeSchema = `
delete from composio_settings where key in ('api_key', 'toolkits');
`;
+2
View File
@@ -44,6 +44,7 @@ import { approvalNotesMeetingsSprintsSchema } from "./migrations/042-approval-no
import { composioIntegrationSchema } from "./migrations/043-composio-integration";
import { mentionWakeStateSchema } from "./migrations/044-mention-wake-state";
import { connectorGrantsSchema } from "./migrations/045-connector-grants";
import { composioKeyPurgeSchema } from "./migrations/046-composio-key-purge";
interface Migration {
version: number;
@@ -97,6 +98,7 @@ const MIGRATIONS: Migration[] = [
{ version: 43, name: "composio_integration", sql: composioIntegrationSchema },
{ version: 44, name: "mention_wake_state", sql: mentionWakeStateSchema },
{ version: 45, name: "connector_grants", sql: connectorGrantsSchema },
{ version: 46, name: "composio_key_purge", sql: composioKeyPurgeSchema },
];
const SCHEMA_VERSION = MIGRATIONS[MIGRATIONS.length - 1].version;