fix(iam): read the organization levels and scenario a simulation was handed (#8585)

Both policy simulators accepted OrderedOrganizationPolicyInputList and
ResourceHandlingOption and answered as though neither had been sent.

The levels now gate a simulation the way they gate the call it stands for,
through the same walk a live request takes through service control policies:
an action no level allows is an implicitDeny, a level that denies it is an
explicitDeny whatever the levels below allow, and a level carrying no
statements is skipped. A level whose document does not read as a policy is an
InvalidInput naming the item's position. The levels a call hands in are the
whole of the organization the simulation runs against, matching the console,
which includes SCPs only when the box is ticked.

A named scenario is held to the resources it requires, "to enforce the
presence of the required resources to ensure reliable simulation results", and
a value naming no published scenario is refused. A simulation that names no
scenario is left alone.

One difference from AWS's simulator is documented and open: AWS says its
simulator does not evaluate SCPs that have global conditions, while this walk
evaluates a condition in an SCP exactly as the live evaluation does.
This commit is contained in:
Priamo Germosen authored and GitHub committed 2026-11-16 11:01:02 -04:00
1 parent 4a7953bb0b
commit bba2ac901e
5 files changed
+460 -10

No files matched your search

+31 -6
View File
@@ -854,16 +854,41 @@ the shape. The length wording follows the captures of real IAM length violations
bound the value broke and leaving the value itself out of the message. Either simulation action
accepts only one `PermissionsBoundaryPolicyInputList` document, matching AWS's own documented
limit; extra documents beyond the first are ignored. Neither evaluates a resource-based policy
(`ResourcePolicy`) or `OrderedOrganizationPolicyInputList`, and neither returns
`MatchedStatements`, `ResourceSpecificResults`, or a `PermissionsBoundaryDecisionDetail`: only the
top-level `EvalDecision` is populated, so which policy allowed an action is not reported even where
AWS names one, `PolicyInputList.1` in its own example for the principal simulator.
`ResourceHandlingOption` is accepted and read by neither action, so none of the EC2 scenarios it
names has its required resources enforced.
(`ResourcePolicy`), and neither returns `MatchedStatements`, `ResourceSpecificResults`, or a
`PermissionsBoundaryDecisionDetail`: only the top-level `EvalDecision` is populated, so which
policy allowed an action is not reported even where AWS names one, `PolicyInputList.1` in its own
example for the principal simulator.
`ContextEntries.member.N.ContextKeyType` is accepted but not read; the comparison is driven
entirely by the policy's own condition operator (`Bool`, `NumericEquals`, `DateEquals`, and so on),
not by the declared type.
`OrderedOrganizationPolicyInputList` is read by both simulators, each member one level of an
Organizations hierarchy from the root to the account, and the levels gate the simulation the way
they gate the call it stands for: an action no level allows answers `implicitDeny`, a level that
denies it answers `explicitDeny` whatever the levels below it allow, and a level carrying no
statements is `FullAWSAccess` semantics and is skipped. A level whose document does not read as a
policy is an `InvalidInput` naming the item's position. The levels a call hands in are the whole of
the organization a simulation runs against: the SCPs the principal's own account sits under are not
applied, matching the console, which includes SCPs only when "AWS Organizations SCPs" is ticked.
One difference from AWS's simulator is known and open: AWS
documents that "the policy simulator doesn't evaluate SCPs that have global conditions", while this
walk evaluates a condition in an SCP exactly as the live evaluation does. So a simulation here can
decide a level AWS's simulator passes over, and the published sentence does not say whether what
AWS skips is the statement carrying the condition or the policy holding it.
`ResourceHandlingOption` is read by both simulators, which hold a named scenario to the resources
it requires, "to enforce the presence of the required resources to ensure reliable simulation
results". All four published scenarios are VPC scenarios, so each needs an instance, an image, a
security group and a network interface; the `EBS` forms need a volume as well, and the `-Subnet`
forms a subnet. A resource `ResourceArns` does not name is an `InvalidInput` saying which type is
missing.
A value naming no published scenario is an `InvalidInput` as well, while a simulation that names no
scenario is left alone, since "if your simulation does not match one of the following scenarios,
then you can omit this parameter". Omitting the member is what is left alone rather than emptying
it: a value of nothing but space names no scenario, and a value carried empty is answered by the
member's declared minimum of one ahead of the operation. Both refusals are this emulator's wording:
AWS publishes the requirement but no message for breaking it.
`PolicyInputList` and `PermissionsBoundaryPolicyInputList` on `SimulatePrincipalPolicy` are read,
the documents a simulation is handed beside the ones the principal holds. A `PolicyInputList`
document is "an optional list of additional policy documents to include in the simulation", so each
@@ -435,11 +435,22 @@ public class IamPolicyEvaluator {
List<PolicyStatement> boundaryStmts = caller.boundaryPolicyDocument() == null
? null : parseAll(List.of(caller.boundaryPolicyDocument()));
// Organization levels gate a simulation the way they gate the call it stands for: the
// action must be allowed at every level and explicitly denied at none, before the input
// policies are consulted. This is the live path's own walk, so a simulation cannot answer
// differently from the request it models.
ScpWalk scp = scpWalk(caller.scpLevels(), loweredAction, resource, ctx);
if (scp.firstDeny() != null) {
return SimulationDecision.EXPLICIT_DENY;
}
if (anyExplicitDeny(identityStmts, loweredAction, resource, ctx)
|| (sessionStmts != null && anyExplicitDeny(sessionStmts, loweredAction, resource, ctx))
|| (boundaryStmts != null && anyExplicitDeny(boundaryStmts, loweredAction, resource, ctx))) {
return SimulationDecision.EXPLICIT_DENY;
}
if (!scp.allows()) {
return SimulationDecision.IMPLICIT_DENY;
}
if (!anyExplicitAllow(identityStmts, loweredAction, resource, ctx)) {
return SimulationDecision.IMPLICIT_DENY;
}
@@ -2190,10 +2190,20 @@ public class IamQueryHandler {
PolicyExclusions exclusions = PolicyExclusions.from(params);
List<String> inputDocuments = readablePolicyInputList(params);
String inputBoundary = inputBoundaryDocument(params);
CallerContext caller = withInputDocuments(
iamService.resolvePrincipalContext(policySourceArn, exclusions), inputDocuments, inputBoundary);
List<String> actionNames = requireActionNames(params);
// SCPs enter a simulation only when the call asks for them, the way the console includes
// them only when "AWS Organizations SCPs" is ticked, so the levels the call handed in are
// the whole of the organization the simulation runs against. They are read where the other
// handed-in documents are, ahead of the lookup, so a principal that does not exist cannot
// answer for an input this operation refuses: that is the rule above, and these two inputs
// live under it as well.
List<List<String>> scpLevels = organizationPolicyLevels(params);
List<String> resourceArns = extractResourceArnsOrWildcard(params);
SimulationScenarios.requireScenarioResources(params.getFirst("ResourceHandlingOption"),
resourceArns);
CallerContext caller = withInputDocuments(
iamService.resolvePrincipalContext(policySourceArn, exclusions), inputDocuments, inputBoundary)
.withScpLevels(scpLevels);
List<String> actionNames = requireActionNames(params);
// Keyed without regard to case, as the evaluator compares condition key names: a value
// the call supplied has to shadow a populated one however the call spelled the key.
Map<String, List<String>> context = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
@@ -2218,12 +2228,57 @@ public class IamQueryHandler {
private Response handleSimulateCustomPolicy(MultivaluedMap<String, String> params) {
List<String> policyInputList = requirePolicyInputList(params);
List<String> actionNames = requireActionNames(params);
// Read before the scenario, as the principal simulation reads them, so a bad level and a
// bad scenario are answered in the same order whichever operation was called.
List<List<String>> scpLevels = organizationPolicyLevels(params);
List<String> resourceArns = extractResourceArnsOrWildcard(params);
SimulationScenarios.requireScenarioResources(params.getFirst("ResourceHandlingOption"),
resourceArns);
Map<String, List<String>> context = extractContextEntries(params);
CallerContext caller = new CallerContext(policyInputList, null, inputBoundaryDocument(params));
CallerContext caller = new CallerContext(policyInputList, null, inputBoundaryDocument(params),
scpLevels);
return simulationResults("SimulateCustomPolicy", params, caller, actionNames, resourceArns, context);
}
/**
* The service control policies a simulation was handed, one list per level of an
* organization. The member's reference describes both the shape and the order: "An ordered
* list of service control policies (SCPs) to include in the simulation. Each element
* represents one level of an Organizations hierarchy, from the organization root to the
* account. The simulator evaluates SCPs in the order that you provide, consistent with how
* Organizations enforces SCPs." So the levels go to the evaluator as the caller's effective
* SCPs, which is the walk a live request already takes through them, in the order the request
* wrote. How many levels there may be is the model's to say, seven on this list, and the
* declared constraints are read ahead of this.
*
* <p>Each document is held to being a policy document, as the documents of the other input
* lists are, and a level naming none is no level: a request that carries the member and
* nothing in it simulates with no organization above it rather than with an empty root.
*/
private List<List<String>> organizationPolicyLevels(MultivaluedMap<String, String> params) {
List<List<String>> levels = new ArrayList<>();
for (AwsQueryLists.IndexedMember level
: AwsQueryLists.members(params, "OrderedOrganizationPolicyInputList", null)) {
List<String> documents = new ArrayList<>();
for (AwsQueryLists.IndexedMember document : AwsQueryLists.members(params,
level.prefix() + ".ServiceControlPolicyInputList", null)) {
String policy = params.getFirst(document.prefix());
if (policy == null) {
continue;
}
if (!policyEvaluator.readsAsPolicyDocument(policy)) {
throw new AwsException("InvalidInput", "Ordered organization policy input list"
+ " item " + level.index() + " has invalid content", 400);
}
documents.add(policy);
}
if (!documents.isEmpty()) {
levels.add(List.copyOf(documents));
}
}
return levels.isEmpty() ? null : List.copyOf(levels);
}
/**
* The documents a principal simulation was handed beside the principal's own.
* {@code PolicyInputList} is "an optional list of additional policy documents to include in
@@ -0,0 +1,93 @@
package io.floci.aws.services.iam;
import io.floci.aws.core.common.AwsArnUtils;
import io.floci.aws.core.common.AwsException;
import java.util.List;
import java.util.Map;
/**
* The simulation types {@code ResourceHandlingOption} names, and the resources each one has to be
* given.
*
* <p>The member's reference says what it is for: "Specifies the type of simulation to run.
* Different API operations that support resource-based policies require different combinations of
* resources. By specifying the type of simulation to run, you enable the policy simulator to
* enforce the presence of the required resources to ensure reliable simulation results." It then
* publishes the four scenarios and what each requires, which is what this holds: "Each of the
* Amazon EC2 scenarios requires that you specify instance, image, and security group resources. If
* your scenario includes an EBS volume, then you must specify that volume as a resource. If the
* Amazon EC2 scenario includes VPC, then you must supply the network interface resource. If it
* includes an IP subnet, then you must specify the subnet resource."
*
* <p>Two refusals here are this emulator's own wording. AWS publishes no sentence for a scenario
* whose resources are missing, nor for a value that names no scenario at all, and both are
* {@code InvalidInput}, the error both simulators model for "an invalid or out-of-range value
* supplied for an input parameter". The member's own length is held to the model ahead of this,
* as every declared constraint of these operations is.
*/
final class SimulationScenarios {
/** Each published scenario and the EC2 resource types a simulation of it has to name. */
private static final Map<String, List<String>> REQUIRED = Map.of(
"EC2-VPC-InstanceStore", List.of("instance", "image", "security-group",
"network-interface"),
"EC2-VPC-InstanceStore-Subnet", List.of("instance", "image", "security-group",
"network-interface", "subnet"),
"EC2-VPC-EBS", List.of("instance", "image", "security-group", "network-interface",
"volume"),
"EC2-VPC-EBS-Subnet", List.of("instance", "image", "security-group",
"network-interface", "subnet", "volume"));
private SimulationScenarios() {
}
/**
* Holds a simulation to the resources its scenario requires, or passes a request that names no
* scenario: "If your simulation does not match one of the following scenarios, then you can
* omit this parameter." Omitting the member is what passes, not emptying it: a member the
* request carries is a value rather than a member it left out, so a value of nothing but
* spaces names no published scenario and is refused like any other value that names none. A
* member carried empty never reaches here, the declared minimum of one answering it ahead of
* this operation.
*/
static void requireScenarioResources(String option, List<String> resourceArns) {
if (option == null) {
return;
}
List<String> required = REQUIRED.get(option);
if (required == null) {
throw new AwsException("InvalidInput", "ResourceHandlingOption " + option
+ " is not one of the simulation types this operation runs.", 400);
}
for (String type : required) {
if (!namesResourceOfType(resourceArns, type)) {
throw new AwsException("InvalidInput", "ResourceHandlingOption " + option
+ " requires a resource of type " + type + " among the ResourceArns.", 400);
}
}
}
/** Whether any resource ARN names an EC2 resource of {@code type}. */
private static boolean namesResourceOfType(List<String> resourceArns, String type) {
if (resourceArns == null) {
return false;
}
String prefix = type + "/";
for (String arn : resourceArns) {
AwsArnUtils.Arn parsed;
try {
parsed = AwsArnUtils.parse(arn);
} catch (IllegalArgumentException ignored) {
// A value the parser refuses names no resource of any type, whether it was meant
// as an ARN or not, and the member that carried it is held to its shape elsewhere.
continue;
}
if ("ec2".equals(parsed.service()) && parsed.resource() != null
&& parsed.resource().startsWith(prefix)) {
return true;
}
}
return false;
}
}
@@ -0,0 +1,266 @@
package io.floci.aws.services.iam;
import io.floci.aws.testing.PartitionCleanup;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.specification.RequestSpecification;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import java.util.List;
import static io.restassured.RestAssured.given;
import static java.util.Collections.nCopies;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The two simulation members both simulators used to answer as though they had not been sent.
*
* <p>{@code OrderedOrganizationPolicyInputList} is "an ordered list of service control policies
* (SCPs) to include in the simulation. Each element represents one level of an Organizations
* hierarchy, from the organization root to the account", evaluated "in the order that you provide,
* consistent with how Organizations enforces SCPs", which is what the levels do here: an action no
* level allows is denied, and one every level allows survives the walk. A simulation gates on the
* levels it was handed and on nothing else, the way the console includes SCPs only when "AWS
* Organizations SCPs" is ticked.
*
* <p>{@code ResourceHandlingOption} names the type of simulation, and by naming it "you enable the
* policy simulator to enforce the presence of the required resources to ensure reliable simulation
* results". So a scenario whose resources are not all named is refused rather than simulated, and
* the request that names no scenario is left alone.
*
* <p>Both are inputs, so both are answered where this package answers an input: ahead of the
* principal lookup, which cannot answer for a request the operation refuses.
*/
@QuarkusTest
class IamSimulateOrganizationAndScenarioIntegrationTest {
private static final String IAM_AUTH =
"AWS4-HMAC-SHA256 Credential=test/20261115/us-east-1/iam/aws4_request";
private static final String ACCOUNT = "000000000000";
private static final String CODE = "ErrorResponse.Error.Code";
private static final String MESSAGE = "ErrorResponse.Error.Message";
private static final String CUSTOM_DECISION = "SimulateCustomPolicyResponse"
+ ".SimulateCustomPolicyResult.EvaluationResults.member.EvalDecision";
private static final String PRINCIPAL_DECISION = "SimulatePrincipalPolicyResponse"
+ ".SimulatePrincipalPolicyResult.EvaluationResults.member.EvalDecision";
private static final String INPUT = "PolicyInputList.member.1";
private static final String LEVELS = "OrderedOrganizationPolicyInputList.member.";
/** The EC2 resources the published scenarios require, as ARNs a simulation may name. */
private static final String INSTANCE = "arn:aws:ec2:us-east-1:000000000000:instance/i-1";
private static final String IMAGE = "arn:aws:ec2:us-east-1:000000000000:image/ami-1";
private static final String SECURITY_GROUP = "arn:aws:ec2:us-east-1:000000000000:security-group/sg-1";
private static final String NETWORK_INTERFACE = "arn:aws:ec2:us-east-1:000000000000:network-interface/eni-1";
private static final String VOLUME = "arn:aws:ec2:us-east-1:000000000000:volume/vol-1";
/** The user the principal-side cases simulate outlives the class otherwise: the emulator is shared. */
@RegisterExtension
final PartitionCleanup cleanup = new PartitionCleanup();
@Test
void anActionNoOrganizationLevelAllowsIsDeniedByTheLevelsTheCallHandedIn() {
// The input policy allows it, so what refuses it is the hierarchy above it.
RequestSpecification simulation = custom("s3:GetObject")
.formParam(LEVELS + "1.ServiceControlPolicyInputList.member.1", allow("s3:PutObject"));
assertEquals("implicitDeny", decision(simulation, CUSTOM_DECISION));
}
@Test
void anActionEveryLevelAllowsSurvivesTheWalk() {
RequestSpecification simulation = custom("s3:GetObject")
.formParam(LEVELS + "1.ServiceControlPolicyInputList.member.1", allow("s3:*"))
.formParam(LEVELS + "2.ServiceControlPolicyInputList.member.1", allow("s3:GetObject"));
assertEquals("allowed", decision(simulation, CUSTOM_DECISION));
}
@Test
void aLevelThatDeniesTakesTheActionWhateverTheLevelsBelowItSay() {
RequestSpecification simulation = custom("s3:GetObject")
.formParam(LEVELS + "1.ServiceControlPolicyInputList.member.1", deny("s3:GetObject"))
.formParam(LEVELS + "2.ServiceControlPolicyInputList.member.1", allow("s3:*"))
.formParam(LEVELS + "3.ServiceControlPolicyInputList.member.1", allow("s3:GetObject"));
assertEquals("explicitDeny", decision(simulation, CUSTOM_DECISION));
}
@Test
void aLevelCarryingNoPolicyDocumentIsRefusedLikeAnyInputDocument() {
custom("s3:GetObject")
.formParam(LEVELS + "1.ServiceControlPolicyInputList.member.1", "{not-a-policy")
.when().post("/").then().statusCode(400)
.body(CODE, equalTo("InvalidInput"));
}
@Test
void theLevelsGateAPrincipalSimulationTheSameWay() {
String userName = createUserAllowed("s3:GetObject");
assertEquals("explicitDeny", decision(simulatePrincipal(userName, "s3:GetObject")
.formParam(LEVELS + "1.ServiceControlPolicyInputList.member.1", deny("s3:GetObject")),
PRINCIPAL_DECISION));
// The same principal, asked without the levels: the deny came from them and nowhere else.
assertEquals("allowed", decision(simulatePrincipal(userName, "s3:GetObject"), PRINCIPAL_DECISION));
}
@Test
void aScenarioIsHeldToTheResourcesItRequires() {
// Instance, image and security group named, network interface left out.
custom("ec2:StartInstances")
.formParam("ResourceArns.member.1", INSTANCE)
.formParam("ResourceArns.member.2", IMAGE)
.formParam("ResourceArns.member.3", SECURITY_GROUP)
.formParam("ResourceHandlingOption", "EC2-VPC-InstanceStore")
.when().post("/").then().statusCode(400)
.body(CODE, equalTo("InvalidInput"))
.body(MESSAGE, containsString("network-interface"));
}
@Test
void aScenarioIsHeldToItsResourcesOnAPrincipalSimulationToo() {
String userName = createUserAllowed("ec2:StartInstances");
simulatePrincipal(userName, "ec2:StartInstances")
.formParam("ResourceHandlingOption", "EC2-VPC-EBS")
.when().post("/").then().statusCode(400)
.body(CODE, equalTo("InvalidInput"));
}
@Test
void aScenarioWhoseResourcesAreAllNamedSimulates() {
RequestSpecification simulation = custom("ec2:StartInstances")
.formParam("ResourceArns.member.1", INSTANCE)
.formParam("ResourceArns.member.2", IMAGE)
.formParam("ResourceArns.member.3", SECURITY_GROUP)
.formParam("ResourceArns.member.4", NETWORK_INTERFACE)
.formParam("ResourceArns.member.5", VOLUME)
.formParam("ResourceHandlingOption", "EC2-VPC-EBS");
// One result per resource named, as every simulation answers, and the scenario is complete.
assertEquals(nCopies(5, "allowed"), decisions(simulation, CUSTOM_DECISION));
}
@Test
void aValueNamingNoScenarioIsRefused() {
custom("s3:GetObject")
.formParam("ResourceHandlingOption", "EC2-Classic")
.when().post("/").then().statusCode(400)
.body(CODE, equalTo("InvalidInput"));
}
@Test
void aSimulationNamingNoScenarioIsLeftAlone() {
assertEquals("allowed", decision(custom("s3:GetObject"), CUSTOM_DECISION));
}
/**
* Omitting the member is what is left alone, not emptying it. A member the request carries is
* a value rather than a member it left out, so a value of nothing but space names no published
* scenario and is refused like any other value that names none. The value carried empty never
* reaches the scenario at all: the member's declared minimum of one answers it, in the layer
* that runs ahead of the operation.
*/
@Test
void aScenarioValueOfNothingButSpaceNamesNoScenario() {
custom("s3:GetObject")
.formParam("ResourceHandlingOption", " ")
.when().post("/").then().statusCode(400)
.body(CODE, equalTo("InvalidInput"));
custom("s3:GetObject")
.formParam("ResourceHandlingOption", "")
.when().post("/").then().statusCode(400)
.body(CODE, equalTo("ValidationError"))
.body(MESSAGE, containsString("length greater than or equal to 1"));
}
/**
* Both members are read where the handed-in documents are read, ahead of the principal lookup,
* so a request that carries one of them broken and names nobody is answered for the input it
* supplied rather than for the entity it did not find.
*/
@Test
void anUnknownPrincipalDoesNotAnswerForAnInputTheOperationRefuses() {
String absent = "simulate-levels-absent-" + System.nanoTime();
// Nothing else wrong with the request: the lookup is what answers it.
simulatePrincipal(absent, "s3:GetObject")
.when().post("/").then().statusCode(404)
.body(CODE, equalTo("NoSuchEntity"));
simulatePrincipal(absent, "s3:GetObject")
.formParam(LEVELS + "1.ServiceControlPolicyInputList.member.1", "{not-a-policy")
.when().post("/").then().statusCode(400)
.body(CODE, equalTo("InvalidInput"));
simulatePrincipal(absent, "s3:GetObject")
.formParam("ResourceHandlingOption", "EC2-Classic")
.when().post("/").then().statusCode(400)
.body(CODE, equalTo("InvalidInput"));
}
private static RequestSpecification iam(String action) {
return given().header("Authorization", IAM_AUTH)
.formParam("Action", action)
.formParam("Version", "2010-05-08");
}
private static RequestSpecification custom(String actionName) {
return iam("SimulateCustomPolicy")
.formParam(INPUT, allow(actionName))
.formParam("ActionNames.member.1", actionName);
}
private static RequestSpecification simulatePrincipal(String userName, String actionName) {
return iam("SimulatePrincipalPolicy")
.formParam("PolicySourceArn", "arn:aws:iam::" + ACCOUNT + ":user/" + userName)
.formParam("ActionNames.member.1", actionName)
.formParam("ResourceArns.member.1", "*");
}
/** A user holding one inline policy that allows the action, so only the levels can refuse it. */
private String createUserAllowed(String actionName) {
String userName = "simulate-levels-" + System.nanoTime();
iam("CreateUser").formParam("UserName", userName).when().post("/").then().statusCode(200);
cleanup.register(() -> iam("DeleteUser").formParam("UserName", userName)
.when().post("/").then().statusCode(200));
iam("PutUserPolicy").formParam("UserName", userName).formParam("PolicyName", "allow-it")
.formParam("PolicyDocument", allow(actionName))
.when().post("/").then().statusCode(200);
cleanup.register(() -> iam("DeleteUserPolicy").formParam("UserName", userName)
.formParam("PolicyName", "allow-it").when().post("/").then().statusCode(200));
return userName;
}
private static String decision(RequestSpecification simulation, String path) {
List<String> decisions = decisions(simulation, path);
assertEquals(1, decisions.size(), "one action and one resource answer once");
return decisions.getFirst();
}
private static List<String> decisions(RequestSpecification simulation, String path) {
return simulation.when().post("/").then().statusCode(200)
.extract().xmlPath().getList(path);
}
private static String allow(String action) {
return document("Allow", action);
}
private static String deny(String action) {
return document("Deny", action);
}
private static String document(String effect, String action) {
return "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"" + effect + "\","
+ "\"Action\":\"" + action + "\",\"Resource\":\"*\"}]}";
}
}