mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 06:00:46 -05:00
SimulateCustomPolicy evaluates requested actions and resources against a
standalone set of policy documents plus an optional permissions boundary,
reusing the same identity/boundary evaluation as SimulatePrincipalPolicy.
GetContextKeysForCustomPolicy and GetContextKeysForPrincipalPolicy list the
context keys referenced across a set of documents, or a resolved principal's
policies plus any extra documents supplied.
contextKeysReferencedIn collects every Condition operator's key, every
${...} policy variable named in a Resource pattern, and every one named in
a Condition value, in statement order, without sorting or de-duplicating:
AWS's own documented example response for GetContextKeysForPrincipalPolicy
repeats a key referenced by more than one statement. A variable's default
value (${key, 'default'}) is stripped to just the key name, and the three
single-character escapes (${*}, ${?}, ${$}) are excluded, since AWS
defines those as literal-character substitutions, not context-key
references. NotResource is not scanned: AWS documents policy variables as
usable only in Resource and in Condition values, never in NotResource,
Action or Principal.
Also completes AwsQueryController's IAM_ACTIONS fallback set for the three
new actions, matching SimulatePrincipalPolicy's existing entry there.
Known limitations, documented in iam.md: PolicySourceArn resolves a user or
role only, not a group (inherited from SimulatePrincipalPolicy); only one
PermissionsBoundaryPolicyInputList document is honored, matching AWS's own
stated limit; ResourcePolicy, ResourceOwner, ResourceHandlingOption and
OrderedOrganizationPolicyInputList are not evaluated; MatchedStatements,
ResourceSpecificResults and PermissionsBoundaryDecisionDetail are never
populated; ContextKeyType is accepted but not read, since the comparison is
driven by the policy's own condition operator.