---
title: Publish SaaS safely: login is not tenant isolation
description: Distinguish authentication from authorization and plan tenant boundaries, backups, deployment, logs and test-mode billing.
date: 2026-11-22
url: https://caminhosolo.com.br/en/2026/11/saas-publishing-and-security/
tags: [saas, seguranca, autorizacao, multitenancy, devops]
---


Your local prototype works. You can create a proposal and change its stage. It would be tempting to add login, hit “publish,” and start accepting users.

But there is a crucial difference between **an application that runs** and **a service that can responsibly accept other people's data**.

The previous lesson provides a local-only lab. It must not be placed on the public internet as-is: it has no authentication or authorization, and all records share one local database.

> **In brief:** authentication identifies the person; authorization determines what that person may do and which records they can access. Production SaaS needs a consistent data boundary, protected secrets, recovery, monitoring and safe billing/cancellation processes.

## Being signed in doesn't mean access to everything

Imagine two fictional organizations using our proposal tracker:

- **Horizon Studio** creates a website proposal.
- **Sunrise Design** creates a branding proposal.

Both have authenticated users. Someone from the first organization guesses the second organization's proposal identifier and requests it.

If the backend merely checks “this user is logged in” and reveals the proposal, **authorization is broken**. Identity was checked; permission to access that object was not.

