Skip to content

Add enterprise data residency guard#164

Open
evilfps wants to merge 3 commits into
SCIBASE-AI:mainfrom
evilfps:data-residency-guard
Open

Add enterprise data residency guard#164
evilfps wants to merge 3 commits into
SCIBASE-AI:mainfrom
evilfps:data-residency-guard

Conversation

@evilfps
Copy link
Copy Markdown

@evilfps evilfps commented May 16, 2026

/claim #19

Adds a data residency guard for enterprise exports and webhooks.

Covers:

  • tenant policy, region allowlists, DPA/SCC, embargo, and protected health data checks
  • admin metrics, review queue, HMAC-signed webhook events, and export manifest evidence
  • sample data, tests, SVG preview, GIF demo, and MP4 demo

Demo:

  • enterprise-data-residency-guard/docs/demo.mp4

Tested:

  • cd enterprise-data-residency-guard && npm run check
  • cd enterprise-data-residency-guard && npm test
  • cd enterprise-data-residency-guard && npm run demo
  • rsvg-convert enterprise-data-residency-guard/docs/demo.svg -o /tmp/scibase-demo.png
  • demo.gif opened with Pillow: GIF, 3 frames, 960x540
  • demo.mp4 checked with imageio: h264, 3s, 960x540
  • git diff --check
  • credential pattern scan, no hits

Copilot AI review requested due to automatic review settings May 16, 2026 09:16
@algora-pbc algora-pbc Bot mentioned this pull request May 16, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)}`
Comment on lines +96 to +107
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
}
});
}
Comment on lines +30 to +33
return crypto
.createHash("sha256")
.update(stableStringify(value))
.digest("hex");
Comment on lines +221 to +229
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.
@evilfps
Copy link
Copy Markdown
Author

evilfps commented May 16, 2026

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.

@evilfps
Copy link
Copy Markdown
Author

evilfps commented May 22, 2026

Following up here. The Algora claim is still pending. Happy to turn around review notes quickly if anything needs adjustment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants