File tree Expand file tree Collapse file tree
apps/java-spring-ai-agents/scripts/policy Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- # Cedar policy: Permit all tools EXCEPT cancelTrip and deleteExpense for user alice
1+ # Cedar policy: Permit all tools EXCEPT searchFlights for user alice
22#
33# Uses 'unless' clause to deny specific tools while permitting all others.
44# This approach works around AgentCore's "Overly Restrictive" safety check
55# that rejects standalone 'forbid' policies.
6+ #
7+ # NOTE: This is a template. Actual policy is generated by 02-create-policy.py
8+ # using values from .env (GATEWAY_ID, TARGET_NAME)
69
710permit(
811 principal is AgentCore::OAuthUser,
912 action,
10- resource == AgentCore::Gateway::"arn:aws:bedrock-agentcore:us-east-1:724772082315 :gateway/policy-demo-gateway-wwh6rjluyl "
13+ resource == AgentCore::Gateway::"arn:aws:bedrock-agentcore:${REGION}:${ACCOUNT_ID} :gateway/${GATEWAY_ID} "
1114) when {
1215 principal.hasTag("username") &&
1316 principal.getTag("username") == "alice"
1417} unless {
15- action == AgentCore::Action::"backoffice___cancelTrip " ||
16- action == AgentCore::Action::"backoffice___deleteExpense "
18+ action == AgentCore::Action::"${TARGET_NAME}___cancelTrip " ||
19+ action == AgentCore::Action::"${TARGET_NAME}___deleteExpense "
1720};
21+
22+ # To deny multiple tools, use OR:
23+ # } unless {
24+ # action == AgentCore::Action::"${TARGET_NAME}___searchFlights" ||
25+ # action == AgentCore::Action::"${TARGET_NAME}___anotherTool"
26+ # };
You can’t perform that action at this time.
0 commit comments