Repository navigation
docs(aidlc): let the database decide permissions from the user ID alone - #81
Merged
Merged
Conversation
Checking on 2026-11-01 showed that comparing a claimed role with the stored one only stops application bugs: a compromised application can claim a real admin's user ID, and app_rls may update app_accounts.role itself. The same holds for the existing members trigger. The requester decided that a compromised application is outside what the database guarantees. - requirements.md C-4: the application tells the database who is calling (the user ID) and never claims a role or permission; the database works the permissions out. The aim is stopping bugs. Record the scope, and that C-4 in this form is met by U-3, not by the current code. - unit-of-work.md: fold U-2.5 into U-3, correct its earlier claim that the cross-check stopped a compromised application, and specify app_private.has_permission(user_id, key) for member's RLS. After U-10, community cannot read member_roles, so it uses the permissions member resolves for it (received in U-11). Launch conditions and order follow. - components.md 3.3 and 3.5, README.md: follow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vm1iXpgdwQfcWuyNzX9KF7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
権限の決め方についての設計変更を、ドキュメントに記録する PR です。2026-11-01 に依頼者が決定した内容で、コードの変更はありません。
背景:前の説明は、守れる範囲を大きく書きすぎていた
C-4 と U-2.5 は「アプリが申告した役割を、データベースが実際の値と突き合わせる。アプリが侵害されても権限を偽装できない」と説明していました。確かめたところ、この方式で防げるのはアプリのバグだけでした。
app_rls)はapp_accountsを更新でき(split_auth_schema.sql:79)、role列も制限されていません。突き合わせ先そのものを書き換えられます既存の
membersの突き合わせ(enforce_member_workflow)も同じで、守れているのはバグだけです。決めたこと
app_private.has_permission(ユーザー ID, '権限名'))。申告そのものがなくなるので、「申告を間違える」バグが起こりませんmember_rolesを読めません。権限を計算する場所は member の 1 か所に限ります。受け取り方は U-11 で決めます変更したファイル
requirements.mdunit-of-work.mdcomponents.mdREADME.mdFR-5.3(ロールの変更履歴)は、予定どおり U-5 で作るものとして残しています。
Generated by Claude Code