Repository navigation
test: stats() and sort_status() refuse a heap table for privilege before reading its kind (#1657 follow-up) - #1670
Conversation
jdatcmd
left a comment
There was a problem hiding this comment.
Approved at 3fa55de. Thank you for pinning my own lines: the order is load-bearing for exactly the reason you give, and nothing held it.
Measured on PG17 with sidfirst (the two lines swapped in both functions):
- main: stats_privilege shell 13/13, twin 3 passed;
- this head: stats_privilege shell 14 + 1 failed, "a role with no privilege on a heap table is refused for privilege, not told it is not columnar: got [0] want [1]"; twin 1 failed, 4 passed.
Clean:
- PG15 stats_privilege: shell 15 passed + 0 failed + 0 unrunnable + 0 skipped = 15; twin 5 passed in 5.15s
- PG15 sort_status_privilege: shell 15 passed + 0 failed + 0 unrunnable + 0 skipped = 15; twin 15 passed in 2.75s
- PG19 stats_privilege: shell 15 passed + 0 failed + 0 unrunnable + 0 skipped = 15; twin 5 passed in 2.32s
- PG19 sort_status_privilege: shell 15 passed + 0 failed + 0 unrunnable + 0 skipped = 15; twin 15 passed in 1.66s
It needs a restate onto current main. I'll re-approve one whose non-registry files are unchanged.
jdatcmd
left a comment
There was a problem hiding this comment.
Re-approved on prchk167, the one-pass restate onto main c7f0de4. restate_check.sh against my last approval: the PR's own change is the same in every content file; only the registries (budget, TESTS.md, expected_tests) differ, and the head's census agrees with its tsv.
…ore reading its kind (#1657 follow-up) get_storage_id checks SELECT with GetUserId(), which inside the SECURITY DEFINER stats() and sort_status() is the definer, so it passes for anyone and then says "relation ... is not a columnar table" for a heap table. Only the explicit require_caller_select refuses the caller, and only while it runs first. Nothing pinned that order: with the two lines swapped in both functions ("sidfirst", from the #1657 review), stats_privilege and sort_status_privilege stayed 13/13 in shell and twin on PG17, because on their columnar table the caller check still refused afterwards. An unprivileged caller probing a heap table would be told its kind instead of being refused. Each suite now has a heap table no test role may read, and two checks in both harnesses: - "a role with no privilege on a heap table is refused for privilege, not told it is not columnar": sidfirst reddens it, the same name in shell and twin, in both suites; - "a superuser asking about a heap table is told it is not columnar": the control, so the first check cannot pass on a call that refuses everyone. Head is 15/15 in shell and twin for both suites on each of 15-19. Rows: sort_status_privilege already had its rows and gains these 2. stats_privilege had none, so it enters the ledger whole with its 15 checks (all green on 15-19, shell and twin alike): the refusal dated by sidfirst, 14 never. Census 4520 -> 4535 never, 3443 -> 3445 dated, 7980 rows; suites_not_covered 28 -> 27; cluster_tests 4227 -> 4231. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3fa55de to
607fa3b
Compare
|
@jdatcmd This is restated onto #1756's head
|
@jdatcmd A follow-up from my #1657 review: nothing pinned the order of the two lines #1657 added.
The hole.
get_storage_idchecks SELECT withGetUserId(). Inside the SECURITY DEFINERstats()andsort_status()that's the definer, so the check passes for anyone, and the function then saysrelation "…" is not a columnar tablefor a heap table. Only the explicitrequire_caller_selectrefuses the caller, and only while it runs first.sidfirston main (the two lines swapped in both functions)sidfirst, this branchThe red in both suites is the new check, by the same name in shell and twin: "a role with no privilege on a heap table is refused for privilege, not told it is not columnar". Under
sidfirstthe unprivileged role getsnot a columnar tableinstead ofpermission denied for table.What's added, in both suites and both twins:
permission denied for table <heap>;Ledger.
sort_status_privilegealready had its rows and gains 2: the refusal is dated bysidfirst, the control is never.stats_privilegehad no rows on main, so it enters whole with its 15 checks from five-major runs: 1 dated, 14 never. That movessuites_not_covered105 → 104. My first push added only its 2 new rows, and the ceiling guard refused it.cluster_tests2677 → 2681.Gates: guards 474 passed, collection 2681, ledger gate rc=0, self-test PASSED.
🤖 Generated with Claude Code