mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
feat(iam): dispatch UpdateRoleDescription, the description half of UpdateRole (#6029)
UpdateRoleDescription answered UnsupportedOperation 400, where the reference publishes it as a role operation of its own: "Use UpdateRole instead", and "modifies only the description of a role. This operation performs the same function as the Description parameter in the UpdateRole operation". So it is that path rather than a second one. updateRole now answers the role it wrote, updateRoleDescription is that call with the session duration left alone, and the roleNameType check comes along rather than being restated. The handler renders the Role the operation answers through the same roleXml fragment GetRole and CreateRole use, detailed, there being no documented exclusion to honour: the page's Response Elements section lists one Role object and says only that it "contains details about the modified role". Both members are required here, where UpdateRole's are optional, and that is the one place this does not simply delegate. Description is read off the request rather than through requireParam, which reads a blank value as an absent member: roleDescriptionType carries a maximum of 1000 and no minimum, so an empty description is a value that clears the description and only a missing one is a refusal. It is rendered the way the handler renders every other missing required member, "Value null at 'description' failed to satisfy constraint: Member must not be null". RoleName is answered for by validateRoleName, which reads a null as "Member must not be null" and a bad shape before any lookup, as the other 21 roleNameType operations have since #5391. A service-linked role takes a description edit, through either action. The user guide says so plainly, "You can edit the description of any role from the IAM console, API, or CLI", its own procedure for editing one is update-role with --description or the UpdateRoleDescription API, and it publishes a policy granting iam:UpdateRoleDescription over arn:aws:iam::*:role/aws-service-role/* for that. Both actions model UnmodifiableEntity, and a modelled error is not a list of what triggers it: the guard now stands on MaxSessionDuration, the only other member UpdateRole takes. So a description-only UpdateRole goes through where it was refused before, a request carrying both is refused whole with neither field written, and the other ten protected role actions are untouched. Authorization needed nothing. AWS gives the action the role resource type in the vendored authorization metadata, NAME_PARAMETERS already maps role to RoleName, and ResourceArnBuilder mints the ARN from the stored role, so the action is authorized against that role rather than against the wildcard. The routing table has carried the name since routing became generated from the model, so what changed there is only that it stops falling through to the unsupported-action arm. A role Description is held to the shape AWS publishes for it, and on every action that takes one rather than only the new one: at most 1000 characters of [\u0009\u000A\u000D -~¡-ÿ], which admits tab, newline and carriage return and no other control character. CreateRole, UpdateRole, UpdateRoleDescription and CreateServiceLinkedRole share one validateRoleDescription, run before the role is looked up or created, so a refused description never reaches a stored role. That is more than strictness. XmlBuilder escapes the five XML entities and passes everything else through, so a control character stored in a description would make the Role these actions and GetRole answer unparsable, which CreateRole could already produce before this. The rendering names neither the offending value nor the set, following the one IAM constraint message a recording covers, which also keeps the refused bytes out of the error body they would otherwise break. Reverting the three call sites fails the maximum, the control character and the sibling cases and nothing else. Sixteen tests. Ten over the wire in IamRoleDescriptionIntegrationTest: the description applied and answered, an empty description clearing it, the session duration and the trust policy untouched, the maximum taken and one character past it refused with the stored description intact, a control character refused while tab and newline are taken, CreateRole and UpdateRole answering the same way with nothing stored, an absent Description refused with the role left as it was, an absent RoleName, a name outside the shape refused ahead of the lookup, and an unknown role answering NoSuchEntity. Four on the service: the role that comes back, the shape across the create and update paths, the name read before the lookup, and a service-linked role taking the edit while refusing the duration. Two in IamServiceLinkedRoleIntegrationTest: that allowance over the wire, and CreateServiceLinkedRole answering ValidationError for a description outside the shape rather than its own InvalidInput. The protected-actions test pins UpdateRole on MaxSessionDuration, which is what AWS protects there. Docs carry the table row, the three ways this differs from UpdateRole, the description constraint and why it matters for the answer, the carve-out in the service-linked section, and the matrix row at 176, which check_service_matrix reads off the handler's own switch rather than taking the number on trust.
This commit is contained in:
1 parent
77c5d74a7d
commit
94b09ff46b
7 files changed
+472
-12
No files matched your search
+207
@@ -0,0 +1,207 @@
|
||||
package io.github.hectorvent.floci.services.iam;
|
||||
|
||||
import io.github.hectorvent.floci.testing.PartitionCleanup;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import io.restassured.response.ValidatableResponse;
|
||||
import io.restassured.specification.RequestSpecification;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.RegisterExtension;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static io.restassured.RestAssured.given;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
/**
|
||||
* {@code UpdateRoleDescription} over the wire.
|
||||
*
|
||||
* <p>The reference opens with "Use UpdateRole instead" and says the operation "performs the same
|
||||
* function as the Description parameter in the UpdateRole operation", so it is that path and
|
||||
* nothing else about the role moves. Its two members are both required, where UpdateRole's are
|
||||
* optional, and it answers the modified role, which UpdateRole does not answer at all. The errors
|
||||
* it models are {@code NoSuchEntity}, {@code UnmodifiableEntity} and {@code ServiceFailure}, and
|
||||
* the last of those is not a description's to answer: AWS documents the description of any role as
|
||||
* editable, a service-linked one included, which {@link IamServiceLinkedRoleIntegrationTest}
|
||||
* covers alongside the protection that does hold there.
|
||||
*/
|
||||
@QuarkusTest
|
||||
class IamRoleDescriptionIntegrationTest {
|
||||
|
||||
private static final String ACCOUNT = "000000000931";
|
||||
private static final String REGION = "us-east-1";
|
||||
private static final String TRUST_POLICY =
|
||||
"{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\","
|
||||
+ "\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},"
|
||||
+ "\"Action\":\"sts:AssumeRole\"}]}";
|
||||
private static final String RESULT = "UpdateRoleDescriptionResponse.UpdateRoleDescriptionResult";
|
||||
|
||||
@RegisterExtension
|
||||
final PartitionCleanup cleanup = new PartitionCleanup();
|
||||
|
||||
@Test
|
||||
void theNewDescriptionIsAppliedAndTheRoleComesBack() {
|
||||
String roleName = role("applied", "the description it was created with");
|
||||
|
||||
update(Map.of("RoleName", roleName, "Description", "the description it answers with"))
|
||||
.statusCode(200)
|
||||
.body(RESULT + ".Role.RoleName", equalTo(roleName))
|
||||
.body(RESULT + ".Role.Description", equalTo("the description it answers with"))
|
||||
.body(RESULT + ".Role.Arn", containsString(":role/" + roleName));
|
||||
|
||||
admin("GetRole", Map.of("RoleName", roleName)).statusCode(200)
|
||||
.body("GetRoleResponse.GetRoleResult.Role.Description",
|
||||
equalTo("the description it answers with"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void anEmptyDescriptionIsAValueAndClearsIt() {
|
||||
// roleDescriptionType declares a maximum and no minimum, so an empty string satisfies the
|
||||
// shape: the description it replaces is the one the role was created with.
|
||||
String roleName = role("cleared", "about to be cleared");
|
||||
|
||||
update(Map.of("RoleName", roleName, "Description", "")).statusCode(200)
|
||||
.body(RESULT + ".Role.Description", equalTo(""));
|
||||
|
||||
admin("GetRole", Map.of("RoleName", roleName)).statusCode(200)
|
||||
.body("GetRoleResponse.GetRoleResult.Role.Description", equalTo(""));
|
||||
}
|
||||
|
||||
@Test
|
||||
void onlyTheDescriptionMoves() {
|
||||
String roleName = role("only", "before");
|
||||
admin("UpdateRole", Map.of("RoleName", roleName, "MaxSessionDuration", "7200"))
|
||||
.statusCode(200);
|
||||
|
||||
update(Map.of("RoleName", roleName, "Description", "after")).statusCode(200)
|
||||
.body(RESULT + ".Role.MaxSessionDuration", equalTo("7200"));
|
||||
|
||||
admin("GetRole", Map.of("RoleName", roleName)).statusCode(200)
|
||||
.body("GetRoleResponse.GetRoleResult.Role.MaxSessionDuration", equalTo("7200"))
|
||||
.body("GetRoleResponse.GetRoleResult.Role.AssumeRolePolicyDocument",
|
||||
containsString("lambda.amazonaws.com"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void theMaximumIsTakenAndOneCharacterMoreIsNot() {
|
||||
String roleName = role("length", "before");
|
||||
String atMaximum = "d".repeat(1000);
|
||||
|
||||
update(Map.of("RoleName", roleName, "Description", atMaximum)).statusCode(200)
|
||||
.body(RESULT + ".Role.Description", equalTo(atMaximum));
|
||||
|
||||
update(Map.of("RoleName", roleName, "Description", "d".repeat(1001))).statusCode(400)
|
||||
.body("ErrorResponse.Error.Code", equalTo("ValidationError"))
|
||||
.body("ErrorResponse.Error.Message",
|
||||
equalTo("1 validation error detected: Value at 'description' failed to "
|
||||
+ "satisfy constraint: Member must have length less than or equal "
|
||||
+ "to 1000"));
|
||||
|
||||
admin("GetRole", Map.of("RoleName", roleName)).statusCode(200)
|
||||
.body("GetRoleResponse.GetRoleResult.Role.Description", equalTo(atMaximum));
|
||||
}
|
||||
|
||||
@Test
|
||||
void aCharacterOutsideTheSetIsRefusedSoTheAnswerStaysParsable() {
|
||||
// The set admits tab, newline and carriage return and no other control character, which is
|
||||
// what keeps the Role this action answers readable: XmlBuilder escapes the five entities
|
||||
// and passes everything else through, so a stored control character would make this
|
||||
// response, and GetRole's, unparsable.
|
||||
String roleName = role("control", "before");
|
||||
|
||||
update(Map.of("RoleName", roleName, "Description", "a" + (char) 1 + "b")).statusCode(400)
|
||||
.body("ErrorResponse.Error.Code", equalTo("ValidationError"))
|
||||
.body("ErrorResponse.Error.Message",
|
||||
containsString("Member must satisfy regular expression pattern"));
|
||||
|
||||
update(Map.of("RoleName", roleName, "Description", "two\nlines\tand a tab")).statusCode(200);
|
||||
|
||||
admin("GetRole", Map.of("RoleName", roleName)).statusCode(200)
|
||||
.body("GetRoleResponse.GetRoleResult.Role.Description",
|
||||
containsString("lines"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void theOtherOperationsThatTakeADescriptionAnswerTheSameWay() {
|
||||
// One validator, four call sites: the shape is shared, so a description CreateRole or
|
||||
// UpdateRole would have stored is refused there too, and the create stores nothing.
|
||||
admin("CreateRole", Map.of("RoleName", "role-description-sibling",
|
||||
"AssumeRolePolicyDocument", TRUST_POLICY, "Description", "d".repeat(1001)))
|
||||
.statusCode(400)
|
||||
.body("ErrorResponse.Error.Code", equalTo("ValidationError"))
|
||||
.body("ErrorResponse.Error.Message", containsString("at 'description'"));
|
||||
admin("GetRole", Map.of("RoleName", "role-description-sibling")).statusCode(404);
|
||||
|
||||
String roleName = role("sibling", "before");
|
||||
admin("UpdateRole", Map.of("RoleName", roleName, "Description", "a" + (char) 1 + "b"))
|
||||
.statusCode(400)
|
||||
.body("ErrorResponse.Error.Code", equalTo("ValidationError"));
|
||||
admin("GetRole", Map.of("RoleName", roleName)).statusCode(200)
|
||||
.body("GetRoleResponse.GetRoleResult.Role.Description", equalTo("before"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void anAbsentDescriptionIsAValidationError() {
|
||||
String roleName = role("absent-description", "kept");
|
||||
|
||||
update(Map.of("RoleName", roleName)).statusCode(400)
|
||||
.body("ErrorResponse.Error.Code", equalTo("ValidationError"))
|
||||
.body("ErrorResponse.Error.Message",
|
||||
equalTo("1 validation error detected: Value null at 'description' failed "
|
||||
+ "to satisfy constraint: Member must not be null"));
|
||||
|
||||
admin("GetRole", Map.of("RoleName", roleName)).statusCode(200)
|
||||
.body("GetRoleResponse.GetRoleResult.Role.Description", equalTo("kept"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void anAbsentRoleNameIsAValidationError() {
|
||||
update(Map.of("Description", "nobody to apply it to")).statusCode(400)
|
||||
.body("ErrorResponse.Error.Code", equalTo("ValidationError"))
|
||||
.body("ErrorResponse.Error.Message", containsString("at 'roleName'"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void theRoleNameIsReadBeforeTheRoleIsLookedUp() {
|
||||
// A colon is outside roleNameType, and the shape is what AWS answers for: the lookup would
|
||||
// otherwise decide, which is NoSuchEntity 404 for a role that cannot exist under that name.
|
||||
update(Map.of("RoleName", "role:with:colons", "Description", "whatever")).statusCode(400)
|
||||
.body("ErrorResponse.Error.Code", equalTo("ValidationError"))
|
||||
.body("ErrorResponse.Error.Message", containsString("at 'roleName'"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void anUnknownRoleIsNoSuchEntity() {
|
||||
update(Map.of("RoleName", "role-description-absent", "Description", "nothing to apply it to"))
|
||||
.statusCode(404)
|
||||
.body("ErrorResponse.Error.Code", equalTo("NoSuchEntity"));
|
||||
}
|
||||
|
||||
private String role(String label, String description) {
|
||||
String roleName = "role-description-" + label;
|
||||
admin("CreateRole", Map.of("RoleName", roleName, "AssumeRolePolicyDocument", TRUST_POLICY,
|
||||
"Description", description)).statusCode(200);
|
||||
cleanup.register(() -> admin("DeleteRole", Map.of("RoleName", roleName)).statusCode(200));
|
||||
return roleName;
|
||||
}
|
||||
|
||||
private static ValidatableResponse update(Map<String, String> params) {
|
||||
return iam("UpdateRoleDescription", params);
|
||||
}
|
||||
|
||||
private static ValidatableResponse admin(String action, Map<String, String> params) {
|
||||
return iam(action, params);
|
||||
}
|
||||
|
||||
private static ValidatableResponse iam(String action, Map<String, String> params) {
|
||||
RequestSpecification spec = given()
|
||||
.header("Authorization", "AWS4-HMAC-SHA256 Credential=" + ACCOUNT
|
||||
+ "/20261018/" + REGION + "/iam/aws4_request, SignedHeaders=host, "
|
||||
+ "Signature=abc")
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.formParam("Action", action)
|
||||
.formParam("Version", "2010-05-08");
|
||||
params.forEach(spec::formParam);
|
||||
return spec.when().post("/").then();
|
||||
}
|
||||
}
|
||||
+85
-1
@@ -564,7 +564,9 @@ class IamServiceLinkedRoleIntegrationTest {
|
||||
String roleName = "AWSServiceRoleForProtectprobe";
|
||||
String readOnly = "arn:aws:iam::aws:policy/ReadOnlyAccess";
|
||||
|
||||
refusedAsUnmodifiable("UpdateRole", "RoleName", roleName, "Description", "hijacked");
|
||||
// UpdateRole is protected for its duration, not for its description, which AWS documents
|
||||
// as editable on any role: aDescriptionEditIsTakenAndTheDurationIsStillRefused has that.
|
||||
refusedAsUnmodifiable("UpdateRole", "RoleName", roleName, "MaxSessionDuration", "7200");
|
||||
refusedAsUnmodifiable("UpdateAssumeRolePolicy", "RoleName", roleName,
|
||||
"PolicyDocument", "{\"Version\":\"2012-10-17\",\"Statement\":[]}");
|
||||
refusedAsUnmodifiable("DetachRolePolicy", "RoleName", roleName, "PolicyArn", readOnly);
|
||||
@@ -761,6 +763,88 @@ class IamServiceLinkedRoleIntegrationTest {
|
||||
+ "account, please try a different suffix."));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(32)
|
||||
void aDescriptionOutsideItsShapeIsRefusedBeforeTheRoleIsCreated() {
|
||||
// roleDescriptionType is the same shape CreateRole and UpdateRole take, so this answers
|
||||
// ValidationError rather than this action's own InvalidInput, and stores nothing.
|
||||
given()
|
||||
.formParam("Action", "CreateServiceLinkedRole")
|
||||
.formParam("AWSServiceName", "descprobe.amazonaws.com")
|
||||
.formParam("Description", "d".repeat(1001))
|
||||
.header("Authorization", AUTH_HEADER)
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(400)
|
||||
.body("ErrorResponse.Error.Code", equalTo("ValidationError"))
|
||||
.body("ErrorResponse.Error.Message", containsString("at 'description'"));
|
||||
|
||||
given()
|
||||
.formParam("Action", "GetRole")
|
||||
.formParam("RoleName", "AWSServiceRoleForDescprobe")
|
||||
.header("Authorization", AUTH_HEADER)
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(404);
|
||||
}
|
||||
|
||||
/**
|
||||
* The description is the one thing AWS documents as editable on a service-linked role: "You
|
||||
* can edit the description of any role from the IAM console, API, or CLI", and the user guide
|
||||
* reaches it with {@code update-role --description} or {@code UpdateRoleDescription}, for
|
||||
* which it publishes a policy over {@code arn:aws:iam::*:role/aws-service-role/*}. The guard
|
||||
* stands on the duration instead, and a request for both is refused whole.
|
||||
*/
|
||||
@Test
|
||||
@Order(33)
|
||||
void aDescriptionEditIsTakenAndTheDurationIsStillRefused() {
|
||||
createServiceLinkedRole("descriptionprobe.amazonaws.com");
|
||||
String roleName = "AWSServiceRoleForDescriptionprobe";
|
||||
|
||||
given()
|
||||
.formParam("Action", "UpdateRoleDescription")
|
||||
.formParam("RoleName", roleName)
|
||||
.formParam("Description", "edited through UpdateRoleDescription")
|
||||
.header("Authorization", AUTH_HEADER)
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("UpdateRoleDescriptionResponse.UpdateRoleDescriptionResult.Role.Description",
|
||||
equalTo("edited through UpdateRoleDescription"))
|
||||
.body("UpdateRoleDescriptionResponse.UpdateRoleDescriptionResult.Role.Path",
|
||||
equalTo(SERVICE_LINKED_ROLE_PATH + "descriptionprobe.amazonaws.com/"));
|
||||
|
||||
// The action the user guide's own procedure names, with nothing else in the request.
|
||||
given()
|
||||
.formParam("Action", "UpdateRole")
|
||||
.formParam("RoleName", roleName)
|
||||
.formParam("Description", "edited through UpdateRole")
|
||||
.header("Authorization", AUTH_HEADER)
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200);
|
||||
|
||||
refusedAsUnmodifiable("UpdateRole", "RoleName", roleName,
|
||||
"Description", "hijacked", "MaxSessionDuration", "7200");
|
||||
|
||||
// The refused request carried a description too, and left the stored one alone.
|
||||
given()
|
||||
.formParam("Action", "GetRole")
|
||||
.formParam("RoleName", roleName)
|
||||
.header("Authorization", AUTH_HEADER)
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("GetRoleResponse.GetRoleResult.Role.Description",
|
||||
equalTo("edited through UpdateRole"))
|
||||
.body("GetRoleResponse.GetRoleResult.Role.MaxSessionDuration", equalTo("3600"));
|
||||
}
|
||||
|
||||
/**
|
||||
* A table name plus a suffix can breach the 64-character RoleName limit even though the name
|
||||
* alone fits. Two entries are close enough for that to matter, and neither has a recording
|
||||
|
||||
@@ -92,6 +92,76 @@ class IamServiceTest {
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
void updateRoleDescriptionAnswersTheRoleAndMovesNothingElse() {
|
||||
// "This operation performs the same function as the Description parameter in the UpdateRole
|
||||
// operation", and UpdateRole answers no shape at all, so the role comes back from here.
|
||||
iamService.createRole("R", "/", "{}", "before", 7200, null);
|
||||
|
||||
IamRole updated = iamService.updateRoleDescription("R", "after");
|
||||
|
||||
assertEquals("after", updated.getDescription());
|
||||
assertEquals(7200, updated.getMaxSessionDuration());
|
||||
assertEquals("{}", updated.getAssumeRolePolicyDocument());
|
||||
assertEquals("after", iamService.getRole("R").getDescription());
|
||||
}
|
||||
|
||||
@Test
|
||||
void aRoleDescriptionIsHeldToItsShapeWhereverItIsTaken() {
|
||||
iamService.createRole("R", "/", "{}", "fine", 3600, null);
|
||||
|
||||
AwsException tooLong = assertThrows(AwsException.class,
|
||||
() -> iamService.updateRoleDescription("R", "d".repeat(1001)));
|
||||
assertEquals("ValidationError", tooLong.getErrorCode());
|
||||
assertEquals("1 validation error detected: Value at 'description' failed to satisfy "
|
||||
+ "constraint: Member must have length less than or equal to 1000",
|
||||
tooLong.getMessage());
|
||||
|
||||
AwsException outsideTheSet = assertThrows(AwsException.class,
|
||||
() -> iamService.updateRoleDescription("R", "a" + (char) 1 + "b"));
|
||||
assertEquals("ValidationError", outsideTheSet.getErrorCode());
|
||||
|
||||
// Neither refusal wrote, and the create path answers the same way without storing a role.
|
||||
assertEquals("fine", iamService.getRole("R").getDescription());
|
||||
assertEquals("ValidationError", assertThrows(AwsException.class,
|
||||
() -> iamService.createRole("R2", "/", "{}", "d".repeat(1001), 3600, null))
|
||||
.getErrorCode());
|
||||
assertThrows(AwsException.class, () -> iamService.getRole("R2"));
|
||||
|
||||
// Tab, newline and carriage return are inside the set AWS publishes.
|
||||
iamService.updateRoleDescription("R", "one\ntwo\tthree\r");
|
||||
assertEquals("one\ntwo\tthree\r", iamService.getRole("R").getDescription());
|
||||
}
|
||||
|
||||
@Test
|
||||
void updateRoleDescriptionReadsTheRoleNameBeforeTheLookup() {
|
||||
AwsException error = assertThrows(AwsException.class,
|
||||
() -> iamService.updateRoleDescription("role:with:colons", "whatever"));
|
||||
|
||||
assertEquals("ValidationError", error.getErrorCode());
|
||||
assertEquals(400, error.getHttpStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
void aServiceLinkedRoleTakesADescriptionEditAndRefusesADuration() {
|
||||
// "You can edit the description of any role from the IAM console, API, or CLI", by either
|
||||
// action, so the protection AWS publishes on both stands on the duration instead.
|
||||
String roleName = iamService.createServiceLinkedRole("es.amazonaws.com", null, "created with")
|
||||
.getRoleName();
|
||||
|
||||
assertEquals("edited", iamService.updateRoleDescription(roleName, "edited").getDescription());
|
||||
assertEquals("edited again", iamService.updateRole(roleName, "edited again", 0).getDescription());
|
||||
|
||||
AwsException refused = assertThrows(AwsException.class,
|
||||
() -> iamService.updateRole(roleName, "hijacked", 7200));
|
||||
assertEquals("UnmodifiableEntity", refused.getErrorCode());
|
||||
assertEquals(400, refused.getHttpStatus());
|
||||
|
||||
// Refused whole: the description that came with the duration was not written either.
|
||||
assertEquals("edited again", iamService.getRole(roleName).getDescription());
|
||||
assertEquals(3600, iamService.getRole(roleName).getMaxSessionDuration());
|
||||
}
|
||||
|
||||
@Test
|
||||
void roleInlinePolicyQuotaIgnoresWhitespaceAndPreservesRejectedReplacement() {
|
||||
iamService.createRole("R", "/", "{}", null, 0, null);
|
||||
|
||||
Reference in new issue
Block a user