Repository navigation
Conversation
…olicy to Policy Closes aws#39530.
This branch was previously deployed
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.
Issue # (if applicable)
Closes #39530.
Reason for this change
AWS::BedrockAgentCore::Policyhas two members inDefinition(CedarandPolicy) and anEnforcementModeproperty (ACTIVEorLOG_ONLY). The L2Policyconstruct always writesDefinition.Cedar.Statementand has no enforcement mode prop. Statements that only thepolicymember accepts, such as awhen guardrails { ... }block or thesuppressOutputeffect, cannot be declared with the L2, and a policy cannot be rolled out inLOG_ONLYwithout a property override.Description of changes
PolicyEnforcementModewithACTIVE,LOG_ONLYandof(), built the same way asPolicyValidationMode.enforcementModeonPolicyPropsandAddPolicyOptions.PolicyEngine.addPolicy()passes it through, andPolicyexposes it.PolicyStatement.fromPolicy(), which works likefromCedar()(raw, trusted input) and marks the statement for thepolicymember.Policywrites it toDefinition.Policy.Statement.Design decisions:
enforcementModeis not set, the property is left out of the template, so existing stacks synthesize exactly as before. The service default isACTIVEper theCreatePolicyAPI reference.definitionTypeprop, so a statement and its member cannot get out of sync.@aws-cdk/aws-bedrock-agentcore-alphastill has its own copy ofPolicywith the same gap. I left it because the Policy submodule graduated in feat(bedrockagentcore): graduate Policy submodule to stable #38687. Happy to add the same change there if you want it.fromPolicy()does not check the statement's syntax, the same asfromCedar(). The existing length validation still applies, and the service checks the statement at create time.Describe any new or updated permissions being added
None.
Description of how you validated changes
EnforcementMode,Cedarmember),ACTIVE,LOG_ONLYandof()rendered,fromPolicy()writes thePolicymember alone and withLOG_ONLY,addPolicy()passes the mode through, and the length validation still applies tofromPolicy().integ.policy-enforcement-modedeployed in us-east-1. It creates a Cedar policy inLOG_ONLYand afromPolicy()policy inLOG_ONLY, then reads both back withGetPolicyand checksenforcementMode,status: ACTIVEanddefinition.policy.policymember. A guardrail condition is validated against the output schema of a Gateway tool (the service returned "argumentcontext.output.customeris not present in the context of actionAgentCore::Action::"CallTool"" without one), so it would need a Gateway and a tool target in the stack.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license