@veltrixsecops/app-sdk 3.5.0 → 3.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +67 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -39,6 +39,9 @@ import { defineDeployer } from '@veltrixsecops/app-sdk/pipeline'
39
39
  export default defineDeployer(async (ctx) => {
40
40
  // ctx.component, ctx.credential, ctx.connectivity, ctx.connectivityProvider
41
41
  // ctx.previousConfig, ctx.strategy, ctx.canaryPercent
42
+ // ctx.remote — a RemoteExecutor for managed-ZTNA targets (place files + run
43
+ // allow-listed intents over the tenant's own tailnet); undefined for API-only
44
+ // tools. Also present on the rollback + drift contexts.
42
45
  return { success: true, message: 'Deployed', rollbackData: {/* prior state */} }
43
46
  })
44
47
  ```
@@ -58,6 +61,37 @@ export default async function getStatus(ctx: PipelineContext): Promise<ConfigSta
58
61
  }
59
62
  ```
60
63
 
64
+ ## Server routes & the credential seam
65
+
66
+ An app's `server/index.ts` mounts as a Fastify plugin under `/api/apps/<app-id>` and
67
+ receives an `AppRouteContext` — `db`, `events`, `manifest`, `hasPermission(resource, action)`
68
+ (returns a preHandler enforcing an app-scoped permission), and **`resolveConnection`**.
69
+
70
+ To reach a connected system from a route WITHOUT re-implementing the platform's credential
71
+ decryption, resolve one of the tenant's Connections (by credential id) to its decrypted
72
+ secret + endpoint:
73
+
74
+ ```ts
75
+ import type { ResolvedConnection } from '@veltrixsecops/app-sdk'
76
+
77
+ const conn: ResolvedConnection | null = await ctx.resolveConnection(customerId, credentialId)
78
+ // conn?.endpoint / username / password / apiToken / certificate
79
+ ```
80
+
81
+ It is scoped to `customerId` (the tenant boundary) and returns `null` when no matching
82
+ connection exists. **Server-side only** — never return the decrypted secret to the client or
83
+ log it. Pair it with a manifest `connectivity.testHandler` and a Settings → Connections page
84
+ (see below) so users can add and test the credential your routes then resolve.
85
+
86
+ ## Drift attribution
87
+
88
+ A `driftDetect` handler returns `DriftResult { diffs: DriftDiff[] }`, and each `DriftDiff` may
89
+ carry an optional **`actor`** (`DriftActor`) — best-effort attribution of *who* changed the
90
+ target outside Veltrix and *when*, resolved from the tool's own audit/system log (e.g. Okta's
91
+ System Log): `{ name?, email?, at?, eventType?, source?, id? }`, all optional. Omit it when the
92
+ tool has no audit API or the change can't be correlated; the platform renders it on the drift
93
+ view so an alert answers **who + when**, not just *what*.
94
+
61
95
  ## Lifecycle hooks
62
96
 
63
97
  ```ts
@@ -134,6 +168,36 @@ platform too (local dev, tests): components render a minimal, unstyled, accessib
134
168
  `useToast` logs to the console, and `useConfirmDialog().confirm()` resolves to `false`
135
169
  (fails closed) — so nothing crashes, it just runs without platform theming.
136
170
 
171
+ ## Connections
172
+
173
+ Most apps reach their tool through a credential the tenant admin adds under
174
+ **Settings → Connections**. Give your app a `/connections` client page (nav `group: settings`)
175
+ that renders the shared manager, and declare a connectivity test in the manifest:
176
+
177
+ ```tsx
178
+ // client/pages/ConnectionsPage.tsx — a thin wrapper over the shared manager
179
+ import { ConnectionsManager } from '@veltrixsecops/app-sdk/connections'
180
+
181
+ export default () => (
182
+ <ConnectionsManager
183
+ appId="defender-endpoint"
184
+ appName="Microsoft Defender for Endpoint"
185
+ usernameLabel="Client ID"
186
+ tokenLabel="Client secret"
187
+ />
188
+ )
189
+ ```
190
+
191
+ ```yaml
192
+ # manifest.yaml — a lightweight authenticated probe backs the "Test" button
193
+ connectivity:
194
+ testHandler: handlers/testConnection
195
+ ```
196
+
197
+ Server routes then reach the tool with `ctx.resolveConnection(...)` (above), so the decrypted
198
+ secret never leaves the server. Apps that provision their own hosted infrastructure
199
+ additionally get a Bring-Your-Own-Infra console from `@veltrixsecops/app-sdk/byol`.
200
+
137
201
  ## Branding
138
202
 
139
203
  Declare your vendor identity in the manifest and the platform applies it in defined
@@ -190,6 +254,9 @@ conventionalPaths('indexes').handlers.deploy // 'config-types/indexes/deploy'
190
254
  | `@veltrixsecops/app-sdk/hooks` | React hooks for app client pages (requires `react`) |
191
255
  | `@veltrixsecops/app-sdk/client` | Browser client contract: `authFetch`, `getHostRuntime`, `AppClientModule` |
192
256
  | `@veltrixsecops/app-sdk/ui` | Platform design-system components + hooks for app client pages (requires `react`; renders richly inside the platform, degrades to a minimal accessible fallback outside it) |
257
+ | `@veltrixsecops/app-sdk/connections` | `ConnectionsManager` — the shared Settings → Connections page an app's `/connections` client page renders (requires `react`) |
258
+ | `@veltrixsecops/app-sdk/byol` | Bring-Your-Own-Infra console — `ByolInfrastructureManager`/`ByolInfrastructureDetail` + plan helpers (`buildByolPlan`, `diffPlan`, `planHasChanges`) for apps that provision hosted infra (requires `react`) |
259
+ | `@veltrixsecops/app-sdk/opentofu` | Generic OpenTofu provisioning for BYOI apps: `InfraSpec` types + `renderInfraVars()` / `validateInfraSpec()` — see [opentofu/README](./opentofu/README.md) |
193
260
 
194
261
  ## Building an app
195
262
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veltrixsecops/app-sdk",
3
- "version": "3.5.0",
3
+ "version": "3.5.1",
4
4
  "description": "Official SDK for building Veltrix Security-as-Code apps — typed pipeline handler contracts, lifecycle hook types, manifest types, and React hooks.",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",