[Bug]: SHOW INDEX and information_schema.STATISTICS expose columns pruned by role rules
Maintainers usually reply within 1 day
@iamlinjunhong is already working on this.
Since Nov 25, 2026.
Assessment
This issue has not been assessed yet.
Description
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)
- Dominant language
- Go
- Stars
- 1.9k
- Forks
- 312
- Avg merge
- 22h 59m
- Merged PRs (30d)
- 736
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from matrixorigin/matrixone
-
kind/bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
matrixorigin/matrixone#33363 ·
Maintainers usually reply within 1 day
-
kind/bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
matrixorigin/matrixone#33362 ·
Maintainers usually reply within 1 day
-
SLEEP rejects NULL and negative durations that MySQL acceptsPossibly taken @XuPeng-SH claimed this 7 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
matrixorigin/matrixone#32653 ·
Maintainers usually reply within 1 day
-
[Bug]: TestChangeWatchProxy loses its first tenant connection during PingContext in Ubuntu CIPossibly taken @XuPeng-SH claimed this today. Openkind/bug needs-triage
matrixorigin/matrixone#33371 · 1 assignee ·
Maintainers usually reply within 1 day
-
[Bug]: TestDaemonClaimSQLRoundTrip exhausts its shared deadline during the stale claim update in Ubuntu CIPossibly taken @XuPeng-SH claimed this today. Openkind/bug needs-triage
matrixorigin/matrixone#33370 · 1 assignee ·
Maintainers usually reply within 1 day
All issues in matrixorigin/matrixone
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
zalando/postgres-operator#3257 ·
Maintainers usually reply within 2 days
-
[inputs.internal] README lists go_version tag on internal_gather instead of internal_agentPossibly taken @cvas22 claimed this today. Open
Difficulty 1/5 Under an hour Newbie friendliness 90/100
influxdata/telegraf#20264 ·
Maintainers usually reply within 1 day
-
[Bug] Standalone migration breaks existing Ingress routes using the envoy-http Service port nameOpenaccepted bug wg/enterprise-environment
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
vllm-project/semantic-router#7483 · 1 comment ·
Maintainers usually reply within 1 day
-
needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
stacklok/toolhive-catalog#2076 ·
Maintainers usually reply within 1 day