feat(qaops): 接入独立只读问答查询与治理覆盖复检
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package dobotaiops
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestSourceRechecksEffectivePrivilegesBeforeEveryQuery(t *testing.T) {
|
||||
pool := fixturePool(t)
|
||||
roDSN := buildFixture(t, pool)
|
||||
client := buildReadOnlyClient(t, roDSN)
|
||||
execFixture(t, pool, `CREATE TABLE acl_other_surface(id text)`, `GRANT INSERT ON acl_other_surface TO kg_ro_fixture`)
|
||||
t.Cleanup(func() { execFixture(t, pool, `DROP TABLE IF EXISTS acl_other_surface`) })
|
||||
window := Window{TenantKey: "default", Start: time.Date(2026, 10, 14, 0, 0, 0, 0, time.UTC), End: time.Date(2026, 10, 15, 0, 0, 0, 0, time.UTC)}
|
||||
if _, err := client.QueryCounts(context.Background(), window, Filter{}); !errors.Is(err, ErrNotReadOnly) {
|
||||
t.Fatalf("unexpected privilege escalation outside legacy tables was not blocked: %v", err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user