Skip to main content

CAP.L0.TENANCY_NOT_DECLARED — this project looks multi-tenant and has not said so

  • Category: safety
  • Level: 0
  • Stability: stable
  • Suites: audit

Signals in this project suggest it is multi-tenant, and sqlens.audit.tenancy.mode is still none.

The failure this prevents

With several tenant databases, auditing whichever connection happens to be the default produces a report about one customer that is indistinguishable from a report about the application: same header, same findings, same exit code. A reader draws a conclusion about their system from a statement about one tenant's database.

There is no safe default here. Every tenant is the wrong one to pick on somebody's behalf, so the run stops instead of choosing.

The check is a heuristic, and saying so is a valid answer

The notice names the signals it found, because "this looks multi-tenant" without them is an assertion you cannot check. The heuristic is allowed to be wrong.

What to do

Either declare a reference tenant:

// config/sqlens.php
'audit' => [
'tenancy' => [
'mode' => 'explicit',
'reference' => 'tenant_reference',
],
],

…or say the signals are wrong, deliberately:

'audit' => ['tenancy' => ['mode' => 'none']],

Setting none on purpose is a real answer. What is not an answer is leaving the question open while the report claims to be about the application.