What happens if an attacker executes `SET app.current_tenant` a second time on the existing connection (e.g. through SQL injection)?
We're planning to introduce an immutable session variable later this year to make the session-based approach more viable. It won't stop someone from tampering with the tenant_id before it's initially set, but it will prevent any changes afterward. Though in practice, most of our customers aren’t too concerned. They have application-layer guardrails in place and are confident that users can’t tamper with session state directly.
But yes, there are trade offs either way.