feat(qaops): 接入独立只读问答查询与治理覆盖复检

This commit is contained in:
姚章浩
2026-10-17 09:04:19 +08:00
parent c1d49adb62
commit fd04bf7886
42 changed files with 4479 additions and 5 deletions
@@ -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)
}
}