Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    Spring Boot Multi-tenant SaaS

    1

    Audit Spring Boot and Java SaaS backends for tenant isolation, context propagation, and cross-tenant data leaks.

    $19

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    Spring Boot Multi-tenant SaaS

    Spring Boot Multi-tenant SaaS

    Example session with this skill installed

    Audit our multi-tenancy in the /app folder. We use Spring Boot with a schema-per-tenant approach and PgBouncer. Check for data leaks.

    • Read your context and instructions
    • Compiled the spring boot multi-tenant

    I have completed the multi-tenant architecture audit for the /app directory. I identified a

    schema-per-tenant model with high confidence based on the TenantIdentifierResolver implementation.

    Multi-Tenant Audit Report — backend-service @ 2023-10-24

    Scope: src/main/java/**, src/main/resources/**. Tenancy model: Schema-per-tenant (High confidence).

    Summary — P0: 1 | P1: 2 | P2: 0 | Can't-tell: 1

    Findings

    [P0] MT-02 — Session-level SET with Connection Pooler

    • Evidence: src/main/java/com/saas/config/TenantSchemaInterceptor.java:42
    statement.execute("SET search_path TO " + tenantId);
    

    Why it matters: Using SET instead of SET LOCAL inside a transaction while using PgBouncer can leak the schema context to the next tenant using the same physical connection.

    How to verify: Deploy to a staging env with PgBouncer in transaction mode and trace schema resolution across concurrent requests.

    Suggested fix: Wrap in a transaction and use SET LOCAL search_path TO... or use a dedicated MultiTenantConnectionProvider.

    [P1] MT-06 — Async path without tenant propagation

    • Evidence: src/main/java/com/saas/service/ReportService.java:112

    Why it matters: The @Async method generateExport() triggers without capturing the TenantContext. The background thread will default to the 'public' schema or fail.

    • Suggested fix: Use a TaskDecorator to copy the ThreadLocal context to the new thread.

    [P1] MT-04 — Cache keys without tenant prefix

    • Evidence: src/main/java/com/saas/repository/ProductRepo.java:15

    Why it matters: @Cacheable(value = "products") lacks a tenant discriminator. Tenant A may see Tenant B's cached products.

    • Suggested fix: Update the cache key to include tenantId: key = "#root.target.tenantId + #id".

    Next steps

    1. Patch the SET LOCAL P0 finding immediately to prevent cross-contamination in production.
    2. Implement a TaskDecorator for the ThreadPoolTaskExecutor to fix the async leaks.
    3. Update the RedisCacheManager configuration to globally prefix keys with the tenant identifier.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Building multi-tenant SaaS on Spring Boot is high-stakes. A single missing ThreadLocal cleanup or a forgotten SET LOCAL search_path can lead to cross-tenant data leaks. This skill performs a targeted static analysis of your Java backend to ensure tenant isolation is ironclad across synchronous and asynchronous execution paths.

    What it does

    • Identify tenancy models by detecting schema-per-tenant, row-level, or database-per-tenant patterns in your source code.
    • Trace context propagation through HTTP filters, @Async methods, @Scheduled jobs, and Kafka consumers.
    • Audit data access for native queries that bypass scoping and connection pooler misconfigurations like session-level SET commands.
    • Scan cache and logs to ensure Redis keys and audit trails are correctly scoped with tenant prefixes.
    • Check provisioning logic for idempotency and migration safety across per-tenant Flyway instances.

    How it works

    1. Recon Phase: Scans for tenant_id columns, search_path wiring, and JWT parsing to establish the current isolation strategy.
    2. Propagation Trace: Maps every execution path to verify the TenantContext is set before business logic executes and cleared in finally blocks.
    3. Severity Audit: Executes a checklist of P0 to P2 findings, verifying each against specific file and line references.
    4. Report Generation: Produces a structured audit report with evidence snippets, risk assessments, and concrete remediation steps.

    Frameworks & tools

    Built specifically for Spring Boot and Java environments. It analyzes components like Spring Security, Hibernate, Flyway, Redis, Kafka, and PostgreSQL connection poolers like PgBouncer.

    Why this beats prompting it yourself

    Generic AI reviews often miss the subtle lifecycle of a ThreadLocal or the nuances of how a connection pooler interacts with PostgreSQL schemas. This skill uses a rigid severity-ordered checklist designed specifically for SaaS architecture, ensuring no execution path or caching layer is left unverified.

    Use cases

    • Reviewing a new microservice for tenant isolation before it goes to production.
    • Auditing legacy code for potential data leaks after migrating from row-level to schema-per-tenant.
    • Verifying that background workers and cron jobs are correctly scoped to specific tenants.
    • Ensuring per-tenant database migrations won't conflict during auto-provisioning.

    Known limitations

    This is a static analysis tool that reads code only. It cannot detect runtime environmental misconfigurations or infrastructure-level leaks outside of the application code.

    Static analysis only; does not run code. Cannot detect infrastructure-level leaks (e.g., VPC peering issues) or runtime environment variables not present in source code.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 1 month ago

    Permissions

    No special permissions declared or detected

    Listed1 month ago

    What's inside

    Frequently Asked Questions

    The skill performs a deep static analysis of your Java code to ensure that every execution path—including background tasks and async threads—correctly isolates data by tenant, preventing catastrophic cross-tenant leaks.

    This skill is designed for any AI agent that supports file-based context or codebase analysis, such as GitHub Copilot, Cursor, or ChatGPT Plus with codebase indexing.

    You receive the specialized audit workflow, a comprehensive severity-ordered checklist for SaaS architecture, and a structured reporting template for documenting findings and remediation steps.

    Yes, while it specializes in Spring Boot, the skill identifies tenancy patterns in standard Java patterns, Hibernate/JPA configurations, and common tools like Redis, Kafka, and Flyway.

    The skill identifies code-level vulnerabilities, such as missing ThreadLocal cleanups or unscoped Redis keys, but it cannot detect runtime infrastructure issues like misconfigured load balancer rules or VPC leaks.

    New in APIs & Backend