Problem
collectRLSPolicies (packages/plugins/plugin-security/src/security-plugin.ts ~L2785-2793) drops any RLS policy whose using expression contains the substring current_user.organization_id whenever org scoping is inactive (!this.orgScopingEnabled):
if(!this.orgScopingEnabled&&policy.using&&policy.using.includes('current_user.organization_id')){continue;}The comment states the intent: strip the platform's own wildcard tenant policies in single-tenant deployments. But the substring match also swallows app-authored policies that legitimately reference current_user.organization_id. A declared, authored security policy is silently unenforced — exactly the ADR-0049 ("no unenforced security properties") defect class.
Verified on main (2026-07-27). This is finding F1 of ADR-0105; the ADR marks it P0, shipping in the open edition independent of the rest of the ADR (decision D3).
Fix direction (ADR-0105 D3)
- Stop substring-matching. Tag the platform's own wildcard
tenant_isolation policies with a provenance flag (or match on object === '*' ∧ shipped-by-default), and strip only tagged policies when isolation is inactive. - An authored policy referencing an unavailable context variable follows the existing availability path: fails closed at resolution, surfaced by the
isSupportedRlsExpression authoring lint. It is never silently dropped.
Acceptance
Refs: ADR-0105 (F1/D3), ADR-0049.
Problem
collectRLSPolicies(packages/plugins/plugin-security/src/security-plugin.ts~L2785-2793) drops any RLS policy whoseusingexpression contains the substringcurrent_user.organization_idwhenever org scoping is inactive (!this.orgScopingEnabled):The comment states the intent: strip the platform's own wildcard tenant policies in single-tenant deployments. But the substring match also swallows app-authored policies that legitimately reference
current_user.organization_id. A declared, authored security policy is silently unenforced — exactly the ADR-0049 ("no unenforced security properties") defect class.Verified on
main(2026-07-27). This is finding F1 of ADR-0105; the ADR marks it P0, shipping in the open edition independent of the rest of the ADR (decision D3).Fix direction (ADR-0105 D3)
tenant_isolationpolicies with a provenance flag (or match onobject === '*'∧ shipped-by-default), and strip only tagged policies when isolation is inactive.isSupportedRlsExpressionauthoring lint. It is never silently dropped.Acceptance
current_user.organization_idinusingsurvives collection in a deployment without org scoping (fails closed at resolution, with lint surfacing — not dropped).authz-matrix-gatesnapshot beyond the intended correction.Refs: ADR-0105 (F1/D3), ADR-0049.