Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix(acl): authorize BatchDeleteProjects against the projects it names (T18c-iv) (#21325)

Danny Xu25b83cf90d25
diff --git a/backend/api/v1/acl.go b/backend/api/v1/acl.go
index 45501e27bc..5f65008125 100644
--- a/backend/api/v1/acl.go
+++ b/backend/api/v1/acl.go
@@ -710,18 +710,22 @@ func getResourceFromRequest(ctx context.Context, request any, method string) ([]
if parentDesc != nil && proto.HasExtension(parentDesc.Options(), annotationsproto.E_ResourceReference) && mr.Has(parentDesc) {
resources = append(resources, mr.Get(parentDesc).String())
}
- // Handle batch get requests.
- if strings.HasPrefix(shortMethod, "BatchGet") {
- namesDesc := mr.Descriptor().Fields().ByName("names")
- if namesDesc != nil {
- namesValue := mr.Get(namesDesc)
- namesValueList := namesValue.List()
- for i := 0; i < namesValueList.Len(); i++ {
- v := namesValueList.Get(i)
- resources = append(resources, v.String())
- }
- return resources, nil
+ // Every Batch* verb authorizes the targets in `names`, not just BatchGet:
+ // BatchDeleteProjects has no parent, requests or name, so it resolved
+ // nothing and checked bb.projects.delete against the workspace.
+ namesDesc := mr.Descriptor().Fields().ByName("names")
+ if namesDesc != nil && proto.HasExtension(namesDesc.Options(), annotationsproto.E_ResourceReference) {
+ namesValueList := mr.Get(namesDesc).List()
+ for i := 0; i < namesValueList.Len(); i++ {
+ resources = append(resources, namesValueList.Get(i).String())
}
+ if len(resources) == 0 {
+ // An empty batch authorizes nothing; the workspace fallback lets
+ // the handler answer instead of doIAMPermissionCheck erroring on
+ // an empty resource list.
+ return []string{""}, nil
+ }
+ return resources, nil
}
requestsDesc := mr.Descriptor().Fields().ByName("requests")
diff --git a/backend/api/v1/acl_test.go b/backend/api/v1/acl_test.go
index 40be86d4ab..e053f1d359 100644
--- a/backend/api/v1/acl_test.go
+++ b/backend/api/v1/acl_test.go
@@ -482,6 +482,47 @@ func TestGetResourceFromRequest(t *testing.T) {
"projects/project-a/instances/world/databases/world",
},
},
+ {
+ // Each named project, as DeleteProject does for the one it names. No
+ // parent and no requests, so this resolved nothing before.
+ request: &v1pb.BatchDeleteProjectsRequest{
+ Names: []string{"projects/hello", "projects/world"},
+ },
+ method: "/bytebase.v1.ProjectService/BatchDeleteProjects",
+ want: []string{"projects/hello", "projects/world"},
+ },
+ {
+ // Empty batch: the workspace fallback lets the handler answer.
+ request: &v1pb.BatchDeleteProjectsRequest{},
+ method: "/bytebase.v1.ProjectService/BatchDeleteProjects",
+ want: []string{""},
+ },
+ {
+ // The rule widened to every Batch* verb; it did not move off BatchGet.
+ request: &v1pb.BatchGetProjectsRequest{
+ Names: []string{"projects/hello", "projects/world"},
+ },
+ method: "/bytebase.v1.ProjectService/BatchGetProjects",
+ want: []string{"projects/hello", "projects/world"},
+ },
+ {
+ // Parent and every name, in that order.
+ request: &v1pb.BatchGetDatabasesRequest{
+ Parent: "projects/hello",
+ Names: []string{"instances/i/databases/a", "instances/i/databases/b"},
+ },
+ method: "/bytebase.v1.DatabaseService/BatchGetDatabases",
+ want: []string{"projects/hello", "instances/i/databases/a", "instances/i/databases/b"},
+ },
+ {
+ // Untouched: BatchUpdateIssuesStatus names its issues in `issues`.
+ request: &v1pb.BatchUpdateIssuesStatusRequest{
+ Parent: "projects/hello",
+ Issues: []string{"projects/hello/issues/1"},
+ },
+ method: "/bytebase.v1.IssueService/BatchUpdateIssuesStatus",
+ want: []string{"projects/hello/issues/1"},
+ },
{
request: &v1pb.BatchUpdateDatabasesRequest{
Requests: []*v1pb.UpdateDatabaseRequest{
diff --git a/docs/design/v1-api-audit-2026-08.md b/docs/design/v1-api-audit-2026-08.md
index a17a54e81c..1c5c750d2c 100644
--- a/docs/design/v1-api-audit-2026-08.md
+++ b/docs/design/v1-api-audit-2026-08.md
@@ -11,7 +11,6 @@ where noted. Fixed findings are removed and listed at the end.
| | Problem | Severity |
|---|---|---|
| T12 | Anonymous callers can read your LDAP config | MED |
-| T18c-iv | `BatchDeleteProjects` checks its permission against the workspace, not the named projects — latent, no predefined role reaches it | LOW |
---
@@ -39,26 +38,6 @@ call was authorized against the workspace. Both are fixed and listed at the end.
generalizes — the next request field that departs from the convention arrives unchecked, silently,
and only a sweep like this one finds it.
-### T18c-iv · `BatchDeleteProjects` authorizes at workspace scope — LOW
-
-Found re-sweeping the 217 RPCs at HEAD. `names` carries a `resource_reference`, but nothing resolves
-it: the RPC is not a `BatchGet` (so the `names` branch does not apply), has no `parent` and no
-`requests`, and no `parent`/`name`/`resource`/`project` field — so `getResourceFromSingleRequest`
-returns `""` and `bb.projects.delete` is checked against the workspace. `DeleteProject`, same
-permission, resolves `name` to project scope.
-
-Fail-closed, and latent: no predefined role reaches the mismatch. `bb.projects.delete` is held only
-by Workspace Admin and Workspace DBA, both of which satisfy the workspace-scoped check anyway, and
-Project Owner holds `bb.projects.update` but not `.delete` — so `DeleteProject` denies it too. It
-takes a custom role containing `bb.projects.delete` bound at project scope, which nothing prevents:
-`CreateRole` validates only that each permission exists. Such a principal deletes one project at a
-time and is denied the batch form.
-
-Worth recording anyway, because it is the same silent convention miss as `UpdateDatabaseCatalog`
-pointing the other way — the scope is decided by which field names the request happens to use, not
-by anything stated — and nothing in the proto says the batch form needs workspace-level rights.
-`acl.go:708-739`, `project_service.proto:394-400`, `predefined_roles.go:97`, `:249`, `:406`
-
---
## What anonymous callers can learn
@@ -146,7 +125,7 @@ constraints.
| T13 issue filters | `approval_status` and `current_approver` are matched in SQL before `LIMIT`, so a filtered page can no longer come back empty under a live page token. The status is a `CASE` over `payload->'approval'` mirroring `computeApprovalStatus`; `current_approver` cannot be resolved in SQL alone (binding conditions and group expansion are evaluated in Go), so the caller passes down the `(project, role)` pairs the named user holds, the same shape as the saved-query `AccessMembers` predicate. Accepted with it: the predicates are not indexable, so a filtered list scans until it has a full page of matches — measured on 50,000 issues across 40 projects, that is ~9 ms against ~14 ms for the same unfiltered query, and ~3.5 ms in the zero-match case, because PostgreSQL drives the join from the small `(project, role)` set, so no expression index is warranted yet. Deliberately unchanged: the filter still ignores rejection and self-approval, so a rejected issue names the holder of the *next* role as its current approver — masked in the default view, and worth its own fix |
| T18 worksheet write/delete | [#21169](https://github.com/bytebase/bytebase/pull/21169) + [#21181](https://github.com/bytebase/bytebase/pull/21181) — per-verb permissions; SQL Editor Read User can no longer rewrite or delete |
| T17 | Every CEL string literal the frontend emits now comes from `celString`/`celStringList`/`celMapField` in a dependency-free `frontend/src/utils/v1/celLiteral.ts` — the helpers own the quotes, so the escape cannot be forgotten the way it was at 11 of 17 sites. Worst was the access-grant page, whose search box takes SQL: a quoted identifier made `InvalidArgument` routine. All 17 sites converted, the enum and resource-name ones included, because an absolute rule is the only one a machine can check — `src/architecture/cel-filter-literals.test.ts` scans `src/**` for the three raw shapes and fails CI on a new one, in the style of the existing Vue-boundary guards. The helpers are a leaf module because putting them beside the CEL RPC clients dragged `@/api` into `modules/cel/logic/stringify.ts` and broke that subtree's tests. Two adjacent defects the sweep found, neither of which escaping addresses, fixed with it. **A label key with a dash never reached the backend at all**: keys are validated `^[a-z][a-z0-9_-]{0,62}$`, and CEL parses `labels.cost-center` as subtraction, so the store answered `unsupport variable \"\"` — the frontend now emits `labels[\"key\"]` index syntax, `getVariableAndValueFromExpr` canonicalizes both forms, and the key is **bound** rather than interpolated into the JSONB path, since index syntax admits a quote the dotted form could not. **`%` and `_` reached `LIKE` as wildcards**, so a statement search containing either silently over-matched — `escapeLikePattern`, already in-tree for saved queries, plus `ESCAPE '\\'` now covers all 13 `contains` translations. The three copies of the label-filter closure collapsed into one `buildLabelFilterSQL`, which also drops an unchecked `raw.(string)` that panicked on `labels.k in [1]`. Verified against PostgreSQL 16: `->>$1::text` matches, an injected key is inert, and `\_` stops matching what `_` did. Accepted with it: the guard is line-based and skips test files, which should spell out expected filter strings literally; and `query_history`'s two remaining raw-`LIKE` filters are left alone — `instance ==` missing its wildcard and `statement ==` missing the escape, both T18c-ii. Its `database ==` is plain equality and was never affected |
-| T18c-i | `BatchDeleteProjects` purges every named project in one transaction, so a failure partway rolls the whole batch back instead of leaving the projects ahead of it irreversibly gone with an error naming only the one that failed. There is one store method where there were two — `DeleteProjects`, variadic like the `UpdateProjects` beside it — and its statements carry `project = ANY(?)`, one per table for the whole batch, in the child-to-parent table order the loop already used, so the chains in [`backend/store/AGENTS.md`](../../backend/store/AGENTS.md#transaction-row-lock-ordering) are walked bottom-up for every project at once. The separate `SELECT ... FOR UPDATE` that guarded the archived state is gone rather than generalized: it only duplicated the `AND deleted = TRUE` on the delete two lines below it, which takes the same row locks at the same point. That delete now carries `RETURNING resource_id`, and a name that does not come back — missing, still active, or in another workspace — fails the batch with the message the single-project purge already used. No ordering is claimed for concurrent purges: the descendant statements that run first never had one either, and [`backend/store/AGENTS.md`](../../backend/store/AGENTS.md#transaction-row-lock-ordering) already treats purge as a point-in-time lifecycle operation whose conflicts are best-effort. Accepted with it: sample-instance cleanup still runs per project *before* the transaction, because it removes an embedded PostgreSQL data directory or an external database and role that no rollback restores — it writes no project row, so a failure there still purges nothing, and `sample_instance_setup` holds one live row per workspace, so at most one project in a batch has work to do. Unchanged: the default-project and archived-before-purge guards are still checked for every name before any purge begins, and the soft-delete path was already a single `UPDATE`. **Shipped with no test of its own, deliberately — the atomicity is unlocked.** Every existing purge test (`TestCollisionDeleteProjectCascade`, the three `project_purge_cache_test.go` cases, `TestDeleteProjectPurgeKeepsOtherProjectSavedQueryStars`, `TestDeleteProjectDeletesProjectInstancesAndKeepsWorkspaceInstanceDatabases`) now drives the batched SQL, so the rewrite of ~25 statements to `project = ANY(?)` is covered — but only ever with one name, so nothing catches a predicate that reaches some projects and not others, and nothing fails if the handler returns to a per-project loop. A handler-level test could not have covered it either: the archived-before-purge guard rejects the whole request before the transaction starts, so a mid-batch failure is unreachable through the API and the invariant is only observable from the store. The batch is also a changed multi-row transaction shipping without the contention coverage step 5 of [`docs/pre-pr-checklist.md`](../../docs/pre-pr-checklist.md) asks for; the sort-before-lock argument is the only thing standing behind the deadlock claim. Judged not worth the test weight. Untouched, and still open as T18c-iv: the batch form is authorized at workspace scope |
+| T18c-i | `BatchDeleteProjects` purges every named project in one transaction, so a failure partway rolls the whole batch back instead of leaving the projects ahead of it irreversibly gone with an error naming only the one that failed. There is one store method where there were two — `DeleteProjects`, variadic like the `UpdateProjects` beside it — and its statements carry `project = ANY(?)`, one per table for the whole batch, in the child-to-parent table order the loop already used, so the chains in [`backend/store/AGENTS.md`](../../backend/store/AGENTS.md#transaction-row-lock-ordering) are walked bottom-up for every project at once. The separate `SELECT ... FOR UPDATE` that guarded the archived state is gone rather than generalized: it only duplicated the `AND deleted = TRUE` on the delete two lines below it, which takes the same row locks at the same point. That delete now carries `RETURNING resource_id`, and a name that does not come back — missing, still active, or in another workspace — fails the batch with the message the single-project purge already used. No ordering is claimed for concurrent purges: the descendant statements that run first never had one either, and [`backend/store/AGENTS.md`](../../backend/store/AGENTS.md#transaction-row-lock-ordering) already treats purge as a point-in-time lifecycle operation whose conflicts are best-effort. Accepted with it: sample-instance cleanup still runs per project *before* the transaction, because it removes an embedded PostgreSQL data directory or an external database and role that no rollback restores — it writes no project row, so a failure there still purges nothing, and `sample_instance_setup` holds one live row per workspace, so at most one project in a batch has work to do. Unchanged: the default-project and archived-before-purge guards are still checked for every name before any purge begins, and the soft-delete path was already a single `UPDATE`. **Shipped with no test of its own, deliberately — the atomicity is unlocked.** Every existing purge test (`TestCollisionDeleteProjectCascade`, the three `project_purge_cache_test.go` cases, `TestDeleteProjectPurgeKeepsOtherProjectSavedQueryStars`, `TestDeleteProjectDeletesProjectInstancesAndKeepsWorkspaceInstanceDatabases`) now drives the batched SQL, so the rewrite of ~25 statements to `project = ANY(?)` is covered — but only ever with one name, so nothing catches a predicate that reaches some projects and not others, and nothing fails if the handler returns to a per-project loop. A handler-level test could not have covered it either: the archived-before-purge guard rejects the whole request before the transaction starts, so a mid-batch failure is unreachable through the API and the invariant is only observable from the store. The batch is also a changed multi-row transaction shipping without the contention coverage step 5 of [`docs/pre-pr-checklist.md`](../../docs/pre-pr-checklist.md) asks for; the sort-before-lock argument is the only thing standing behind the deadlock claim. Judged not worth the test weight. Untouched by that change, and since fixed as T18c-iv: the batch form was authorized at workspace scope |
| T18a | [#21265](https://github.com/bytebase/bytebase/pull/21265) — `BatchCancelTaskRuns` confines its lookup to the plan and environment just authorized; the stage in a task run name is caller-supplied, so cancel rights in one environment reached a RUNNING row in another. An out-of-scope ID is rejected, not dropped — the cancel is driven by the requested IDs |
| T9 | [#21189](https://github.com/bytebase/bytebase/pull/21189) (self-hosted audit rows) + [#21234](https://github.com/bytebase/bytebase/pull/21234) — one `login_attempt` table bounds password, email-code, and MFA guessing per identity on both deployments, replacing the audit-log counter and the per-code attempt column (which bypassed the resend cooldown). Accepted with it: no per-tenant failed-login record on Cloud, and lockout-as-denial-of-service — see [`login-attempt-lockout.md`](login-attempt-lockout.md) |
| T15 | `update_mask` now decides what each of the four Update methods writes. **`UpdateDataSource`** dispatches the IAM credential on the mask path instead of the request's `authentication_type`, which was unset on any request that masked only the credential — the AIP-134 shape — so rotating a leaked key returned 200 and wrote nothing. The same branch, given a body type that disagreed with the mask, wrote the *other* credential and moved `authentication_type` with it though the mask named neither; the effective type is now resolved from the mask before the loop and a mismatched path is `InvalidArgument`. **`UpdateSetting(APP_IM)`** splices only the masked providers into the stored value rather than assigning the request wholesale, so saving Slack no longer erases the Feishu, WeCom, Lark, DingTalk and Teams secrets; the mask is now required, and a masked provider the payload omits is removed, which is how the console deletes one (it no longer merges the list client-side). **`UpdateIssue`** rejects paths it does not implement instead of returning 200 and dropping them — `status` belongs to `BatchUpdateIssuesStatus` and approvals to `ApproveIssue`/`RejectIssue`, so the supported set was right and only the silence was wrong. **`UpdateDatabaseCatalog`** keeps full-replace semantics and now says so in the proto; its `allow_missing` is removed and the number reserved, because a catalog is not independently creatable — it exists once its database is synced — so the flag had nothing to create, and the ACL's create-permission check on it denied every caller. Both merges were extracted into pure functions (`applyDataSourceUpdateMask`, `mergeAppIMSetting`), so `instance_service_test.go` and `setting_service_test.go` pin the behavior in milliseconds without a server or a metadata database. Accepted with it: the APP_IM mask paths still name no real proto field (`AppIMSetting` holds one repeated `settings`, and `value.app_im_setting_value.teams` is not a field path at all), so they are matched as a fixed vocabulary — making them true paths means restructuring the message one-field-per-provider, which needs a JSONB migration. Also left open, and the reason `UpdateDatabaseCatalog`'s hazard is documented rather than removed: a mask cannot express "this one table" while `schemas` is repeated, and read-modify-write on the catalog still loses one side of a concurrent edit, which needs an etag (AIP-154); the IAM-policy half of it is fixed, see T18b below |
@@ -156,6 +135,7 @@ constraints.
| T18b | The etag is now read wherever the caller presents it: `policy.etag` — the only place `GetIamPolicy` returns one, and so the only place a read-modify-write round-trips it — as well as the request field, with two that disagree rejected. Both handlers write through `store.SetIamPolicy`, which compares under `SELECT ... FOR UPDATE` inside the write transaction. Comparing against the handler's own earlier read would not have been enough: that is a check-then-act, and two requests reading the same policy both pass it before either writes. (An earlier revision justified this by replica cache skew, which does not exist: `store.New(ctx, pgURL, !profile.HA)` disables read caching in the only mode that runs more than one process.) The same lock closed two merges that present no etag at all and so could never be compared — `PatchWorkspaceIamPolicy` (signup, SSO provisioning, workspace-leave) and the role-grant issue approval in `backend/utils` — each of which read the policy, merged one member in, and wrote the whole thing back, so either could resurrect a member an admin had just revoked; both now merge inside the locked transaction through `store.PatchIamPolicy`. Fixed with it: workspace `SetIamPolicy` wrote to `request.Resource` while every read and check used the workspace from the token, so a request naming anything else matched no row and returned 200 having written nothing — the write now targets the workspace the reads did, which is what `GetIamPolicy` already does by ignoring the field. The audit delta and the invite emails are now derived from the policy the write actually replaced rather than the pre-validation snapshot, so they describe what happened even for an etag-less caller, and the workspace seat guard counts against that same locked policy through a `ValidateReplaced` hook rather than against a read the write does not hold. Accepted with it: an etag-less caller still gets last-write-wins, which is what AIP-154 optional-etag semantics mean and what existing API clients rely on; and the etag is still `updated_at` in milliseconds, so a write landing in the same millisecond as the one before it leaves the etag unmoved and a stale write racing that pair is accepted — too narrow to justify the wire change to a content hash, unlike the saved-query policy, which has no timestamp to derive one from. Also left as is: `validateIAMPolicy` grandfathers bindings found in the policy the handler read before the write, so an etag-less caller racing a concurrent removal re-adds that binding without the `allUsers`, role-existence, CEL and maximum-expiration checks — pre-existing, and closing it means splitting the function into a fetch half and a pure half that runs under the lock |
| T18c-ii | **The query-history `instance ==` filter matches now.** The CEL translation compared the stored `instances/{id}/databases/{db}` against the caller's `instances/{id}` with `LIKE` and no wildcard, so the documented form returned nothing and the only form that worked was the undocumented `instances/{id}/%`. The value is now validated as an instance name — the wildcard form is `InvalidArgument`, as a malformed `project ==` already was — and translated to an escaped `instances/{id}/databases/%` prefix, so the caller never supplies the pattern — or `projects/{project}/instances/{id}/databases/%` for a project-scoped instance, whose rows carry the project-scoped name; Codex caught on the PR that the first cut only handled the workspace form, so the filter would still have matched nothing for every project-scoped instance. **`statement ==` is plain equality**, which is what `==` means and closes the `%`/`_` over-match that T17's `.contains()` fix left; the proto lists it beside `.contains()` now. Found on the way and fixed with it: every equality literal is type-checked once at the top of the switch, so `type == 1` is an error where it was a panic. `FindQueryHistoryMessage.Instance`, the second copy of the missing wildcard, is deleted rather than fixed — nothing set it. **`ListTaskRuns` is paginated**: `page_size`/`page_token` on the request, `next_page_token` on the response, `parseLimitAndOffset` in the handler and `LIMIT`/`OFFSET` in the store, ordered by `(task_run.project, task_run.id)` — the primary key, so the order is total for the cross-project runner lists as well, which sorted on `id` alone. One deliberate departure from the other lists: an unspecified `page_size` means the 1000 maximum, not 10. The wildcard parent's callers read a whole rollout in one call — the issue and plan pages, and `bytebase-action`'s `cancelRollout`, which finds the runs to cancel that way — and action binaries inside their compatibility window ([`docs/pre-pr-checklist.md`](../../docs/pre-pr-checklist.md) §6) cannot be updated with the server, so a default of 10 would have silently left every run past the tenth uncancelled. Every in-tree caller now follows the token: `listAllTaskRuns` in `frontend/src/api/taskRun.ts` behind the five frontend sites, and the action's own `listAllTaskRuns`. The two token fields join `auditRecordedFields` as ordinary recorded fields, as every other list's do. Tests: the filter SQL at the store level, both filters end to end in `TestListQueryHistories`, `TestListTaskRunsPagination` for the page and order contract at the store, and a `page_size: 1` token walk in `TestBatchCancelTaskRuns_RejectsTaskRunFromAnotherStage`. Accepted with it: a caller past 1000 task runs that ignores `next_page_token` now sees a truncated rollout where it saw everything — the bound is the point. Offset paging still drifts under concurrent inserts, as every list here does |
| T18c-iii | `CheckRelease` answers `NotFound` with the one `database {target} not found` the missing case already used for a database target that is missing, belongs to another project, sits on an archived instance, or is not the canonical name for its instance, where the four cases returned three distinguishable errors. Only the code and message change: the lookups and their order are as [#21102](https://github.com/bytebase/bytebase/pull/21102) left them, the canonical test reads `database.ResourceName() != target` instead of comparing scopes by hand, and a project-form target naming a different project is still `InvalidArgument`, decided before any read and so confirming nothing. `TestCheckReleaseHidesDatabasesOutsideProject` asserts a foreign database and a missing one come back with byte-identical errors |
+| T18c-iv | `BatchDeleteProjects` authorizes each project it names, as `DeleteProject` already did with the same permission. The interceptor read `names` only for `BatchGet*`, so the one `Batch*` RPC that names its targets under any other verb — no `parent`, no `requests`, no `name` — resolved nothing and checked `bb.projects.delete` against the workspace. The condition now spans every `Batch*` verb and is keyed on the field's `resource_reference` — the same annotation `getResourceFromSingleRequest` already requires of `parent`/`name`/`resource`/`project` — rather than on the method prefix. Six `Batch*` requests have a `names` field and all six carry the annotation, so the four `BatchGet`s resolve the same names they always did, and `BatchSyncDatabases` returns from its own case above the block and never reaches it. Strictly additive for the roles that exist: `doCheckPermission` consults the workspace policy before any project policy, so Workspace Admin and Workspace DBA are unaffected, and the custom role this was latent for — `bb.projects.delete` bound at project scope — now reaches the batch form it was denied. **One behavior change beyond the scope fix**: a batch that names nothing is authorized at workspace scope rather than producing an empty resource list, which `doIAMPermissionCheck` turns into an *internal* error. `BatchGetProjects{}` and `BatchGetUsers{}` therefore reach their handlers, and their empty response, where a caller holding the permission got a 500; `BatchGetGroups{}` and `BatchGetDatabases{}` shift the same way but are CUSTOM, so the IAM path never reached them and only their audit parent changes. `BatchDeleteProjects{}` itself is unaffected — falling back to the workspace is what it already did for every request, empty or not, which was the finding. Accepted with it: a caller *without* the permission who names a project that does not exist now gets `NotFound` where the workspace check gave `PermissionDenied` — resource resolution runs ahead of the permission check for every project-scoped RPC in the interceptor, so this only joins `DeleteProject` and the rest rather than opening anything new. The audit row moves with the scope: one row per named project, matching `DeleteProject`, where the batch filed a single workspace row before. Five cases in `TestGetResourceFromRequest` cover it, which is where the resolution convention is pinned; there is no end-to-end test of the project-scoped custom role, because no predefined role could ever reach the mismatch. Still true, and what the finding warned about: the next request field that departs from the convention arrives unchecked |
**`AIService.Chat` — accepted, not fixed** (2026-08-18). `Chat` requires an authenticated workspace
principal and touches no database or sheet, so the only exposure is LLM spend. On Cloud the feature