Skip to content

Commit 23fafb9

Browse files
committed
Updated cedar policy to use templates
1 parent 8c36be5 commit 23fafb9

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
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

710
permit(
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+
# };

0 commit comments

Comments
 (0)