|
| 1 | +# Security Penetration Tests (Maced Integration) |
| 2 | + |
| 3 | +This module exposes Comp API endpoints under `/v1/security-penetration-tests` and orchestrates report generation with Maced (`/v1/pentests`). |
| 4 | + |
| 5 | +## Endpoints |
| 6 | + |
| 7 | +- `GET /v1/security-penetration-tests` |
| 8 | +- `POST /v1/security-penetration-tests` |
| 9 | +- `GET /v1/security-penetration-tests/:id` |
| 10 | +- `GET /v1/security-penetration-tests/:id/progress` |
| 11 | +- `GET /v1/security-penetration-tests/:id/report` |
| 12 | +- `GET /v1/security-penetration-tests/:id/pdf` |
| 13 | +- `POST /v1/security-penetration-tests/webhook` |
| 14 | + |
| 15 | +## Required environment variables |
| 16 | + |
| 17 | +- `MACED_API_KEY`: Maced API key used by Nest API when calling provider endpoints. |
| 18 | + |
| 19 | +## Optional environment variables |
| 20 | + |
| 21 | +- `MACED_API_BASE_URL`: Defaults to `https://api.maced.ai`. |
| 22 | +- `SECURITY_PENETRATION_TESTS_WEBHOOK_URL`: Base callback URL for Comp webhook endpoint. |
| 23 | + |
| 24 | +## Webhook handshake model |
| 25 | + |
| 26 | +1. On create (`POST /v1/security-penetration-tests`), Maced issues a per-job `webhookToken` and returns it in the create response. |
| 27 | +2. Comp does not send a user-provided `webhookToken` upstream; the value is reserved for provider issuance. |
| 28 | +3. If callback target resolves to Comp webhook route and Maced returns `webhookToken`, Comp persists a handshake record in `secrets` using name: |
| 29 | + - `security_penetration_test_webhook_<reportId>` |
| 30 | +4. On webhook receive, Comp: |
| 31 | + - resolves org context (`X-Organization-Id` or `orgId`/`organizationId` query), |
| 32 | + - resolves token (`webhookToken` query or `X-Webhook-Token` header), |
| 33 | + - requires a persisted per-job handshake and verifies token hash match, |
| 34 | + - tracks idempotency (`X-Webhook-Id`/`X-Request-Id`, plus payload hash fallback), |
| 35 | + - returns `duplicate: true` for replayed webhook events. |
| 36 | + |
| 37 | +## Notes |
| 38 | + |
| 39 | +- Frontend should call Nest API only (no Next.js proxy routes for this feature). |
| 40 | +- Provider callbacks to non-Comp webhook URLs are passed through and are not forced to include Comp-specific webhook tokens. |
0 commit comments