Add enterprise data residency guard#164
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a deterministic “data residency guard” module to evaluate export/webhook transfer decisions against tenant policy and produce auditable artifacts (dashboard metrics, webhook envelopes, export manifests, and reviewer-friendly reports).
Changes:
- Introduces core residency evaluation engine with findings, digests, webhook events, export manifests, and text report rendering.
- Adds synthetic sample input data plus a demo script for generating a text report.
- Adds Node test coverage validating decisions, metrics, digest stability, and manifest output.
Reviewed changes
Copilot reviewed 8 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| enterprise-data-residency-guard/src/data-residency-guard.js | Implements residency evaluation, findings, dashboard summary, webhook events, export manifest, and text report. |
| enterprise-data-residency-guard/test/data-residency-guard.test.js | Adds tests for policy decisions, dashboard metrics, deterministic digests, and report rendering. |
| enterprise-data-residency-guard/scripts/demo.js | Adds a runnable demo that loads sample input and prints a text report. |
| enterprise-data-residency-guard/package.json | Defines scripts for syntax check, tests, and demo execution (Node-only, no deps). |
| enterprise-data-residency-guard/data/sample-residency-input.json | Provides synthetic tenants/destinations/records that exercise cross-border, PHI, and embargo rules. |
| enterprise-data-residency-guard/docs/requirement-map.md | Maps module outputs to issue #19 requirement areas for review/acceptance. |
| enterprise-data-residency-guard/README.md | Documents what the module covers and how to run checks/tests/demo. |
| README.md | Adds a top-level pointer to the new submodule. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| return { | ||
| ...payload, | ||
| signature: `sha256=${stableDigest(payload)}` |
| if (crossBorder && tenant.policy.requiresSccForNonAdequateRegion && !destination.adequacy) { | ||
| decision = raiseDecision(decision, "blocked"); | ||
| findings.push({ | ||
| code: "NO_ADEQUACY_OR_SCC", | ||
| severity: "critical", | ||
| message: "Destination has no adequacy decision and no SCC evidence", | ||
| evidence: { | ||
| regimes: tenant.regimes, | ||
| destinationRegion: destination.region | ||
| } | ||
| }); | ||
| } |
| return crypto | ||
| .createHash("sha256") | ||
| .update(stableStringify(value)) | ||
| .digest("hex"); |
| queue: results | ||
| .filter((result) => result.decision !== "approved") | ||
| .map((result) => ({ | ||
| id: result.id, | ||
| tenantName: result.tenantName, | ||
| decision: result.decision, | ||
| topFinding: result.findings[0]?.code ?? "NONE" | ||
| })) | ||
| }; |
|
|
||
| - Synthetic data only. No credentials, protected health data, or real institution records. | ||
| - Zero dependencies. The logic uses Node built-ins so reviewers can run it offline. | ||
| - The sample shows one blocked PHI transfer, two manual reviews, and approved in-region exports. |
|
Fixed in latest push. Switched webhook signatures to HMAC, added SCC evidence fields, removed duplicate digest helper, ranked queue findings by severity, and corrected the README sample count. |
|
Following up here. The Algora claim is still pending. Happy to turn around review notes quickly if anything needs adjustment. |
/claim #19
Adds a data residency guard for enterprise exports and webhooks.
Covers:
Demo:
Tested: