[Bug]: SHOW INDEX and information_schema.STATISTICS expose columns pruned by role rules
I maintainer di solito rispondono entro 1 giorno
@iamlinjunhong ci sta già lavorando.
Dal 25/11/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Environment
- MatrixOne: workspace commit
d58476485f029f076a8b42ac16262bf5c119deb5(main) - OS/Arch: macOS 15.5, arm64 (Apple Silicon)
- Deployment: single-node
mo-servicestarted from a copy ofetc/launchwith every port shifted by +20000 (CN frontend on 127.0.0.1:26001) - Clients: MySQL CLI 9.7.1 with
--default-character-set=utf8mb4; admin connected asdump, restricted user aspoc_u
Actual Behavior
With role rule select uid from pocdb.vault where salary < 10000 on pocdb.vault, the restricted user can only see the uid column. The established metadata behavior works:
information_schema.COLUMNSreturns onlyuid(this is the fix of issue #29095).SHOW CREATE TABLE vaultandDESC vaultfail withERROR 20101: do not have privilege to execute the statement(matches BVTrole_rule.result).
But two other metadata paths disclose the very same pruned column without any visibility check:
SHOW INDEX FROM vaultreturnsKey_name=idx_salary, Column_name=salary, Expression=salary(and succeeds instead of being rejected likeSHOW CREATE TABLE).SELECT index_name, column_name FROM information_schema.statistics WHERE table_schema='pocdb' AND table_name='vault'returnsidx_salary | salary.
The leak is identical whether enable_remap_hint is 0 or 1. The restricted user therefore learns that a hidden column named salary exists and that an index idx_salary is built on it, although the column-pruning policy (and the SHOW COLUMNS/SHOW CREATE TABLE fail-closed gate) exists precisely to prevent disclosing such physical metadata.
Expected Behavior
Pruned columns must not be disclosed through metadata interfaces: SHOW INDEX and information_schema.STATISTICS must apply the same column-visibility policy as information_schema.COLUMNS (fixed by #29095), so index entries referencing pruned columns (here salary/idx_salary) are not visible to the restricted user.
Steps to Reproduce
As admin (dump):
create database pocdb;
create table pocdb.vault (uid int, salary int, note varchar(20));
insert into pocdb.vault values (1, 8000,'n1'),(2, 25000,'n2'),(3, 3, 'n3');
create index idx_salary on pocdb.vault(salary);
create role pocA;
grant connect on account * to pocA;
grant select, update, delete on table pocdb.vault to pocA;
alter role pocA add rule 'select uid from pocdb.vault where salary < 10000' on table pocdb.vault;
create user poc_u identified by '123456' default role pocA;
As poc_u (database pocdb):
select column_name from information_schema.columns where table_schema='pocdb' and table_name='vault'; -- only uid (correct, #29095)
show create table vault; -- ERROR 20101 (correct, fail-closed)
show index from vault; -- BUG: shows idx_salary / salary
select index_name, column_name from information_schema.statistics
where table_schema='pocdb' and table_name='vault'; -- BUG: idx_salary | salary
Repeat with set enable_remap_hint = 1; — the leak is unchanged.
Additional Information
Code pointers:
pkg/sql/plan/rewrite_metadata.go:67-75applyRewriteMetadataVisibilityfilters onlyinformation_schema.columns(informationSchemaColumnsTable), returning early for every other table, soinformation_schema.statisticsnever gets the visibility filter that #29095 introduced.pkg/sql/plan/rewrite_metadata.go:33-60checkShowRewriteMetadatadocuments the intended discipline: "SHOW COLUMNS and SHOW CREATE TABLE expose physical metadata ... Only a proven all-column chain can expose it", and fails closed otherwise.SHOW INDEXhas no equivalent gate and simply returns the raw index metadata, including pruned column names.
Recommended fix: extend the visibility policy used for COLUMNS to information_schema.STATISTICS (filter out rows whose COLUMN_NAME is not provably visible) and either apply the same filtering to SHOW INDEX output or gate it with checkShowRewriteMetadata-style fail-closed semantics for consistency with SHOW COLUMNS/SHOW CREATE TABLE. The second option (rejecting the whole statement) is simpler and matches the existing physical-metadata discipline; either way the pruned column name must not be returned.
Precedent establishing that this class of disclosure is a bug: #29095 (information_schema.columns exposing rule-hidden columns, fixed). Related but distinct: #31675 / #33160 (EXPLAIN row-count side channel), #32698 (read-only index statistics feature).
Full reproduction, exactly as Loom ran it
#!/bin/bash
# Role-rule pruned columns leak through SHOW INDEX and information_schema.STATISTICS
# while information_schema.COLUMNS and SHOW CREATE TABLE are correctly protected.
# Requires single-node mo-service built from commit d58476485f, admin dump/111.
set -u
HOST=127.0.0.1
PORT=26001
ADMIN="mysql -h $HOST -P $PORT -u dump -p111 --default-character-set=utf8mb4"
USERC="mysql -h $HOST -P $PORT -u poc_u -p123456 --default-character-set=utf8mb4 pocdb"
$ADMIN -e "
drop user if exists poc_u; drop role if exists pocA; drop database if exists pocdb;
create database pocdb;
create table pocdb.vault (uid int, salary int, note varchar(20));
insert into pocdb.vault values (1, 8000,'n1'),(2, 25000,'n2'),(3, 3, 'n3');
create index idx_salary on pocdb.vault(salary);
create role pocA;
grant connect on account * to pocA;
grant select, update, delete on table pocdb.vault to pocA;
alter role pocA add rule 'select uid from pocdb.vault where salary < 10000' on table pocdb.vault;
create user poc_u identified by '123456' default role pocA;"
echo '=== [1] baseline: COLUMNS hides pruned columns (only uid) ==='
$USERC -e "select column_name from information_schema.columns where table_schema='pocdb' and table_name='vault';"
echo '=== [2] baseline: SHOW CREATE TABLE fails closed ==='
$USERC -e "show create table vault;"
echo '=== [3] BUG: SHOW INDEX exposes pruned column salary ==='
$USERC -e "show index from vault;"
echo '=== [4] BUG: information_schema.STATISTICS exposes pruned column salary ==='
$USERC -e "select index_name, column_name from information_schema.statistics where table_schema='pocdb' and table_name='vault';"
echo '=== [5] same leak with enable_remap_hint=1 ==='
$USERC -e "set enable_remap_hint=1; show index from vault; select index_name, column_name from information_schema.statistics where table_schema='pocdb' and table_name='vault';"
$ADMIN -e "drop user if exists poc_u; drop role if exists pocA; drop database if exists pocdb;"
Found by Loom bug hunt (module: custom-393355822b; tests: unit, white-box, end-to-end; severity: S1)
- Lingua principale
- Go
- Stelle
- 1.9k
- Fork
- 312
- Merge medio
- 22h 59m
- PR unite (30g)
- 736
Preparare l'ambiente
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di matrixorigin/matrixone
-
kind/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
matrixorigin/matrixone#33363 ·
I maintainer di solito rispondono entro 1 giorno
-
kind/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
matrixorigin/matrixone#33362 ·
I maintainer di solito rispondono entro 1 giorno
-
SLEEP rejects NULL and negative durations that MySQL acceptsForse già presa @XuPeng-SH l’ha presa 7 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
matrixorigin/matrixone#32653 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: TestChangeWatchProxy loses its first tenant connection during PingContext in Ubuntu CIForse già presa @XuPeng-SH l’ha presa oggi. Apertakind/bug needs-triage
matrixorigin/matrixone#33371 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: TestDaemonClaimSQLRoundTrip exhausts its shared deadline during the stale claim update in Ubuntu CIForse già presa @XuPeng-SH l’ha presa oggi. Apertakind/bug needs-triage
matrixorigin/matrixone#33370 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di matrixorigin/matrixone
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
pg-sharding/spqr#3314 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
zalando/postgres-operator#3257 ·
I maintainer di solito rispondono entro 2 giorni
-
[inputs.internal] README lists go_version tag on internal_gather instead of internal_agentForse già presa @cvas22 l’ha presa oggi. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
influxdata/telegraf#20264 ·
I maintainer di solito rispondono entro 1 giorno