Skip to main content

CAP.L0.INSTANCE_AMBIGUOUS — more than one connection could be the one to audit

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

sqlens:audit produces a report about one database. When the project configures several connections the audit could plausibly mean, and neither a flag nor the config says which, the run stops here instead of choosing one.

Why not just take the default connection

Because the report would not say it had chosen. A finding about mysql and a finding about analytics are indistinguishable once they are in a list, and a reader would draw a conclusion about their application from a statement about a reporting replica.

Picking on the project's behalf is the one thing that turns a correct report into a misleading one.

What to do

Name the connection:

php artisan sqlens:audit --connection=mysql

…or settle it once, in config:

// config/sqlens.php
'connection' => 'mysql',

The notice lists the candidates it found, so the choice is between names you can see rather than names you have to go and look up.