View a markdown version of this page

정책 생성: 정책별 검증 - Amazon Bedrock AgentCore

정책 생성: 정책별 검증

정책 작성 서비스를 사용하여 자연어에서 정책을 생성하는 경우 생성 중에 개별 정책에 따라 검증 및 분석이 수행됩니다.

작동 방식

  1. 자연어가 Cedar 정책으로 변환됨

  2. 생성된 각 정책은 게이트웨이 스키마에 대해 검증됩니다.

  3. 분석은 각 정책에 대해 개별적으로 실행됩니다.

  4. 생성 응답에서 결과를 사용할 수 있습니다.

예: 정책 생성 및 검증

생성 결과 검색은 2단계 프로세스입니다. 먼저 생성 상태를 확인한 다음 생성된 자산을 나열하여 정책 및 검증 결과를 확인합니다.

정책 생성을 시작합니다.

aws bedrock-agentcore-control start-policy-generation \ --policy-engine-id MyEngine-abc123 \ --name RefundPolicy \ --content '{ "rawText": "Allow customer service agents to process refunds up to 500 dollars for orders placed within the last 30 days" }' \ --resource '{ "arn": "arn:aws:bedrock-agentcore:us-east-1:123456789012:gateway/MyGateway-xyz789" }'

응답에는 정책 생성 ID 및 상태가 포함됩니다.

{ "policyGenerationId": "RefundPolicy-def456", "policyEngineId": "MyEngine-abc123", "status": "GENERATING" }

를 사용하여 생성 상태를 확인합니다get-policy-generation.

aws bedrock-agentcore-control get-policy-generation \ --policy-engine-id MyEngine-abc123 \ --policy-generation-id RefundPolicy-def456

응답에는 전체 생성 상태가 표시됩니다.

{ "policyGenerationId": "RefundPolicy-def456", "status": "GENERATED", "statusReasons": [] }

상태가 GENERATED 이면 생성된 자산을 나열하여 정책 및 정책별 검증 결과를 검색합니다.

aws bedrock-agentcore-control list-policy-generation-assets \ --policy-engine-id MyEngine-abc123 \ --policy-generation-id RefundPolicy-def456

응답에는 Cedar 정의 및 검증 결과와 함께 생성된 각 정책이 포함됩니다.

{ "policyGenerationAssets": [ { "policyGenerationAssetId": "asset-1", "definition": { "cedar": { "statement": "permit(\n principal is AgentCore::OAuthUser,\n action == AgentCore::Action::\"RefundTool___process_refund\",\n resource == AgentCore::Gateway::\"arn:aws:bedrock-agentcore:us-east-1:123456789012:gateway/MyGateway-xyz789\"\n) when {\n context.input.amount <= 500\n};" } }, "findings": [ { "type": "VALID" } ], "rawTextFragment": "Allow customer service agents to process refunds up to 500 dollars" }, { "policyGenerationAssetId": "asset-2", "definition": { "cedar": { "statement": "permit(\n principal,\n action == AgentCore::Action::\"RefundTool___view_order_history\",\n resource\n);" } }, "findings": [ { "type": "ALLOW_ALL", "description": "Overly Permissive: Policy Engine will allow every request for the specified principal (AgentCore::OAuthUser), action (RefundTool___view_order_history) and resource (gateway/*) combination if the policy is added or updated" } ], "rawTextFragment": "Allow customer service agents to view order history" } ] }

정책당 검증 조사 결과

생성된 각 정책 자산에는 및 description가 있는 Finding 객체 findings 배열이 포함되어 type 있습니다. 다음 예제에서는 다양한 결과 유형을 보여줍니다.

검증 및 분석을 통과한 정책:

{ "findings": [ { "type": "VALID" } ] }

지나치게 허용적인 것으로 플래그가 지정된 정책:

{ "findings": [ { "type": "ALLOW_ALL", "description": "Overly Permissive: Policy Engine will allow every request for the specified principal (AgentCore::OAuthUser), action (RefundTool___view_order_history) and resource (gateway/*) combination if the policy is added or updated" } ] }

자연어 입력에서 생성할 수 없는 정책:

{ "findings": [ { "type": "NOT_TRANSLATABLE", "description": "Unsupported Condition Error: The request includes conditions that rely on data or attributes currently not supported." } ] }

생성된 정책에 대한 일반적인 조사 결과

다음 표에서는 생성된 정책에 대해 반환할 수 있는 결과 유형을 설명합니다.

찾기 유형 심각도 설명 권장 조치

VALID

Success

정책은 조사 결과 없이 유효한 Cedar입니다. 이 결과 유형에 대한 설명은 반환되지 않습니다.

작업이 필요하지 않습니다. 정책을 사용할 준비가 되었습니다.

INVALID

오류

생성된 Cedar 정책에 구문 오류가 포함되어 있거나 게이트웨이 스키마를 준수하지 않습니다.

스키마 위반 또는 구문 문제에 대해 생성된 정책을 검토합니다. 자연어 입력의 문구를 바꾸고 재생성합니다.

NOT_TRANSLATABLE

오류

자연어를 유효한 Cedar로 변환할 수 없습니다. 요청에는 지원되지 않는 데이터 또는 속성에 의존하는 조건이 포함될 수 있습니다.

대상 게이트웨이 리소스에서 도구 정의를 다시 확인합니다.

ALLOW_ALL

경고

허용 정책은 모든 보안 주체, 작업 및 리소스 조합에 적용됩니다.

무제한 액세스가 의도되었는지 확인합니다. 그렇지 않은 경우 범위를 제한하는 조건을 추가합니다.

ALLOW_NONE

경고

허용 정책은 아무것도 허용하지 않으므로 결정되지 않습니다.

정책 조건을 검토합니다. 정책에는 모순되거나 연결할 수 없는 조건이 포함될 수 있습니다.

DENY_ALL

경고

정책은 모든 보안 주체에 대한 모든 작업을 거부합니다.

전체 거부가 의도되었는지 확인합니다. 이렇게 하면 forbid-overrides-permit 의미 체계로 인한 모든 허용 정책이 재정의됩니다.

DENY_NONE

경고

금지 정책은 아무것도 거부하지 않기 때문에 결정되지 않습니다.

정책 조건을 검토합니다. 금지 정책에는 모순되거나 연결할 수 없는 조건이 포함될 수 있습니다.