multi-tenant-guard

Enforce tenant isolation in shared-database architectures with org_id filtering.

1|Updated Jan 28, 2026
One-click install
npx skills add https://github.com/Benmore-Studio/Benmore-Meridian --skill multi-tenant-guard
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: multi-tenant-guard
Source: https://github.com/Benmore-Studio/Benmore-Meridian/tree/main/skills/multi-tenant-guard
Command: npx skills add https://github.com/Benmore-Studio/Benmore-Meridian --skill multi-tenant-guard

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Auditors and developers need to ensure multi-tenant isolation in shared-database systems to prevent cross-tenant data leakage and compliance risk.

Core Features & Use Cases

  • Tenant Context: Defines a per-request tenant context (org_id, user_id, roles, permissions) to scope access.
  • Header Extraction: Parses incoming headers to build a TenantContext for downstream components.
  • ContextVar for Isolation: Uses ContextVar to preserve per-tenant scope across async tasks and background work.
  • Tenant-Aware Queries & Audit: Enforces org_id filtering in queries, updates, and deletes, and provides an audit checklist and test templates.

Quick Start

Inspect an endpoint with tenant headers to verify that all data access stays within the correct org_id.

Frequently Asked Questions about multi-tenant-guard

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce tenant isolation in a shared-database multi-tenant application?

To enforce tenant isolation in a shared-database multi-tenant application, you apply org_id filtering to all queries, updates, and deletes, and use a ContextVar to preserve per-tenant scope across async tasks. This prevents cross-tenant data leakage.

How does ContextVar propagation work for multi-tenant request scoping?

ContextVar propagation for multi-tenant request scoping works by preserving the TenantContext across async tasks and background work. It defines a per-request scope containing org_id, user_id, roles, and permissions to ensure data access stays within the correct tenant.

How do I extract tenant context from incoming request headers?

Extracting tenant context from incoming request headers involves parsing the headers to build a TenantContext for downstream components. This context includes the org_id and user permissions needed to scope all subsequent data access correctly.

What is the best way to audit multi-tenant data access for cross-tenant leakage?

The best way to audit multi-tenant data access for cross-tenant leakage is to use an audit checklist and isolation-test templates. These validate that org_id filtering is correctly enforced across all queries, updates, and deletes to ensure compliance.

Can I use this tenant isolation approach for async background tasks?

Yes, you can use this tenant isolation approach for async background tasks. It uses ContextVar-based scope to maintain the TenantContext across asynchronous operations, ensuring that background work remains scoped to the correct org_id.

Why do I need an audit checklist for multi-tenant applications?

You need an audit checklist for multi-tenant applications to systematically validate tenant isolation and prevent compliance risks. It verifies that context propagation and per-tenant query patterns correctly enforce org_id filtering across the shared database.