@veltrixsecops/app-sdk 3.2.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.
- package/README.md +68 -1
- package/dist/byol/index.cjs +3802 -0
- package/dist/byol/index.cjs.map +1 -0
- package/dist/byol/index.d.cts +578 -0
- package/dist/byol/index.d.ts +578 -0
- package/dist/byol/index.js +2587 -0
- package/dist/byol/index.js.map +1 -0
- package/dist/chunk-3WK4EVQ3.js +842 -0
- package/dist/chunk-3WK4EVQ3.js.map +1 -0
- package/dist/{chunk-EOOEHZGC.js → chunk-HIL6RIDG.js} +107 -3
- package/dist/chunk-HIL6RIDG.js.map +1 -0
- package/dist/{chunk-VWFTOFTI.js → chunk-Y6XBNZGR.js} +8 -2
- package/dist/chunk-Y6XBNZGR.js.map +1 -0
- package/dist/client/index.cjs +112 -2
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +118 -6
- package/dist/client/index.d.ts +118 -6
- package/dist/client/index.js +13 -1
- package/dist/connections/index.cjs +1787 -0
- package/dist/connections/index.cjs.map +1 -0
- package/dist/connections/index.d.cts +78 -0
- package/dist/connections/index.d.ts +78 -0
- package/dist/connections/index.js +754 -0
- package/dist/connections/index.js.map +1 -0
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.cts +2 -2
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js +1 -1
- package/dist/index.cjs +7 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/opentofu/index.cjs +138 -0
- package/dist/opentofu/index.cjs.map +1 -0
- package/dist/opentofu/index.d.cts +131 -0
- package/dist/opentofu/index.d.ts +131 -0
- package/dist/opentofu/index.js +109 -0
- package/dist/opentofu/index.js.map +1 -0
- package/dist/pipeline/index.cjs +7 -0
- package/dist/pipeline/index.cjs.map +1 -1
- package/dist/pipeline/index.d.cts +9 -2
- package/dist/pipeline/index.d.ts +9 -2
- package/dist/pipeline/index.js +3 -1
- package/dist/pipeline-beeT8dje.d.cts +408 -0
- package/dist/pipeline-beeT8dje.d.ts +408 -0
- package/dist/ui/index.cjs +136 -0
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.d.cts +109 -1
- package/dist/ui/index.d.ts +109 -1
- package/dist/ui/index.js +35 -677
- package/dist/ui/index.js.map +1 -1
- package/dist/{use-app-context-OQlcmq7t.d.cts → use-app-context-Byv_fam0.d.cts} +206 -4
- package/dist/{use-app-context-OQlcmq7t.d.ts → use-app-context-Byv_fam0.d.ts} +206 -4
- package/opentofu/README.md +114 -0
- package/opentofu/modules/aws/main.tf +1008 -0
- package/opentofu/modules/aws/outputs.tf +90 -0
- package/opentofu/modules/aws/variables.tf +437 -0
- package/opentofu/modules/aws/versions.tf +23 -0
- package/opentofu/modules/azure/main.tf +920 -0
- package/opentofu/modules/azure/outputs.tf +72 -0
- package/opentofu/modules/azure/variables.tf +498 -0
- package/opentofu/modules/azure/versions.tf +27 -0
- package/opentofu/modules/gcp/main.tf +645 -0
- package/opentofu/modules/gcp/outputs.tf +73 -0
- package/opentofu/modules/gcp/variables.tf +428 -0
- package/opentofu/modules/gcp/versions.tf +27 -0
- package/opentofu/modules/hetzner/main.tf +432 -0
- package/opentofu/modules/hetzner/outputs.tf +72 -0
- package/opentofu/modules/hetzner/variables.tf +423 -0
- package/opentofu/modules/hetzner/versions.tf +26 -0
- package/package.json +33 -1
- package/dist/chunk-EOOEHZGC.js.map +0 -1
- package/dist/chunk-VWFTOFTI.js.map +0 -1
- package/dist/pipeline-A-gSsPRR.d.cts +0 -189
- package/dist/pipeline-A-gSsPRR.d.ts +0 -189
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @veltrixsecops/app-sdk
|
|
2
2
|
|
|
3
|
-
The official SDK for building [Veltrix](https://veltrixsecops.com) Security-as-Code apps. Community apps live in the open-source [veltrix-apps](https://github.com/captivatortechnologies/veltrix-apps) repository; the Veltrix platform
|
|
3
|
+
The official SDK for building [Veltrix](https://veltrixsecops.com) Security-as-Code apps. Community apps live in the open-source [veltrix-apps](https://github.com/captivatortechnologies/veltrix-apps) repository; the Veltrix platform runs as a hosted SaaS or a free, self-hostable open-source [Community Edition](https://github.com/captivatortechnologies/veltrix-community).
|
|
4
4
|
|
|
5
5
|
A Veltrix app packages everything needed to manage one security tool's configuration as code: pipeline handlers (validate → deploy → rollback → health-check → drift-detect → status), canvas templates, database migrations, lifecycle hooks, and optional client pages. This SDK provides the typed contracts and helpers for all of it.
|
|
6
6
|
|
|
@@ -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
|
|