[OWASP recommends tenant isolation](https://cheatsheetseries.owasp.org/cheatsheets/Multi_Tenant_Security_Cheat_Sheet.html): organization context must follow a server-verified identity and membership, and object access must respect authorization. A tenant identifier supplied by the browser is not permission by itself.

## A small architecture with a clear boundary

This flow describes **a production control to implement and test**, not protection already present in the unauthenticated local lab.

<link rel="stylesheet" href="/css/saas-learning.css">
<figure class="saas-learning saas-diagram" aria-label="The boundary between identity and data access">
  <figcaption class="saas-learning__heading">The boundary between identity and data access</figcaption>
  <p class="saas-learning__desc">Authentication alone is insufficient: the server verifies organization membership and permission to access the requested object.</p>
  <div class="saas-diagram__viewport" tabindex="0" role="region" aria-label="Scrollable diagram">
    <div class="saas-diagram__render" role="img" aria-label="The boundary between identity and data access. Authentication alone is insufficient: the server verifies organization membership and permission to access the requested object."><svg xmlns="http://www.w3.org/2000/svg" class="pele pele-flowchart" viewBox="0 0 524 776" width="524" height="776" style="max-width:100%;height:auto;--_bg:var(--pele-bg,#fff);--_fg:var(--pele-fg,#1f1f1f);--_m:var(--pele-muted,#6e6e6e);--_l:var(--pele-line,#1f1f1f);--_s:var(--pele-surface,#f3f3f3);--_a:var(--pele-surface-alt,#e6e6e6);--_b:var(--pele-border,#8a8a8a);--_c:var(--pele-accent,#5b7bd5);color:var(--_fg);--_r:var(--pele-radius,4px);--_fm:var(--pele-font-mono,monospace);font:15px sans-serif;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;font-family:var(--pele-font,Inter, sans-serif)" fill="var(--_fg)" role="graphics-document document" aria-roledescription="flowchart"><g class="pele-edges" fill="none" stroke="var(--_l)" stroke-linecap="round"><g class="pele-edge" data-id="L_A_B_0"><path d="M173.83,55L173.83,96"/><path class="pele-marker" d="M173.83,103L170.47,95L177.19,95Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge" data-id="L_B_X_0"><path d="M165.83,197.36C165.83,210.11 68.93,210.11 68.93,222.86L68.93,275.86"/><path class="pele-marker" d="M68.93,282.86L65.57,274.86L72.29,274.86Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge" data-id="L_B_C_0"><path d="M181.83,197.36C181.83,210.11 278.72,210.11 278.72,222.86L278.72,267.36"/><path class="pele-marker" d="M278.72,274.36L275.36,266.36L282.08,266.36Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge" data-id="L_C_D_0"><path d="M278.72,338.36L278.72,379.36"/><path class="pele-marker" d="M278.72,386.36L275.36,378.36L282.08,378.36Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge" data-id="L_D_Y_0"><path d="M246.62,516.51C246.62,536.8 149.22,536.8 149.22,557.08L149.22,601.58"/><path class="pele-marker" d="M149.22,608.58L145.86,600.58L152.58,600.58Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge" data-id="L_D_E_0"><path d="M310.83,516.51C310.83,536.8 408.22,536.8 408.22,557.08L408.22,601.58"/><path class="pele-marker" d="M408.22,608.58L404.86,600.58L411.58,600.58Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge" data-id="L_E_F_0"><path d="M408.22,672.58L408.22,713.58"/><path class="pele-marker" d="M408.22,720.58L404.86,712.58L411.58,712.58Z" fill="var(--_l)" stroke="none"/></g></g><g class="pele-edge-labels" font-size="13"><g class="pele-edge-label" data-id="L_B_X_0"><rect x="56.62" y="224.86" width="24.61" height="20" rx="3" fill="var(--_bg)"/><text x="68.93" y="239.41" text-anchor="middle">No</text></g><g class="pele-edge-label" data-id="L_B_C_0"><rect x="263.52" y="224.86" width="30.4" height="20" rx="3" fill="var(--_bg)"/><text x="278.72" y="239.41" text-anchor="middle">Yes</text></g><g class="pele-edge-label" data-id="L_D_Y_0"><rect x="136.92" y="559.08" width="24.61" height="20" rx="3" fill="var(--_bg)"/><text x="149.22" y="573.63" text-anchor="middle">No</text></g><g class="pele-edge-label" data-id="L_D_E_0"><rect x="393.02" y="559.08" width="30.4" height="20" rx="3" fill="var(--_bg)"/><text x="408.22" y="573.63" text-anchor="middle">Yes</text></g></g><g class="pele-nodes"><g class="pele-node pele-shape-rect cs-start" data-id="A" transform="translate(173.83,31.5)"><rect x="-90.95" y="-23.5" width="181.91" height="47" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" x="0" y="5.25" text-anchor="middle">Person sends request</text></g><g class="pele-node pele-shape-diam" data-id="B" transform="translate(173.83,152.68)"><polygon points="0,-49.68 79.49,0 0,49.68 -79.49,0" fill="var(--_s)" stroke="var(--_b)"/><text class="pele-label" x="0" y="5.25" text-anchor="middle">Valid identity?</text></g><g class="pele-node pele-shape-rect cs-loop" data-id="X" transform="translate(68.93,306.36)"><rect x="-60.93" y="-23.5" width="121.86" height="47" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" x="0" y="5.25" text-anchor="middle">Deny access</text></g><g class="pele-node pele-shape-rect" data-id="C" transform="translate(278.72,306.36)"><rect x="-108.86" y="-32" width="217.73" height="64" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" text-anchor="middle" xml:space="preserve"><tspan x="0" y="-4.75">Server verifies organization</tspan><tspan x="0" y="15.25">membership</tspan></text></g><g class="pele-node pele-shape-diam" data-id="D" transform="translate(278.72,461.47)"><polygon points="0,-75.11 120.18,0 0,75.11 -120.18,0" fill="var(--_s)" stroke="var(--_b)"/><text class="pele-label" text-anchor="middle" xml:space="preserve"><tspan x="0" y="-4.75">Allowed to access this</tspan><tspan x="0" y="15.25">proposal?</tspan></text></g><g class="pele-node pele-shape-rect cs-loop" data-id="Y" transform="translate(149.22,640.58)"><rect x="-111.38" y="-32" width="222.77" height="64" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" text-anchor="middle" xml:space="preserve"><tspan x="0" y="-4.75">Deny operation without data</tspan><tspan x="0" y="15.25">disclosure</tspan></text></g><g class="pele-node pele-shape-rect" data-id="E" transform="translate(408.22,640.58)"><rect x="-107.62" y="-32" width="215.24" height="64" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" text-anchor="middle" xml:space="preserve"><tspan x="0" y="-4.75">Query limited to authorized</tspan><tspan x="0" y="15.25">organization</tspan></text></g><g class="pele-node pele-shape-rect cs-goal" data-id="F" transform="translate(408.22,744.08)"><rect x="-106.37" y="-23.5" width="212.75" height="47" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" x="0" y="5.25" text-anchor="middle">Return permitted data only</text></g></g></svg>
</div>
  </div>
  <p class="saas-learning__note">Diagram source in <a href="/diagrams/saas-security.en.mmd">Mermaid</a>. Illustrative; the text defines the actual rules.</p>
</figure>

The safe logical path:

**Authenticated person → server-verified organization membership → allowed action → query scoped to that organization → response.**

The dangerous path:

**Authenticated person → browser supplies arbitrary organization → backend trusts it → another customer's data is returned.**

The difference deserves a real security test. **Change the organization and object identifier in a test request:** the server should not reveal or modify records belonging to another organization.

You can enforce this with explicit backend checks, database policies such as Row Level Security (RLS), or both. The right approach depends on architecture. [Supabase documents RLS](https://supabase.com/docs/guides/database/postgres/row-level-security), but merely enabling it without tested policies is insufficient.

## A publication checklist by responsibility

| Layer | Question | Practical check |
| --- | --- | --- |
| Identity | How do users sign in and recover accounts? | Expired sessions and recovery paths |
| Authorization | Can a user access another organization's data? | Cross-tenant tests with fictional accounts |
| Credentials | Are secret keys in the repository or browser? | Config and permission review |
| Database | Where are records and backups? | Practice a restore |
| Operations | What happens during outages? | Minimal safe logs and alerts |
| Privacy | Which data is truly necessary? | Inventory, access, retention and deletion |
| Billing | How are payments and cancellations verified? | Sandbox transactions and event handling |
| Releases | Can a faulty deployment be rolled back? | Rollback and migration plan |

This is an **acceptance boundary**, not a certification of legal compliance. Contract, tax and data-protection obligations vary by context and require additional verification.

## A test that catches serious mistakes

Create **two accounts and two fictional organizations** in an isolated environment, with one proposal belonging to each.

1. Sign in as organization A and open A's own proposal.
2. Attempt to access B's proposal using the known test identifier.
3. Attempt to update or delete B's proposal.
4. Try changing tenant identifiers in request body, path or headers.
5. Verify the backend does not reveal or alter B's data.
6. Repeat for different roles, expired sessions and administrative operations.

Hiding interface buttons is insufficient. **The protected operation itself must enforce authorization.**

Never probe other people's real services or customer data. This is a test of systems you own and control with fictional fixtures.

## Database rules require careful implementation

A field named organization_id provides no protection on its own. The backend must associate the tenant with a verified identity and consistently enforce authorization.

If you use RLS, inspect the database role, who can set the tenant context, which roles bypass policies, and how read/update/delete operations are tested.

[OWASP also documents object-level authorization](https://cheatsheetseries.owasp.org/cheatsheets/Authorization_Cheat_Sheet.html). APIs must therefore consider what happens when a valid user requests a valid identifier that belongs to someone else.

## Publishing means recovering too

Consider four incidents: a database migration fails, someone deletes records, an identity provider becomes unavailable, or a billing notification arrives twice.

Before inviting real customers, decide who investigates, how logs avoid leaking private data, how backups are restored, what time window recovery covers and how affected users are informed.

**An untested backup is a hope, not a recovery procedure.**

Deployment tools distribute software. They do not automatically own your operational responsibilities.

## Payments: test mode is not live mode

Use your payment provider's sandbox. Configure and validate event handling, confirm subscription status on the backend and implement safe retry behavior when the same webhook arrives twice.

Never grant access just because the browser reached a “success” page. Commercial confirmation must come from a trusted, validated event, with handling for cancellation, failure and refunds.

The local lab intentionally includes no billing. Do not use real customer cards to test it.

## AI in operations

Coding agents can help review code, write tests and inspect sanitized logs. That does not authorize them to read all customers' records or perform destructive migrations unattended.

Restrict tool access, protect secrets and require approval for actions with external effects. Faster coding does not reduce responsibility for customer safety.

## Workshop: a publication gate

Write a one-page record containing evidence of five checks: cross-tenant authorization, backup restore, secrets review, deployment rollback and sandbox billing.

For each, record **what was tested, how, the result and which failure would still block production**.

This is a stronger sign of progress than “the login page works.” Next, explore [first customers and onboarding](/en/2026/11/ai-saas-first-paying-customers/).

**Sources:** [OWASP — Multi-Tenant Security](https://cheatsheetseries.owasp.org/cheatsheets/Multi_Tenant_Security_Cheat_Sheet.html), [OWASP — Authorization](https://cheatsheetseries.owasp.org/cheatsheets/Authorization_Cheat_Sheet.html), and [Supabase — Row Level Security](https://supabase.com/docs/guides/database/postgres/row-level-security).

