Skip to content

Require target-group membership to create an app from every entry - #38

Merged
reoring merged 3 commits into
mainfrom
fix/apt-1128-creation-group-rule
Nov 16, 2026
Merged

reoring merged 3 commits into
mainfrom
fix/apt-1128-creation-group-rule

Conversation

@reoring

@reoring reoring commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

朝の 5 行(森さん向け)

  1. 何が変わるか: アプリを作れるのは、作る先のグループに入っている人だけになる。どの入口(AI、テンプレート、既存のコード、image、Excel)でも同じ。管理者の例外は無い。どのグループにも入っていない人には、どの入口も押せない形で案内を出す。
  2. 届いたときに見える変化・止まるもの: 作成の画面のグループの選択肢が、自分のグループだけになる。グループに入っていない人は作れなくなる(いままでテンプレートからは作れていた)。作りかけを再開したとき、既に作ったアプリのグループに今は入っていなければ、続けられない旨を出す(アプリは動かさない)。既存のアプリの移動(設定の所属グループの変更)は変わらない(APT-1151 で別に伺う)。
  3. 決めてほしい点と推奨: なし(森さんの決定どおり: どの入口も AI と同じ決まり、管理者の例外なし)。
  4. 独立レビュー: security-reviewer 3 回。1 回目・2 回目は「変更が要る」(作成の所属の確認が 60 秒の cache を使う / まだ結び付いていない記録の最初の bind が所属を見ない / 再開のときの自動の移動 / mock と本番のずれ)→ 全部直した。最後(d1002c5454)は「マージしてよい。後続つき」(後続: mock の bind の入力の形の検査が本番と違う。P3、本番の権限には関係しない)。全文は po/lead-2026-11-14/reviews/builder-console-apt1128-review.md。
  5. 戻し方: revert(Console の版を 0.5.10 に戻す)。

What

On Console 0.5.9/0.5.10 a Project Editor who belongs to no Console group could not use the AI entry but could pick any group in the template wizard and create an app there: POST /api/console/apps and the wizard only checked that the group existed. Owner decision (APT-1128): creation from every entry requires membership of the target group, with no Console-admin exception; the AI build-session path already enforced exactly this (cmd/server/internal/store/build_sessions.go).

Change

Server (cmd/server/internal/api):

  • POST /api/console/apps and the first POST /api/console/apps/{id}/bind of an unbound record require the target (resp. current) group to be in the caller's effective groups (direct + descendants), resolved freshly from Directory per request (not the 60s cached view). Rejection: existing 400 groupId must be one of your directory groups. Already-bound records keep 409. Directory unavailable -> 503 console_link_unavailable.
  • PATCH (moving an existing app) is unchanged; tracked as APT-1151.

Web (web/src):

  • Every creation entry offers only the caller's effective groups; ?group= / current group is used only when it is one of them. A user with no group sees the existing guidance and every entry (including Excel and direct entry URLs) is disabled before any draft, app or session is created.
  • Resuming a wizard whose kept app sits in a group the user has left is blocked with a notice (no automatic move).
  • Mocks mirror production: create membership and error order, build-session replay authorization, first-bind membership and 409 message.
  • README documents the rule.

Verification

  • Go: go test -count=1 ./cmd/server/... with the PostgreSQL integration DB, go vet, gofmt.
  • Web: typecheck, typecheck:e2e, check:response-boundaries, check:console-schema, bun test src, and 10 mock e2e story files (34 stories, incl. new app-create-group-rule.mock.spec.ts).
  • Committed tree: d1002c5454 — Go tests/vet and the full web set (2073 unit tests, 34 mock stories) passed on the committed content; typecheck, typecheck:e2e, response-boundaries, console-schema and the touched unit files (184 tests) re-run on d1002c5454 itself (results in the PR comment).

Not verified on a live estate yet (will be checked on ink as part of the 0.5.11 candidate).

Follow-ups: mock bind body validation parity (P3); APT-1151 (move rule).

APT-1128

…ntry

A user outside every group could not use the AI entry but could pick any group in
the template wizard and create an app there, because POST /api/console/apps and
the wizard only checked that the group existed.

Every creation entry (AI, templates, existing code, image, Excel) now offers only
the caller's effective groups (direct membership plus descendants), and a user with
no group sees the existing guidance with every entry disabled. POST /api/console/apps
requires the same membership as build sessions, with no Console-admin exception.
Moving an existing app (PATCH) is unchanged (APT-1151). The development mocks apply
the production rules.

APT-1128
…t app outside the user's groups

Security review follow-ups for APT-1128:

- POST /api/console/apps and the first POST /api/console/apps/{id}/bind of an
  unbound record resolve fresh Directory membership, so a user removed from a group
  cannot create or bind into it on a cached view. Already-bound records keep 409.
- Resuming a wizard whose kept app sits in a group the user has left is blocked
  instead of moving the app.
- The mocks authorize a build-session group before an idempotent replay and return
  production's error for an unknown create group.

APT-1128
The mock bind route now requires membership of an unbound app's current group,
with production's 400 body and no Console-admin exception, and keeps production's
409 for an already-bound app.

APT-1128
@reoring reoring added the needs-human-review Waits for a person's review before merge label Nov 16, 2026
@reoring

reoring commented Nov 16, 2026

Copy link
Copy Markdown
Contributor Author

Merging on the owner's decision (2026-11-16, relayed by the PO lead): APT-1128 creation rule. Head d1002c5454afa8f3161699a21ba404611ec72739 equals the head of the third security re-review ("merge OK with noted follow-ups"), and all six checks (console-verification, console-mock-stories, server, server-db, web, publisher) pass on it. No tag or release: 0.5.11 is held until the owner decides its content.

@reoring
reoring merged commit cf22815 into main Nov 16, 2026
6 checks passed
@reoring reoring removed the needs-human-review Waits for a person's review before merge label Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant