Architecture · All ADRs
ADR 0020 — Universal connector onboarding: Connect → Assign → Secure → Activate → Monitor
Architecture decision record — status: Accepted (2026-11-22). Audit: [docs/connectors/onboarding/audit.md](../connectors/onboarding/audit.md);.
Status: Accepted (2026-11-22). Audit: docs/connectors/onboarding/audit.md; progress: tracker.md.
Context#
GebSecure has 42 connectors, a GSL policy engine with versioning, simulation, conflict detection and approvals, and an OpenAPI import flow that already reviews operations and generates policies. Onboarding is still fragmented:
- Installing from the catalog generates a policy only for imported REST APIs and the 9 manifest connectors. Coded
connectors (GitHub, Slack, AWS, Gmail, …) install with no policy, so their calls stay denied until someone writes
GSL; their
securityTemplateis static and not bound to the connection. - The catalog's generated policy grants every agent in scope; only the Setup wizard targets one agent. The two paths share no code.
- Generated policies bind by connection name, not by the connection's identity.
- Nothing helps an organisation with hundreds of agents: no groups from a trusted source, no bulk operations.
- A denied execution says "No policy permits this action" without saying why.
Decision#
1. Extend the connector definition; don't replace it#
ConnectorDefinition (packages/connector-sdk/src/spec.ts) gets an optional onboarding profile:
- Permission groups: human-readable capabilities ("Read repositories", "Merge pull requests", "Delete repositories"), each a list of the connector's actions, a description and a default decision.
- Enterprise options: which provider-native enterprise models the connector supports (GitHub App, Google domain-wide delegation, Entra app-only, AWS AssumeRole, …), each tied to a declared auth method. Only options the connector actually implements are listed; the rest are documented as planned.
Connectors without a profile get groups derived from their mandatory risk metadata (read / write / delete / admin, plus the financial, destructive, privilege-change and external-communication flags), so every connector works in the new flow from day one. Hand-written profiles then refine connectors one by one (Phase 3).
Default decisions follow the existing import classifier (connector-sdk/src/import/classify.ts): reads allow; writes,
outbound communication and money movement require approval; delete, privilege and credential changes are deny until
an administrator explicitly selects them. Selecting a high-risk group requires an explicit acknowledgement.
2. One policy generator, bound exactly#
A single generator in packages/core replaces renderImportPolicy's callers (catalog install, Setup, REST and MCP
import) and keeps its output format for compatibility:
- Exact connection binding:
executeaddsresource.connection_id(and keepsresource.connectionfor existing policies); generated policies bind withwhen resource.connection_id == "<con_id>"and are scoped to the connection's project (and environment when the connection has one). - Exact principals: explicit agent ids, or groups (Phase 4). Never
principal agentunless the administrator explicitly chooses "all agents in this project", which is then shown as such in the summary. - No wildcards: actions are always listed by name;
resource anyonly together with the connection binding. - Layout for scale: one policy document per (connection, assignment), named after both. The policy count grows
with connections × assignments, never with agents × actions, which the linear candidate filter
(
packages/authz/src/engine.ts:170) tolerates.
3. Activation is a server-side plan, then an explicit apply#
POST /v1/connections/:id/onboarding/plan(no side effects): resolves principals and the connection, generates GSL, validates it, runs conflict detection against the active set, simulates every selected action for every assigned principal (plus a cross-project and wrong-environment negative probe), and returns a human-readable summary with a plan hash.POST /v1/connections/:id/onboarding/apply {planHash, acknowledgeHighRisk}: re-plans, refuses if the hash changed, creates the policy version and deploys through the existingdeployPolicy(tests, conflicts,adminGate,policies:deploy). It then verifies the effective decision withauthorize({dryRun:true})and offers a safe read-only test action. A blocked deploy returns a structured reason and remediation, never a silent denial.
4. Assignments and groups (Phase 4)#
Agent groups become a first-class, admin-managed object (audited membership; changes bump the authz version), and
teams from SCIM/SSO become usable for human principals by loading teams at authentication. Self-asserted data
(agent-set tags) is never a source of group membership for a grant.
5. Bulk operations (Phase 4)#
A bulk_operations + bulk_operation_items queue, processed by a worker loop with FOR UPDATE SKIP LOCKED like the
other queues (ADR 0008): idempotency key per operation, per-item status, partial failure, retries with backoff,
progress, rate limits and cancellation. Bulk apply and bulk revoke reuse the same plan/apply code per item.
6. Diagnostics#
execute classifies denials from the authorization trace and connection state into: policy denial, wrong principal,
wrong environment, wrong resource, missing provider scope, expired credential, invalid key, missing enterprise
consent, approval required, provider outage, rate limit and execution failure. The response adds diagnosis: {kind, summary, remediation, configPath}. It never suggests broadening a permission automatically.
7. AI onboarding assistant (Phase 5)#
Optional and off by default. It turns a request into the same structured plan input (connector, permission groups,
assignments), which then goes through plan and is shown to a person. It has no tool that applies or deploys, never
sees credentials, and treats connector-supplied text (OpenAPI descriptions, tool definitions) as untrusted data.
Implementation: POST /v1/{connections|mcp/servers|database/connections}/:id/onboarding/draft {request}
(packages/core/src/execution/onboarding-assistant.ts). Same permissions as plan; the organization opts in with the
aiAssistant setting and the deployment with ASSISTANT_MODEL_PROVIDER=anthropic (Claude through the Anthropic API,
structured output, no tools). The model sees the permission groups, action names and the active agents of the target's
project and environment; ids it returns are checked against them and unknown ones dropped and reported. A complete draft
is planned with the normal plan and returned with the plan; an unclear one returns questions. Drafts are audited
(onboarding.assistant.draft) and limited per organization per hour (ASSISTANT_DRAFTS_PER_HOUR). The console fills
the wizard from the draft and shows the plan for review; activation is the normal apply with the reviewed plan hash.
8. Rollout#
The new console flow is behind a feature flag (organisation setting, default off in production until Phase 3
connectors are verified). Existing policies, endpoints and SDK calls keep working; resource.connection stays.
Phases and pull requests#
- Audit (this ADR, the audit, the tracker).
- Foundation: onboarding profile type and derived groups;
connection_idbinding; unified generator; plan/apply endpoints; feature flag;rollbackPolicybehindadminGate; execute diagnostics. - Migration: console wizard on top of plan/apply; hand-written profiles per connector, verified one by one in the tracker (GitHub, Slack, Gmail, Microsoft 365, AWS first).
- Enterprise: agent groups, teams for users, bulk operations, provider enterprise auth (GitHub App, Google domain-wide delegation, Entra app-only, AWS AssumeRole).
- AI assistant.
- Hardening: cross-tenant and isolation test suite over the new endpoints, performance of large policy sets.
- UX polish: monitoring dashboard per connection, accessibility pass, error states.
Consequences#
- Every connector becomes onboardable without hand-written GSL, with defaults no broader than today's import flow.
- Generated policies become narrower than today's (exact connection, exact principals).
- The tracker, not the presence of the shared UI, decides when a connector is complete.