Knowledge Base のメタデータフィルタリングに、ABAC(属性ベースアクセス制御)および S3 プレフィックスベースのドキュメントアクセス制御の動的フィルター例を追加します。#1457
Open
takke1986 wants to merge 1 commit intoaws-samples:mainfrom
Open
Knowledge Base のメタデータフィルタリングに、ABAC(属性ベースアクセス制御)および S3 プレフィックスベースのドキュメントアクセス制御の動的フィルター例を追加します。#1457takke1986 wants to merge 1 commit intoaws-samples:mainfrom
takke1986 wants to merge 1 commit intoaws-samples:mainfrom
Conversation
…dge Base Add dynamic filter examples for ABAC (Attribute-Based Access Control) and S3 prefix-based document access control in Knowledge Base metadata filtering. Changes: - Add Example 3: ABAC filter using Cognito custom attributes (e.g., custom:department) with equals operator - Add Example 4: S3 prefix filter using x-amz-bedrock-kb-source-uri with startsWith operator (OpenSearch Serverless only) - Pass DATA_SOURCE_BUCKET_NAME env var to chat Lambda for prefix filter - Add department key to sample metadata.json files - Add ABAC and S3 prefix filter documentation in ja/en DEPLOY_OPTION.md - Move Claude Sonnet 3.5 note to implicitFilters where it belongs Co-authored-by: Cursor <cursoragent@cursor.com>
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.
変更内容
フィルター例の追加:
Example 3: ABAC フィルター — Cognito カスタム属性(custom:department)を使用し、equals オペレーターでユーザーの所属部署に一致するドキュメントのみを検索対象にするフィルター例。全ベクトルストアで利用可能。
Example 4: S3 プレフィックスフィルター — x-amz-bedrock-kb-source-uri と startsWith オペレーターを使用し、S3 オブジェクトのプレフィックスに基づいて検索結果を制限するフィルター例。startsWith は S3 Vectors ベクトルストアでは非対応のため、OpenSearch Serverless 等でのみ利用可能。
インフラ・設定変更:
Chat Lambda に DATA_SOURCE_BUCKET_NAME 環境変数を追加(S3 プレフィックスフィルター用)
サンプル metadata.json ファイルに department キーを追加
ドキュメント更新:
日本語・英語の DEPLOY_OPTION.md に ABAC および S3 プレフィックスフィルターのセットアップ手順を追記
Claude Sonnet 3.5 に関する注記を dynamicFilters から implicitFilters の説明に移動(本来の適切な位置へ)
セキュリティに関する注記
ABAC フィルター(Example 3)を部署間のアクセス制御として使用する場合、以下の前提条件が必要です。ドキュメントにもこの旨を記載しています。
フィルター値の取得元: custom:department の値は必ずサーバーサイドで Cognito トークンのクレームから取得し、クライアントからのリクエストパラメータは使用しないこと
カスタム属性の編集権限: Cognito ユーザープールの custom:department 属性はユーザー自身が編集できない(管理者のみ変更可能な)設定にすること
メタデータファイルの保護: データソース S3 バケットの .metadata.json ファイルにエンドユーザーが直接書き込みできないように IAM ポリシーで制限すること。ユーザーがドキュメントをアップロードする要件がある場合は、アップロード用の一時バケットを経由し、Lambda 等でメタデータを認証情報に基づいて自動付与する構成とすること
既存ユーザーへの影響
既存の Example 1(Cognito Groups)、Example 2(SAML IdP Groups)には影響なし
DATA_SOURCE_BUCKET_NAME 環境変数は Example 4 を使用する場合のみ必要。未設定でも既存動作に影響なし
implicitFilters への注記移動は表示上の変更のみで、動作への影響なし
Checklist
Related Issues
#1456