audit-tenant

Detect tenant-scope violations in code diffs and generate severity-labeled reports.

4|Updated Mar 21, 2026
One-click install
npx skills add https://github.com/leocosta/octopus --skill audit-tenant
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: audit-tenant
Source: https://github.com/leocosta/octopus/tree/main/skills/audit-tenant
Command: npx skills add https://github.com/leocosta/octopus --skill audit-tenant

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Pre-merge audit of multi-tenant data-scope enforcement (branch/PR): detects queries bypassing tenant filters, checks for missing HasQueryFilter on new DbContext entities, identifies raw SQL queries without tenant restriction, flags route-id ownership gaps, spots joins to unfiltered tables, and detects cross-tenant admin endpoints. Severity-tiered report with confidence labels.

Core Features & Use Cases

  • Evaluates code changes for tenant-scope violations across EF Core contexts and controllers.
  • Generates a consolidated report suitable for PR comments, and composes with audit-skills to provide a unified view.
  • Supports configuration via .octopus.yml tenantScope and defaults to safe behavior when misconfigured.

Quick Start

Run the audit-tenant skill on your diff to generate a tenant-scope report.

Frequently Asked Questions about audit-tenant

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

FAQPage Schema
How do I audit EF Core queries for multi-tenant data isolation violations before merging?

To audit EF Core queries for multi-tenant data isolation, scan pre-merge diffs to detect queries bypassing tenant filters, missing HasQueryFilter implementations on new entities, and unfiltered raw SQL, generating a severity-tiered report.

What is a tenant-scope violation in a SaaS application codebase?

A tenant-scope violation occurs when data access bypasses tenant filters, such as using raw SQL without tenant restrictions, joining unfiltered tables, or missing HasQueryFilter on new EF Core DbContext entities, exposing cross-tenant data.

How do I configure tenant scope rules for a diff analysis in .octopus.yml?

Configure tenant scope rules by defining the tenantScope settings in your .octopus.yml file to validate fields, defaults, and entities, ensuring the audit correctly checks for route-id ownership gaps and cross-tenant admin endpoints.

Can I detect cross-tenant admin endpoints and ID-based ownership gaps in a pull request?

Yes, you can detect cross-tenant admin endpoints and ID-based ownership gaps by applying a pre-merge diff analysis that flags route-id ownership gaps and evaluates controllers for unauthorized cross-tenant access.

What happens if the tenant scope configuration is missing or misconfigured?

If the tenant scope configuration is missing or misconfigured, the audit defaults to safe behavior to prevent false negatives, ensuring potential tenant-scope violations are still reported with severity and confidence labels.