E3 — Drata Adapter Stub: Test Runbook¶
Asset: Drata Adapter stub (E3)
Location: apps/evidence-collector/src/platforms/drata.ts
Owner: SnowOps (SO)
Milestone: M4
Overview¶
The Drata adapter implements EvidenceUpsertApi and pushes compliance evidence
to Drata via its REST API. It is a stub implementation — the API shape is in
place but the controlMap (Drata check IDs) must be populated from a live
Drata workspace before production use.
Part A — Offline: automated unit tests¶
Expected: All tests pass. Tests cover:
- listExisting filtering (items without controlCode/framework are skipped)
- create with and without controlMap; status mapping (PASSING / FAILING / NOT_APPLICABLE)
- update URL construction
- Platform idempotency
- Non-2xx error propagation
Part B — Offline: TypeScript type-check¶
Expected: No type errors.
Part C — Live: Drata API integration (requires Drata account)¶
Prerequisites:
- Drata workspace with API access enabled
- DRATA_API_KEY set in the environment
- DRATA_CONTROL_MAP populated with Drata check IDs for at least one control
cd apps/evidence-collector
npm run build
DRATA_CONTROL_MAP='{"soc2:CC6.1":"<your-drata-check-id>"}' \
node -e "
import('./dist/platforms/factory.js').then(async ({ selectEvidencePlatform }) => {
const platform = selectEvidencePlatform('drata', process.env);
const result = await platform.push({
framework: 'soc2',
controlId: 'CC6.1',
title: 'E3 runbook smoke test',
status: 'pass',
observedAt: new Date().toISOString(),
evidence: { source: 'runbook-test', nonCompliantResources: 0 },
});
console.log('pushed:', JSON.stringify(result));
});
"
Expected: JSON output with { framework, controlId, externalId, updated }.
Verify the test result appears in the Drata dashboard.
Sign-Off Block¶
| Step | Executed by | Date | Result |
|---|---|---|---|
| Part A (unit tests) | ⬜ | ||
| Part B (typecheck) | ⬜ | ||
| Part C (live Drata) | ⬜ |
Signed off: _____ Date: ___
Failure Modes¶
| Failure | Cause | Remediation |
|---|---|---|
Drata list checks failed: 401 |
Invalid or expired DRATA_API_KEY |
Rotate API token in Drata Settings → API |
Drata submit evidence failed: 404 |
Check ID not found | Verify controlMap values match live Drata check IDs |
platform drata requires DRATA_API_KEY |
Missing env var | Set DRATA_API_KEY |