Security19
vttestserver passes ZooKeeper auth and TLS flags to vtcombo
Affectsvttestserver setups using an external topology
Additional actionThe relevant --topo-zk-auth-file and/or --topo-zk-tls-* flags are configured.
Previously, vtcombo did not use the same ZooKeeper identity or TLS settings, which could leave world:anyone znodes under open roots. It now authenticates as the same identity and dials ZooKeeper using the same TLS settings as vttestserver.
Show release-note lines
With `--topo-zk-auth-file` set, `zk2topo` authenticated its ZooKeeper session but still created every znode, lock and election nodes included, with a `world:anyone` ACL, so any client that could reach the ensemble could read, change or delete the topology ([GHSA-9c2c-hxwj-c5jr](https://github.com/vitessio/vitess/security/advisories/GHSA-9c2c-hxwj-c5jr)). Znodes are now created with ZooKeeper's `auth` ACL scheme, so only the auth file's identity can access them. A missing, unreadable or malformed auth file, or a failed `AddAuth`, now fails the connection instead of continuing unauthenticated. A `digest` auth file must hold both a user and a password, and a trailing CR is dropped like a trailing LF. `vtctldclient`, `topo2topo` and the `zk` tool now take the `--topo-zk-*` flags, and `vttestserver` passes `--topo-zk-auth-file` and the `--topo-zk-tls-*` flags on to `vtcombo`. Without an auth file, nothing changes.
github.com/vitessio/vitess/releases/tag/v23.0.9mTLS authorization checks the verified certificate and rejects empty substring entries
AffectsmTLS processes with an unset, empty, or colon-delimited empty --grpc-auth-mtls-allowed-substrings entry
Additional actionNon-empty allowed-substring entries that match each client certificate's Go-formatted subject
Previously, a client could be admitted because an appended self-signed certificate matched an allowed subject even when its verified leaf did not; RPCs from clients matching only a non-leaf certificate now fail with Unauthenticated. An empty entry now causes the process to exit at startup with a fatal Failed to load auth plugin error.
Show release-note lines
With `--grpc-auth-mode=mtls`, `--grpc-auth-mtls-allowed-substrings` was matched against every certificate the client presented, not just the one verified against `--grpc-ca`. A client with any certificate from that CA could append a self-signed certificate with an allowed subject and be admitted ([GHSA-xhx6-rmm2-5h2p](https://github.com/vitessio/vitess/security/advisories/GHSA-xhx6-rmm2-5h2p)). The flag is now matched only against the subject of the verified leaf certificate. In mtls mode the flag can also no longer have an empty entry, which matched every subject: an unset or empty value (the default), or a leading, trailing or repeated colon, such as in `CN=vtctld:`.
- A process started with `--grpc-auth-mode=mtls` logs `Failed to load auth plugin` as a fatal error, with a dump of all goroutines, and exits if `--grpc-auth-mtls-allowed-substrings` has an empty entry.
github.com/vitessio/vitess/releases/tag/v23.0.9Reshard workflow filter substitution fixed
Affectskeyspaces using Reshard SwitchTraffic
During Reshard SwitchTraffic, a filter in another workflow in the keyspace containing {{—for example, in a moved table name—could be rewritten or crash vtctld after source writes were stopped. The command now substitutes the key-range placeholder literally and rejects filters with any other {{; writes stay on source shards, while replica and rdonly reads switched by the same command stay switched, and --dry-run reports the error.
Show release-note lines
`CopySchemaShard`, which `Reshard` also runs for each new shard unless `--skip-schema-copy` is set, filled the `{{.DatabaseName}}` placeholder by executing each copied `SHOW CREATE` statement as a Go `text/template`. A user able to run DDL could put template actions in, for example, a table comment, and make Vitess run arbitrary SQL as the DBA user on the destination primaries ([GHSA-7g75-v57j-2ghw](https://github.com/vitessio/vitess/security/advisories/GHSA-7g75-v57j-2ghw)). The same pattern existed when a Reshard migrates the keyspace's other workflows (each stream's filter, which can contain table names, was executed as a template to fill in the key range) and in the legacy `vtctl` materializer (`MoveTables`, `Materialize`, `Migrate`, `CreateLookupVindex`). VDiff's `--debug-query` used the diffed query's `FROM` clause as a format string, so a `%` in a table name crashed vttablet. Placeholders are now substituted literally, and nothing else in the text is interpreted.
- A Reshard's `SwitchTraffic` fails to switch writes if another workflow in the keyspace has a filter that contains `{{`, for example a moved table whose name contains it. Writes stay on the source shards; replica and rdonly reads that the same command switched stay switched, and `--dry-run` reports the error.github.com/vitessio/vitess/releases/tag/v23.0.9VTGate MySQL packet reads fixed after buffer recycling
AffectsVTGate MySQL server connections handling auth-switch responses or replication commands
During login, auth-switch responses, replication-command arguments, and error replies to some malformed commands could use bytes overwritten by another connection after a packet buffer was returned to the shared pool. After the fix, replication commands are parsed before recycling, auth-switch responses use a separate buffer, and recycled read packets are cleared.
Show release-note lines
- Fixes [GHSA-g6c2-qp3p-x2w2](https://github.com/vitessio/vitess/security/advisories/GHSA-g6c2-qp3p-x2w2): the VTGate MySQL server kept reading a client's packet after returning its buffer to the shared buffer pool, where another connection could overwrite it. The auth switch response checked during login, the arguments of the replication commands, and the error replies to some malformed commands could use bytes from another connection's packet. See [#22247](https://github.com/vitessio/vitess/pull/22247).
github.com/vitessio/vitess/releases/tag/v23.0.9ZooKeeper znode ACLs restricted to the authenticated identity
AffectsZooKeeper topologies using --topo-zk-auth-file
Additional actionExisting znodes need addauth digest <user>:<password> and setAcl -R <parent> auth::cdrwa on the common parent in each ensemble, after every component runs v23.0.9 with the auth file.
Previously, any client that could reach the ensemble could read, change, or delete topology znodes, even when the auth file was set. New znodes are restricted to the authenticated identity; znodes created before the upgrade keep their existing ACLs until changed separately.
Show release-note lines
### ZooKeeper topology znodes are restricted to the `--topo-zk-auth-file` identity
With `--topo-zk-auth-file` set, `zk2topo` authenticated its ZooKeeper session but still created every znode, lock and election nodes included, with a `world:anyone` ACL, so any client that could reach the ensemble could read, change or delete the topology ([GHSA-9c2c-hxwj-c5jr](https://github.com/vitessio/vitess/security/advisories/GHSA-9c2c-hxwj-c5jr)). Znodes are now created with ZooKeeper's `auth` ACL scheme, so only the auth file's identity can access them. A missing, unreadable or malformed auth file, or a failed `AddAuth`, now fails the connection instead of continuing unauthenticated. A `digest` auth file must hold both a user and a password, and a trailing CR is dropped like a trailing LF. `vtctldclient`, `topo2topo` and the `zk` tool now take the `--topo-zk-*` flags, and `vttestserver` passes `--topo-zk-auth-file` and the `--topo-zk-tls-*` flags on to `vtcombo`. Without an auth file, nothing changes.
- Every component that shares the topology must use the same ZooKeeper identity, `vtctldclient --server internal` and `topo2topo` included. A component with another identity, or none, gets `zk: not authenticated`.
github.com/vitessio/vitess/releases/tag/v23.0.9ZooKeeper topology access now fails closed on auth errors
Affectsdeployments using --topo-zk-auth-file
Additional actionFor existing znodes, an ACL update in each ZooKeeper ensemble after every component runs this release with the auth file: addauth digest <user>:<password>, followed by setAcl -R <parent> auth::cdrwa on the common parent of the global and cell roots.
Previously, missing, unreadable or malformed auth files and failed AddAuth calls could leave components unauthenticated, and a digest file did not have to contain both a user and password. These conditions now fail the connection or topology calls instead.
Show release-note lines
With `--topo-zk-auth-file` set, `zk2topo` authenticated its ZooKeeper session but still created every znode, lock and election nodes included, with a `world:anyone` ACL, so any client that could reach the ensemble could read, change or delete the topology ([GHSA-9c2c-hxwj-c5jr](https://github.com/vitessio/vitess/security/advisories/GHSA-9c2c-hxwj-c5jr)). Znodes are now created with ZooKeeper's `auth` ACL scheme, so only the auth file's identity can access them. A missing, unreadable or malformed auth file, or a failed `AddAuth`, now fails the connection instead of continuing unauthenticated. A `digest` auth file must hold both a user and a password, and a trailing CR is dropped like a trailing LF. `vtctldclient`, `topo2topo` and the `zk` tool now take the `--topo-zk-*` flags, and `vttestserver` passes `--topo-zk-auth-file` and the `--topo-zk-tls-*` flags on to `vtcombo`. Without an auth file, nothing changes.
- A component whose auth file can't be read or parsed, or a `digest` file without a password, now fails every topology call. Before upgrading, check that no component logs `failed to read topo-zk-auth-file`, `failed to parse topo-zk-auth-file contents` or `failed to add auth from topo-zk-auth-file`.
github.com/vitessio/vitess/releases/tag/v23.0.9gRPC mTLS allow-list checks limited to verified leaf certificates
AffectsgRPC mutual TLS configured with --grpc-auth-mode=mtls
Previously, a client with a certificate verified against --grpc-ca could be admitted by appending a self-signed certificate whose subject matched an allowed substring. Clients whose allow-list entry matches only a non-leaf certificate can now have component RPCs fail with client certificate not authorized (Unauthenticated).
Show release-note lines
With `--grpc-auth-mode=mtls`, `--grpc-auth-mtls-allowed-substrings` was matched against every certificate the client presented, not just the one verified against `--grpc-ca`. A client with any certificate from that CA could append a self-signed certificate with an allowed subject and be admitted ([GHSA-xhx6-rmm2-5h2p](https://github.com/vitessio/vitess/security/advisories/GHSA-xhx6-rmm2-5h2p)). The flag is now matched only against the subject of the verified leaf certificate. In mtls mode the flag can also no longer have an empty entry, which matched every subject: an unset or empty value (the default), or a leading, trailing or repeated colon, such as in `CN=vtctld:`.
- An entry that matches only a non-leaf certificate, such as an intermediate CA's subject, no longer admits the client. RPCs between components, such as VTGate, VTOrc or vtctld calling an upgraded VTTablet, can fail with `client certificate not authorized` (gRPC code `Unauthenticated`), which the server doesn't log.
github.com/vitessio/vitess/releases/tag/v23.0.9Strict table ACL checks for option-named tables fixed
Affectstable options that name other tables under strict table ACL
Additional action--queryserver-config-strict-table-acl
Previously, checking only the table named by CREATE TABLE or ALTER TABLE let a user with ADMIN on it read and write tables named by a MERGE UNION=(...) option despite ACL denials. Those option-named tables now require READER and WRITER; operations lacking either permission are denied.
Show release-note lines
Under strict table ACL (`--queryserver-config-strict-table-acl`), only the table a `CREATE TABLE` or `ALTER TABLE` names was checked. A MERGE table's `UNION=(...)` option, a `CREATE TABLE ... LIKE` of a MERGE table, and `ALTER TABLE ... EXCHANGE PARTITION` let a user with ADMIN on one table read and write tables the ACL denied them, and so could a FEDERATED table's `CONNECTION` string where that engine is enabled ([GHSA-q4ch-mhpm-9368](https://github.com/vitessio/vitess/security/advisories/GHSA-q4ch-mhpm-9368)). Now:
- tables named by a table option, and the source of `CREATE TABLE ... LIKE`, require READER and WRITER;
github.com/vitessio/vitess/releases/tag/v23.0.9Source-table ACL bypass in CREATE TABLE ... LIKE fixed
Affectstablets with strict table ACL enabled
Additional action--queryserver-config-strict-table-acl enabled
Previously, CREATE TABLE ... LIKE could bypass the source table’s ACL, letting a user with ADMIN on one table read and write tables the ACL denied. The source table now requires the caller to have READER and WRITER.
Show release-note lines
Under strict table ACL (`--queryserver-config-strict-table-acl`), only the table a `CREATE TABLE` or `ALTER TABLE` names was checked. A MERGE table's `UNION=(...)` option, a `CREATE TABLE ... LIKE` of a MERGE table, and `ALTER TABLE ... EXCHANGE PARTITION` let a user with ADMIN on one table read and write tables the ACL denied them, and so could a FEDERATED table's `CONNECTION` string where that engine is enabled ([GHSA-q4ch-mhpm-9368](https://github.com/vitessio/vitess/security/advisories/GHSA-q4ch-mhpm-9368)). Now:
- tables named by a table option, and the source of `CREATE TABLE ... LIKE`, require READER and WRITER;
github.com/vitessio/vitess/releases/tag/v23.0.9Partition exchange ACL bypass fixed
Affectstablets with strict table ACL enabled
Previously, ALTER TABLE ... EXCHANGE PARTITION checked only the named table, which could let a user read or write the other table despite its ACL. The exchange now requires ADMIN, READER, and WRITER on both tables.
Show release-note lines
Under strict table ACL (`--queryserver-config-strict-table-acl`), only the table a `CREATE TABLE` or `ALTER TABLE` names was checked. A MERGE table's `UNION=(...)` option, a `CREATE TABLE ... LIKE` of a MERGE table, and `ALTER TABLE ... EXCHANGE PARTITION` let a user with ADMIN on one table read and write tables the ACL denied them, and so could a FEDERATED table's `CONNECTION` string where that engine is enabled ([GHSA-q4ch-mhpm-9368](https://github.com/vitessio/vitess/security/advisories/GHSA-q4ch-mhpm-9368)). Now:
- both tables of `EXCHANGE PARTITION` require ADMIN, READER and WRITER;
github.com/vitessio/vitess/releases/tag/v23.0.9Strict table ACL denies statements with undetermined table sets
Affectstablets using strict table ACL
Additional action--queryserver-config-strict-table-acl
Previously, partially parsed ALTER TABLE and CREATE INDEX statements were forwarded to MySQL, so their unparsed tails could name tables the planner had not checked. They are now denied when Vitess cannot determine the table set; the note also applies this denial to CREATE TABLE or ALTER TABLE statements that set CONNECTION, subject to the stated ACL and all-roles table-group exceptions.
Show release-note lines
Under strict table ACL (`--queryserver-config-strict-table-acl`), only the table a `CREATE TABLE` or `ALTER TABLE` names was checked. A MERGE table's `UNION=(...)` option, a `CREATE TABLE ... LIKE` of a MERGE table, and `ALTER TABLE ... EXCHANGE PARTITION` let a user with ADMIN on one table read and write tables the ACL denied them, and so could a FEDERATED table's `CONNECTION` string where that engine is enabled ([GHSA-q4ch-mhpm-9368](https://github.com/vitessio/vitess/security/advisories/GHSA-q4ch-mhpm-9368)). Now:
- a partially parsed `ALTER TABLE` or `CREATE INDEX`, and a `CREATE TABLE` or `ALTER TABLE` that sets `CONNECTION`, are denied with `command denied ... for a table set that cannot be determined`. The exceptions are the exempt ACL (`--queryserver-config-acl-exempt-acl`) and a caller with every role in a table group covering every table (`%`).
github.com/vitessio/vitess/releases/tag/v23.0.9Strict table ACL denies CONNECTION statements
Affectstablets with strict table ACL enabled
Additional action--queryserver-config-strict-table-acl
Previously, a CONNECTION string could bind a table to another table without checking that table against the ACL, allowing reads and writes the ACL denied; the note calls this out for FEDERATED tables when that engine is enabled. Now CREATE TABLE and ALTER TABLE statements that set CONNECTION are denied regardless of engine, except for the exempt ACL and callers with every role in a table group covering every table (%).
Show release-note lines
Under strict table ACL (`--queryserver-config-strict-table-acl`), only the table a `CREATE TABLE` or `ALTER TABLE` names was checked. A MERGE table's `UNION=(...)` option, a `CREATE TABLE ... LIKE` of a MERGE table, and `ALTER TABLE ... EXCHANGE PARTITION` let a user with ADMIN on one table read and write tables the ACL denied them, and so could a FEDERATED table's `CONNECTION` string where that engine is enabled ([GHSA-q4ch-mhpm-9368](https://github.com/vitessio/vitess/security/advisories/GHSA-q4ch-mhpm-9368)). Now:
- a partially parsed `ALTER TABLE` or `CREATE INDEX`, and a `CREATE TABLE` or `ALTER TABLE` that sets `CONNECTION`, are denied with `command denied ... for a table set that cannot be determined`. The exceptions are the exempt ACL (`--queryserver-config-acl-exempt-acl`) and a caller with every role in a table group covering every table (`%`).
github.com/vitessio/vitess/releases/tag/v23.0.9Strict table ACL now rejects unsupported SERIAL columns
Affectstablets with strict table ACL enabled
Additional action--queryserver-config-strict-table-acl
The parser does not support SERIAL; spelling it out as BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE avoids that unsupported type syntax.
Show release-note lines
- On this release the parser also has no `SERIAL` column type, so an `ALTER TABLE` that defines a `SERIAL` column is denied as well. Spell the type out (`BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE`).
github.com/vitessio/vitess/releases/tag/v23.0.9Unsafe template execution in CopySchemaShard fixed
Affectssetups that use CopySchemaShard, including Reshard schema copy unless --skip-schema-copy is set
A user able to run DDL could put template actions in a copied definition, causing arbitrary SQL to run as the DBA on destination primaries; malformed actions could also panic CopySchemaShard or crash vtctld during Reshard. Copied definitions now treat template actions literally and are refused if database-name substitution leaves more than one statement.
Show release-note lines
`CopySchemaShard`, which `Reshard` also runs for each new shard unless `--skip-schema-copy` is set, filled the `{{.DatabaseName}}` placeholder by executing each copied `SHOW CREATE` statement as a Go `text/template`. A user able to run DDL could put template actions in, for example, a table comment, and make Vitess run arbitrary SQL as the DBA user on the destination primaries ([GHSA-7g75-v57j-2ghw](https://github.com/vitessio/vitess/security/advisories/GHSA-7g75-v57j-2ghw)). The same pattern existed when a Reshard migrates the keyspace's other workflows (each stream's filter, which can contain table names, was executed as a template to fill in the key range) and in the legacy `vtctl` materializer (`MoveTables`, `Materialize`, `Migrate`, `CreateLookupVindex`). VDiff's `--debug-query` used the diffed query's `FROM` clause as a format string, so a `%` in a table name crashed vttablet. Placeholders are now substituted literally, and nothing else in the text is interpreted.
- `CopySchemaShard`, and so `Reshard`'s schema copy, refuses a copied definition that is more than one statement once the database name is filled in.github.com/vitessio/vitess/releases/tag/v23.0.9VDiff ANALYZE TABLE identifier escaping fixed
AffectsVDiff runs with --update-table-stats
When a database or table name contained a back quote, the unescaped identifier could produce a statement that did not analyze the intended table. VDiff now escapes both identifiers, including embedded back quotes; ordinary table names produce unchanged statements.
Show release-note lines
- Fixes [GHSA-mmjh-49cg-g5v2](https://github.com/vitessio/vitess/security/advisories/GHSA-mmjh-49cg-g5v2): SQL injection through table names in the `ANALYZE TABLE` that VDiff runs for `--update-table-stats`. See [#22243](https://github.com/vitessio/vitess/pull/22243).
github.com/vitessio/vitess/releases/tag/v23.0.9VTGate sends only an error for unknown COM_SET_OPTION operations
AffectsVTGate MySQL clients using COM_SET_OPTION
For an unknown operation, the old error-then-OK response left the client one reply out of step. Malformed-command error text may differ, but error codes and SQL states remain unchanged.
Show release-note lines
- Fixes [GHSA-g6c2-qp3p-x2w2](https://github.com/vitessio/vitess/security/advisories/GHSA-g6c2-qp3p-x2w2): the VTGate MySQL server kept reading a client's packet after returning its buffer to the shared buffer pool, where another connection could overwrite it. The auth switch response checked during login, the arguments of the replication commands, and the error replies to some malformed commands could use bytes from another connection's packet. See [#22247](https://github.com/vitessio/vitess/pull/22247).
github.com/vitessio/vitess/releases/tag/v23.0.9VTGate COM_REGISTER_SLAVE packet length checks added
AffectsVTGate MySQL server connections handling COM_REGISTER_SLAVE packets
When a packet declared a hostname, username, or password length extending past the packet, the parser could read beyond it or panic and close the connection.
Show release-note lines
- Fixes [GHSA-g6c2-qp3p-x2w2](https://github.com/vitessio/vitess/security/advisories/GHSA-g6c2-qp3p-x2w2): the VTGate MySQL server kept reading a client's packet after returning its buffer to the shared buffer pool, where another connection could overwrite it. The auth switch response checked during login, the arguments of the replication commands, and the error replies to some malformed commands could use bytes from another connection's packet. See [#22247](https://github.com/vitessio/vitess/pull/22247).
github.com/vitessio/vitess/releases/tag/v23.0.9VDiff and Reshard escape replication positions in stop_pos updates
AffectsVDiff and Reshard workflows writing source-tablet positions to stop_pos
Previously, a quote in a source tablet's replication position—including a quote in a FilePos filename—could produce a broken or injectable SQL statement. This could happen when VDiff wrote snapshot positions or Reshard switched writes.
Show release-note lines
- Fixes [GHSA-hqg6-fhvc-3vmf](https://github.com/vitessio/vitess/security/advisories/GHSA-hqg6-fhvc-3vmf): SQL injection through a replication position from a source tablet in the `stop_pos` update that VDiff runs and in the update that `Reshard` runs when switching writes. See [#22250](https://github.com/vitessio/vitess/pull/22250).
github.com/vitessio/vitess/releases/tag/v23.0.9VDiff SQL injection via source positions fixed
When a source tablet reported a snapshot position that could not be parsed, VDiff updated the target stream's stop_pos before failing while waiting for the position. VDiff now parses source positions first: invalid values fail before the update, while valid values are re-encoded and stored; target snapshot positions are not parsed.
Show release-note lines
- Fixes [GHSA-hqg6-fhvc-3vmf](https://github.com/vitessio/vitess/security/advisories/GHSA-hqg6-fhvc-3vmf): SQL injection through a replication position from a source tablet in the `stop_pos` update that VDiff runs and in the update that `Reshard` runs when switching writes. See [#22250](https://github.com/vitessio/vitess/pull/22250).
github.com/vitessio/vitess/releases/tag/v23.0.9