diff --git a/src/frontend/AGENTS.md b/src/frontend/AGENTS.md index 43ebe894baf..7072431a5ec 100644 --- a/src/frontend/AGENTS.md +++ b/src/frontend/AGENTS.md @@ -126,6 +126,14 @@ cargo nextest run -p frontend - Keep the frontend/servers split straight: wire format and network live in `servers`; permissions, planning, and routing live here. +- A statement whose tables are known only at execution time (`COPY DATABASE`) + resolves them first, authorizes every resolved table, then executes exactly + the authorized set. Do not authorize such a statement with empty targets. +- Built-in permission action names are a contract with external + `PermissionChecker` implementations. Define each as a constant in + `src/auth/src/permission.rs` and list it in `ALL_ACTIONS`; do not build them + from string literals at call sites. A new action or access-mode requirement + on an existing statement or endpoint is a user-visible permission change. - Standalone vs distributed diverge in datanode access (the `standalone` crate's local `RegionServer` adapter vs `NodeClients` RPC), MetaClient usage, and whether heartbeat matters. The builder defaults local invalidation to its diff --git a/src/servers/AGENTS.md b/src/servers/AGENTS.md index 7bbdcf21861..d276becb685 100644 --- a/src/servers/AGENTS.md +++ b/src/servers/AGENTS.md @@ -26,6 +26,11 @@ provided through handler traits, mostly implemented by `frontend`. after bumping it. - Auth or `QueryContext` changes must cover HTTP, gRPC, MySQL, and PostgreSQL entry points. +- A protocol handler that changes the `QueryContext` catalog or schema after + authentication (HTTP `db` query/form parameters, MySQL `COM_INIT_DB`) calls + `UserProvider::authorize` for the new scope before mutating the context. The + HTTP middleware authorizes only the scope it extracts itself + (`extract_catalog_and_schema` in `http/authorize.rs`). - Internal frontend gRPC listeners set `Channel::Internal` in server-owned request extensions. Handlers preserve it through query execution and metering; client flow metadata does not grant an internal channel.