V9.22.1
Security release. Upgrade is recommended for anyone using sharded tenancy together with Events.UseTenantPartitionedEvents.
A tenant id was interpolated into a double-quoted PostgreSQL identifier without doubling an embedded double quote, so a tenant id containing one could terminate the identifier and execute additional SQL statements. This is a different class from the two advisories previously published on this repository, both of which were the single-quoted string-literal class; neither of those fixes addressed this.
You are affected only if you use sharded tenancy, have UseTenantPartitionedEvents enabled, and your application passes attacker-influenced input as a tenant id. Note that the reachable surface includes ordinary session resolution, not just administrative provisioning calls — GetTenantAsync / FindOrCreateDatabase auto-provision an unknown tenant. Applications using tenant ids from a trusted fixed set are not exploitable.
Affected versions: 9.4.0 through 9.22.0.
Full details, including remediation guidance for existing data, are in the security advisory: GHSA-3vp4-34pf-2rcw
What changed
PerTenantEventSequences.QuotedSequenceNameescapes embedded quotes, matchingquote_ident/%Iso the name still resolves to the same object the quick-append function finds. Covers the create, drop, schema-apply and cleanup paths.BulkEventAppenderno longer builds an unquoted sequence name from a suffix read back out of the tenants table. This also fixes a functional bug:PreserveSourceSequencebulk imports previously failed with42601for hyphenated and GUID tenant ids under sharded tenancy.ShardedTenancyvalidates tenant ids destined for DDL, closing a long-standing asymmetry with theDefaultTenancyprovisioning path. It is a narrow denylist rather than the existing identifier allowlist, so hyphenated and GUID tenant ids keep working.
Dependency
Requires Weasel.Postgresql 9.21.1, which escapes partition bound values (JasperFx/weasel#416). Both halves are needed; the dependency is pulled in automatically.
Credit to Barak Srour (Apiiro) for the report.