feat(sdk): custom function sync helpers (DH crypto, Sombra session exchange) - #321
feat(sdk): custom function sync helpers (DH crypto, Sombra session exchange)#321ecton-transcend wants to merge 3 commits into
Conversation
…n exchange, fetch/diff/sync)
@transcend-io/airgap.js-types
@transcend-io/cli
@transcend-io/design-tokens
@transcend-io/internationalization
@transcend-io/privacy-types
@transcend-io/sdk
@transcend-io/type-utils
@transcend-io/utils
@transcend-io/mcp
@transcend-io/mcp-server-admin
@transcend-io/mcp-server-assessment
@transcend-io/mcp-server-base
@transcend-io/mcp-server-consent
@transcend-io/mcp-server-discovery
@transcend-io/mcp-server-docs
@transcend-io/mcp-server-dsr
@transcend-io/mcp-server-inventory
@transcend-io/mcp-server-preferences
@transcend-io/mcp-server-workflows
commit: |
michaelfarrell76
left a comment
There was a problem hiding this comment.
see https://github.com/transcend-io/main/pull/46175#pullrequestreview-4732313911
will need to resolve this first and build a new sombra endpoint
…instead of employee session + DH
Automated Change: Auth pivot to customer-ingress signingPer security review feedback on the platform side (#46175), the signing flow no longer exchanges the API key for a Sombra employee session over a Diffie-Hellman channel. The CLI now signs code directly against the Sombra customer-ingress Implementation detailsWhat changed: All DH crypto and the session-exchange helper were removed from the SDK; a |
Automated Change: Per-gateway code signingCustom functions can belong to different Sombra gateways, and a function's JWTs must be signed by its own gateway's keys or they fail verification at execution time. Previously the push signed every function against a single gateway (the Implementation detailsWhat changed: The |
Related Issues
Internal Changelog
custom-functionsmodule in@transcend-io/sdk— a customer-ingress code signing helper (signCustomFunctionCode, calling Sombra's new/v1/custom/signroute with bearer authentication), a Sombra gateway URL resolver (resolveSombraCustomerUrl), typed GraphQL documents, and fetch/diff/sync helpers for custom functions.Implementation details
How a sync works
syncCustomFunctionsends the plaintext code + execution context (allowed hosts, timeout, env vars) to the Sombra customer-ingress/v1/custom/signroute, authenticated by the Transcend API key bearer header (plus theX-Sombra-Authorizationinternal key when self-hosting) via the existingcreateSombraGotInstance. Sombra returns HMAC-signedsignedCodeJwt/signedCodeContextJwt.createCustomFunction/updateStandaloneCustomFunction(insideinput), where the API key'sManageDataMapscope is enforced. New revisions land as drafts and are promoted viapromoteCustomFunctionVersionunless promotion is disabled.updateStandaloneCustomFunctionhandles both GENERAL and DSR functions.Per-gateway signing
Each custom function belongs to a single Sombra gateway whose keys sign its code and encrypt its env values — signing against any other gateway would produce JWTs that fail verification at execution time.
resolveEffectiveSombraIdresolves the gateway per function (configsombraId→ existing function's gateway → caller default → primary), errors when a config tries to move an existing function between gateways, and thecustomFunctionsquery fetches each function'ssombraIdso updates always re-sign against the owning gateway.Matching and change detection
idfirst when set (rename-safe; a nonexistent ID fails rather than creating a duplicate), falling back to exact name. Ambiguous names (multiple functions sharing a name) fail with an error listing candidate IDs, since custom function names are not unique.customFunctionsquery and diffs code, allowed hosts, timeout, imports flag, and env variable names. Env values are encrypted at sign time and cannot be diffed — callers can force a re-sign for env-value rotations.Key files
packages/sdk/src/custom-functions/signCustomFunctionCode.tspackages/sdk/src/custom-functions/syncCustomFunction.ts,codeSigning.tspackages/sdk/src/custom-functions/resolveSombraCustomerUrl.tsDependencies / rollout
/v1/custom/signroute and thesignedCodeJwt/signedCodeContextJwtGraphQL input fields from the backend pivot (#46175). A 404 from an older Sombra produces a friendly "upgrade your gateway" error.Testing
Security Implications
ManageDataMapscope — no new privilege surface in this package.