fix(sts): read a model pattern's wide escape and mint the token size asked for (#7105)

`arnType`'s pattern ends in a five-digit escape, the U+10000 to U+10FFFF
range, where Java reads a backslash-u escape as exactly four digits and takes
the rest as literals. Compiled as the model writes it, that range became the
character U+1000, a literal zero, a hyphen, U+10FF and two literal Fs, so the
character class gained a range from `0` to U+10FF: it refused every
supplementary character the model admits and admitted the C1 controls it
excludes, U+0081 among them. Every member the shape resolves to was answered
the wrong way round: `RoleArn` on the three assume-role operations,
`PrincipalArn` on the SAML one, each entry of `PolicyArns` on those three and
on `GetFederationToken`, `TaskPolicyArn` on `AssumeRoot` and the
provided-context ARN on `AssumeRole`.

Each wide escape is read as the code point it spells now, which is what the
model means by it, written in Java's own form by one object that both
constraint checks compile their patterns through. `arnType` is the only shape
in any of the 28 vendored files carrying such an escape, so nothing else
moves, and a run of five or six digits naming no code point is left as the
model wrote it.

`MinimumSessionTokenSize` is published on six operations and was materialized
on one. `AssumeRoot` minted a token of the size asked for while the other five
minted 200 characters whatever the request sent, so the member was validated
and then ignored. All six mint their token through one writer now, which keeps
the floor at the 200 this emulator mints when a request asks for less, since
that is what a minimum asks for. `GetDelegatedAccessToken` models no such
member and keeps the 200 on its own.

`violation(String)` goes with them: wave 4 took out the three hand-written
checks that called it, and nothing has called it since.

`docs/services/sts.md` carries both readings.
This commit is contained in:
Priamo Germosen authored and GitHub committed 2026-11-01 10:09:51 -06:00
1 parent 49edfcbd5f
commit d39f06e733
10 files changed
+312 -30

No files matched your search

+19 -3
View File
@@ -46,12 +46,26 @@ names one, `audience.1.member` and `tags.1.member.key`, under the index the requ
What that adds is on `GetSessionToken`, whose `SerialNumber`, `TokenCode` and
`MinimumSessionTokenSize` were accepted and ignored: each is now held to its shape, so a serial
number under 9 characters, a token code that is not six digits or a token size past 4096 answers
400 where it used to answer credentials. The size is still only validated: the session token stays
the length this emulator mints whatever the request asks for, which is a gap rather than a reading.
400 where it used to answer credentials. The size asked for is the size issued, on every operation
that models the member rather than on `AssumeRoot` alone: each mints its token through one writer,
which holds it to the 200 characters this emulator mints when a request asks for less, since that
is what a minimum asks for.
`GetAccessKeyInfo` and `GetWebIdentityToken` answer the messages they already answered, from the
same bounds and the same patterns, and what moves there is that an access key ID breaking both its
length and its pattern is answered for both where the check it replaces stopped at the first.
A pattern is read in the dialect the model writes it in rather than in Java's, which is one
thing on one shape. `arnType`'s pattern ends in a five-digit escape, the U+10000 to U+10FFFF range,
where Java reads a backslash-u escape as exactly four digits and takes the rest as literals:
compiled as written, that range became the character U+1000, a literal zero, a hyphen, U+10FF and
two literal Fs, so the class gained a range from `0` to U+10FF. It refused every supplementary
character the model admits and admitted the C1 controls it excludes, U+0081 among them, on every
member the shape resolves to: `RoleArn` on the three assume-role operations, `PrincipalArn` on the
SAML one, each entry of `PolicyArns` on those three and on `GetFederationToken`, `TaskPolicyArn` on
`AssumeRoot` and the provided-context ARN on `AssumeRole`. Each such escape is read as the code
point it spells now, for every vendored pattern on both protocols, and `arnType` is the only shape
in any vendored file that carries one.
The model says nothing about what counts as a number, so a `DurationSeconds` or a
`MinimumSessionTokenSize` that is no number at all stays `InvalidParameterValue`, answered before
the constraints, while a digit string is held to the range whatever width it overflows: a duration
@@ -117,7 +131,9 @@ Four things are deviations rather than readings, since the operation models only
region cannot tell the two apart, so there is nothing to refuse there.
- `SessionTokenSize` is answered as the length of the token issued, and `MinimumSessionTokenSize`
pads it to at least the size asked for, held to the 0 to 4096 the model declares, "The value must
not exceed 4,096 bytes", since the size asked for is the size materialized. Out of that range is
not exceed 4,096 bytes", since the size asked for is the size materialized. This was the first
operation to materialize it and is no longer the only one, the five others that model the member
reading it through the same writer. Out of that range is
a `ValidationError` and a value that is no integer an `InvalidParameterValue`, the pair
`DurationSeconds` already answers. `SessionTokenUtilization` is not answered: the model documents
neither member, so only the one with an obvious meaning is filled.
@@ -81,7 +81,7 @@ public final class QueryConstraintCheck {
this.messages = messages;
for (Map.Entry<String, JsonNode> shape : shapes.properties()) {
if (shape.getValue().has("pattern")) {
patterns.put(shape.getKey(), Pattern.compile(shape.getValue().get("pattern").asText()));
patterns.put(shape.getKey(), VendoredPatterns.compile(shape.getValue().get("pattern").asText()));
}
}
for (Map.Entry<String, JsonNode> operation : operations.properties()) {
@@ -381,7 +381,9 @@ public final class QueryConstraintCheck {
}
Pattern pattern = patterns.get(shapeName);
if (pattern != null && !pattern.matcher(value).matches()) {
violations.add(messages.pattern(path, value, pattern.pattern()));
// Quoted as the model declares it, which is what AWS answers and what the service docs
// carry, rather than as it was compiled: a wide escape is rewritten to match on.
violations.add(messages.pattern(path, value, shape.path("pattern").asText()));
}
violations.addAll(single(enumViolation(shape, value, path)));
return violations;
@@ -51,7 +51,7 @@ public final class RequestConstraintCheck {
this.messages = messages;
for (Map.Entry<String, JsonNode> shape : model.path("shapes").properties()) {
if (shape.getValue().has("pattern")) {
patterns.put(shape.getKey(), Pattern.compile(shape.getValue().get("pattern").asText()));
patterns.put(shape.getKey(), VendoredPatterns.compile(shape.getValue().get("pattern").asText()));
}
}
}
@@ -0,0 +1,66 @@
package io.github.hectorvent.floci.core.common;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Compiles a pattern a vendored AWS model declares, in the dialect the model writes it in rather
* than in Java's.
*
* <p>One thing differs between the two. A model writes a code point above U+FFFF as a backslash-u
* escape of five or six hex digits, the U+10000 to U+10FFFF range on STS's {@code arnType} among
* them, where Java reads exactly four digits and takes the rest as literals. Compiled as written,
* that range becomes the single character U+1000, a literal zero, a hyphen, the character U+10FF
* and two literal Fs, so the character class around it gains a range from {@code 0} to U+10FF: it
* admits characters the model excludes, U+0081 among them, and refuses every supplementary
* character the model admits. Each wide escape is read here as the code point it spells, which is
* what the model means by it, and written in Java's own {@code x} form.
*
* <p>Five or six hex digits naming no code point are left as the model wrote them, as is an escape
* of four, which is Java's own: nothing vendored here carries either case, and compiling what the
* model wrote answers what it has always answered.
*/
public final class VendoredPatterns {
/** A backslash-u escape wider than the four digits Java reads, the longest run first. */
private static final Pattern WIDE_ESCAPE = Pattern.compile("\\\\u([0-9a-fA-F]{5,6})");
/** The narrowest run this reads: four digits are Java's own escape. */
private static final int NARROWEST_WIDE_ESCAPE = 5;
private VendoredPatterns() {
}
/** {@code pattern} compiled as the model means it. */
public static Pattern compile(String pattern) {
return Pattern.compile(rewrite(pattern));
}
/**
* {@code pattern} with every wide escape written in Java's form. The digits are read longest
* first, so six of them name the top of Unicode rather than five of them and a stray F, and a
* run naming no code point at any width is handed back as it was written.
*/
static String rewrite(String pattern) {
Matcher escape = WIDE_ESCAPE.matcher(pattern);
StringBuilder rewritten = new StringBuilder();
int from = 0;
while (escape.find()) {
rewritten.append(pattern, from, escape.start()).append(asCodePoint(escape.group()));
from = escape.end();
}
return from == 0 ? pattern : rewritten.append(pattern, from, pattern.length()).toString();
}
/** The escape as a code point, or as the model wrote it where no run of its digits names one. */
private static String asCodePoint(String escape) {
String digits = escape.substring(2);
for (int width = digits.length(); width >= NARROWEST_WIDE_ESCAPE; width--) {
int codePoint = Integer.parseInt(digits.substring(0, width), 16);
if (codePoint >= Character.MIN_SUPPLEMENTARY_CODE_POINT && codePoint <= Character.MAX_CODE_POINT) {
return "\\x{" + digits.substring(0, width) + "}" + digits.substring(width);
}
}
return escape;
}
}
@@ -60,6 +60,8 @@ public class StsQueryHandler {
private static final int MAX_ROOT_SESSION_SECONDS = 900;
/** "If not specified, the default duration is 300 seconds (5 minutes)." */
private static final int DEFAULT_TOKEN_SECONDS = 300;
/** The session token this emulator has always minted, and the floor a request cannot go under. */
private static final int SESSION_TOKEN_LENGTH = 200;
private static final String STS_AUDIENCE = "sts.amazonaws.com"; // partition-literal: web-identity audience; no source outside the commercial partition (P9)
private final IamService iamService;
@@ -164,7 +166,7 @@ public class StsQueryHandler {
String accessKeyId = "ASIA" + randomId(16);
String secretKey = randomSecret(40);
String sessionToken = randomSecret(200);
String sessionToken = sessionToken(params);
Instant expiration = clock.instant().plusSeconds(durationSeconds);
String roleName = roleArn != null && roleArn.contains("/")
@@ -343,7 +345,7 @@ public class StsQueryHandler {
int durationSeconds = longTermTokenDuration(params);
String accessKeyId = "ASIA" + randomId(16);
String secretKey = randomSecret(40);
String sessionToken = randomSecret(200);
String sessionToken = sessionToken(params);
Instant expiration = clock.instant().plusSeconds(durationSeconds);
String result = credentialsXml(accessKeyId, secretKey, sessionToken, expiration);
@@ -396,7 +398,7 @@ public class StsQueryHandler {
String accessKeyId = "ASIA" + randomId(16);
String secretKey = randomSecret(40);
String sessionToken = randomSecret(200);
String sessionToken = sessionToken(params);
Instant expiration = clock.instant().plusSeconds(durationSeconds);
String sessionRoleArn = canonicalRoleArn(role, accountId, roleName);
@@ -602,7 +604,7 @@ public class StsQueryHandler {
Instant expiration = verified.expiration().isBefore(requestedExpiration) ? verified.expiration() : requestedExpiration;
String accessKeyId = "ASIA" + randomId(16);
String secretKey = randomSecret(40);
String sessionToken = randomSecret(200);
String sessionToken = sessionToken(params);
String sessionRoleArn = canonicalRoleArn(role, accountId, roleName);
String assumedRoleArn = assumedRoleArn(sessionRoleArn, accountId, roleName, sessionName);
String assumedRoleId = "AROA" + randomId(16) + ":" + sessionName;
@@ -650,7 +652,7 @@ public class StsQueryHandler {
String accessKeyId = "ASIA" + randomId(16);
String secretKey = randomSecret(40);
String sessionToken = randomSecret(200);
String sessionToken = sessionToken(params);
Instant expiration = clock.instant().plusSeconds(durationSeconds);
String accountId = regionResolver.getAccountId();
String federatedUserId = accountId + ":" + name;
@@ -701,7 +703,8 @@ public class StsQueryHandler {
String accessKeyId = "ASIA" + randomId(16);
String secretKey = randomSecret(40);
String sessionToken = randomSecret(200);
// The operation models no size to ask for, so the token is the length this mints.
String sessionToken = randomSecret(SESSION_TOKEN_LENGTH);
// The session acts in the customer's account as the identity that approved the request,
// bounded by the rendered permission policy wherever the request carries one and by that
// identity's own permissions either way. The account is the owner's: a request is visible
@@ -788,8 +791,7 @@ public class StsQueryHandler {
Instant expiration = clock.instant().plusSeconds(durationSeconds);
String accessKeyId = "ASIA" + randomId(16);
String secretKey = randomSecret(40);
String sessionToken = randomSecret(Math.max(200,
getIntParam(params, "MinimumSessionTokenSize", 0)));
String sessionToken = sessionToken(params);
// The session is the member account's root user, bounded by the task policy. The origin is
// the member account too: the privileged task is performed there, not where it was asked for.
iamService.registerSession(accessKeyId, secretKey, sessionToken,
@@ -921,20 +923,6 @@ public class StsQueryHandler {
return null;
}
/**
* One violation as this handler answers it, or null where {@code violation} is null. The
* wording comes from {@link SmithyValidationErrors} rather than from a sentence written here,
* so a member held to its shape by a check of this file's own reads the same as one the model
* holds.
*/
private static Response violation(String violation) {
if (violation == null) {
return null;
}
return AwsQueryResponse.error("ValidationError",
SmithyValidationErrors.message(List.of(violation)), AwsNamespaces.STS, 400);
}
/**
* The refusal for a member the protocol cannot read as the number its shape declares, which is
* {@code InvalidParameterValue} rather than a constraint violation: no range of the model's is
@@ -1132,6 +1120,18 @@ public class StsQueryHandler {
return sb.toString();
}
/**
* The session token for a request: the length its {@code MinimumSessionTokenSize} asks for,
* never under the 200 characters this emulator mints by default. Every operation that models
* the member answers it from here, so the floor is written once, and the model holds the value
* to the 0 to 4096 it declares ahead of this. A request asking for less than the floor is
* answered with the floor, which is what "minimum" asks for.
*/
private String sessionToken(MultivaluedMap<String, String> params) {
return randomSecret(Math.max(SESSION_TOKEN_LENGTH,
getIntParam(params, "MinimumSessionTokenSize", 0)));
}
private String randomSecret(int length) {
StringBuilder sb = new StringBuilder(length);
for (int i = 0; i < length; i++) {
@@ -276,6 +276,35 @@ class QueryConstraintCheckTest {
QueryConstraintCheck.of(holdsItself).violations("Put", params("Node.Name", "")));
}
/**
* A pattern is compiled through {@link VendoredPatterns}, so a model that writes a code point
* above U+FFFF as a five-digit escape is read as the code point it spells: a supplementary
* character the class admits is not refused, and a C1 control it excludes still is. Compiled
* as the model writes it, Java would answer both the other way round.
*/
@Test
void aPatternCarryingAWideEscapeIsCompiledAsTheModelMeansIt() throws Exception {
QueryConstraintCheck check = QueryConstraintCheck.of(MAPPER.readTree("""
{
"operations": {"Put": "PutRequest"},
"shapes": {
"PutRequest": {"type": "structure", "members": {"Name": "wideType"}},
"wideType": {"type": "string",
"pattern": "[\\\\u0020-\\\\u007E\\\\u10000-\\\\u10FFFF]+"}
}
}
"""));
assertEquals(List.of(), check.violations("Put",
params("Name", "ok" + Character.toString(0x1F600))));
assertEquals(List.of("Value 'ok" + Character.toString(0x81) + "' at 'name' failed to satisfy"
+ " constraint: Member must satisfy regular expression pattern:"
+ " [\\u0020-\\u007E\\u10000-\\u10FFFF]+"),
check.violations("Put", params("Name", "ok" + Character.toString(0x81))),
"the message quotes the pattern as the model wrote it");
}
/**
* A list's members are held to the element's own constraints, each named under the index the
* request spelled rather than the position it sits at, which is what #6478 settled for a member
@@ -0,0 +1,70 @@
package io.github.hectorvent.floci.core.common;
import org.junit.jupiter.api.Test;
import java.util.regex.Pattern;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;
class VendoredPatternsTest {
/** STS's {@code arnType}, as botocore writes it and as the vendored file carries it. */
private static final String ARN_PATTERN = "[\\u0009\\u000A\\u000D\\u0020-\\u007E\\u0085"
+ "\\u00A0-\\uD7FF\\uE000-\\uFFFD\\u10000-\\u10FFFF]+";
private static final String ARN = "arn:aws:iam::000000000000:role/r";
@Test
void aWideEscapeIsReadAsTheCodePointItSpells() {
assertEquals("[\\x{10000}-\\x{10FFFF}]", VendoredPatterns.rewrite("[\\u10000-\\u10FFFF]"));
assertEquals("[\\x{10000}]", VendoredPatterns.rewrite("[\\u10000]"),
"five digits name a code point of their own");
}
@Test
void anEscapeJavaReadsItselfIsHandedBackUntouched() {
String narrow = "[\\u0009\\u0020-\\u007E]+";
assertSame(narrow, VendoredPatterns.rewrite(narrow));
assertSame("[a-z]+", VendoredPatterns.rewrite("[a-z]+"));
}
/**
* Five digits under U+10000 are four digits and a literal, which is how Java reads them and
* what the model must mean by them, so the escape is handed back as it was written. The string
* is rebuilt rather than returned as it came, the escape having matched before its digits were
* read, so this is equality rather than identity.
*/
@Test
void digitsNamingNoCodePointAreLeftAsTheModelWroteThem() {
String narrow = "[\\u00412]";
assertEquals(narrow, VendoredPatterns.rewrite(narrow));
}
/**
* The class the model declares admits every supplementary character and excludes the C1
* controls other than U+0085. Compiled as the model wrote it, Java reads the five-digit escape
* as four digits and a literal zero, which turns the tail of the class into a range from
* {@code 0} to U+10FF and flips both answers: that is the reading this object exists to fix,
* so both are pinned here.
*/
@Test
void theCompiledClassAdmitsTheCodePointsTheModelAdmits() {
String supplementary = ARN + Character.toString(0x1F600);
String c1Control = ARN + Character.toString(0x81);
Pattern asTheModelMeansIt = VendoredPatterns.compile(ARN_PATTERN);
assertTrue(asTheModelMeansIt.matcher(supplementary).matches());
assertFalse(asTheModelMeansIt.matcher(c1Control).matches());
Pattern asWritten = Pattern.compile(ARN_PATTERN);
assertFalse(asWritten.matcher(supplementary).matches(),
"compiled as written, the class refuses what the model admits");
assertTrue(asWritten.matcher(c1Control).matches(),
"and admits what the model excludes");
}
}
@@ -6,6 +6,7 @@ import io.github.hectorvent.floci.testing.SamlMetadata;
import io.quarkus.test.common.http.TestHTTPResource;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.ValidatableResponse;
import io.restassured.specification.RequestSpecification;
import jakarta.inject.Inject;
import org.bouncycastle.asn1.x500.X500Name;
import org.bouncycastle.cert.X509CertificateHolder;
@@ -437,6 +438,25 @@ class AssumeRoleWithSamlValidationIntegrationTest {
}
}
/**
* The session token is as long as the request's {@code MinimumSessionTokenSize} asks for, which
* this operation models and now answers with the five others that do. It is pinned here rather
* than beside them because a token is minted only once the assertion verifies, which wants the
* signing fixture this class already has.
*/
@Test
void theSessionTokenIsAsLongAsTheRequestAsksFor() {
String role = createRole(true);
String assertion = assertion(role, PROVIDER, Instant.now().plusSeconds(300), AUDIENCE, ISSUER, true);
String token = assumeRequest(role, assertion, PROVIDER)
.formParam("MinimumSessionTokenSize", "1024")
.when().post("/").then().statusCode(200)
.extract().path("AssumeRoleWithSAMLResponse.AssumeRoleWithSAMLResult.Credentials.SessionToken");
assertEquals(1024, token.length());
}
private static void assertSignatureInvalid(Function<XMLSignatureFactory, List<Transform>> transforms) {
String role = createRole(true);
assume(role, assertion(role, PROVIDER, Instant.now().plusSeconds(300), AUDIENCE, ISSUER, true, false, transforms),
@@ -459,13 +479,17 @@ class AssumeRoleWithSamlValidationIntegrationTest {
}
private static ValidatableResponse assume(String role, String assertion, String provider) {
return assumeRequest(role, assertion, provider).when().post("/").then();
}
/** The request every case here posts, for a case that carries a member of its own on top. */
private static RequestSpecification assumeRequest(String role, String assertion, String provider) {
return given().contentType("application/x-www-form-urlencoded")
.formParam("Action", "AssumeRoleWithSAML")
.formParam("RoleArn", role)
.formParam("PrincipalArn", provider)
.formParam("SAMLAssertion", assertion)
.header("Authorization", auth("sts"))
.when().post("/").then();
.header("Authorization", auth("sts"));
}
private static String createRole(boolean allow) {
@@ -28,6 +28,7 @@ import java.time.Clock;
import java.time.Instant;
import java.time.ZoneOffset;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -342,6 +343,55 @@ class StsQueryHandlerTest {
assertEquals(200, extract(SESSION_TOKEN, body).length());
}
/**
* {@code MinimumSessionTokenSize} is the size materialized rather than a value only validated:
* every operation that models it mints its token through one writer, so asking for 1024
* characters gets 1024 on each of them. A request asking for less than the 200 this emulator
* mints gets the 200, which is what a minimum asks for. Each operation is asked on its own
* rather than the writer being trusted through one of them, so an operation that stopped
* reading the member is caught here. The two the model carries that this harness cannot reach
* are pinned where their requests can be built: {@code StsAssumeRootIntegrationTest} on
* {@code AssumeRoot} and {@code AssumeRoleWithSamlValidationIntegrationTest} on
* {@code AssumeRoleWithSAML}, which needs a signed assertion before a token is minted at all.
*/
@ParameterizedTest
@ValueSource(strings = {"GetSessionToken", "AssumeRole", "AssumeRoleWithWebIdentity",
"GetFederationToken"})
void theSessionTokenIsAsLongAsTheRequestAsksFor(String action) {
MultivaluedMap<String, String> asked = sessionRequest(action);
asked.putSingle("MinimumSessionTokenSize", "1024");
Response response = newHandler().handle(action, asked);
assertEquals(200, response.getStatus(), (String) response.getEntity());
assertEquals(1024, extract(SESSION_TOKEN, (String) response.getEntity()).length());
MultivaluedMap<String, String> under = sessionRequest(action);
under.putSingle("MinimumSessionTokenSize", "10");
String shorter = (String) newHandler().handle(action, under).getEntity();
assertEquals(200, extract(SESSION_TOKEN, shorter).length());
}
/** The least a request needs to reach issuance on an operation that models a token size. */
private static MultivaluedMap<String, String> sessionRequest(String action) {
Map<String, String> members = switch (action) {
case "AssumeRole" -> Map.of(
"RoleArn", "arn:aws:iam::000000000000:role/TestRole",
"RoleSessionName", "test-session");
case "AssumeRoleWithWebIdentity" -> Map.of(
"RoleArn", "arn:aws:iam::000000000000:role/TestRole",
"RoleSessionName", "test-session",
"WebIdentityToken", "opaque-token");
case "GetFederationToken" -> Map.of("Name", "test-user");
default -> Map.of();
};
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
members.forEach(params::putSingle);
return params;
}
@Test
void getSessionTokensAreUniqueAcrossCalls() {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
@@ -338,4 +338,29 @@ class StsRequestConstraintsIntegrationTest {
+ " Member must satisfy regular expression pattern:"
+ " [\\p{L}\\p{Z}\\p{N}_.:/=+\\-@]+"));
}
/**
* {@code arnType}'s pattern ends in a five-digit escape, the U+10000 to U+10FFFF range, which
* Java reads as four digits and a literal zero: compiled as written it refuses every
* supplementary character the model admits and admits the C1 controls it excludes. Read as the
* code points it spells, a {@code RoleArn} carrying an emoji is past the constraints and
* answered by the role lookup, and one carrying U+0081 is refused for the pattern.
*/
@Test
void theArnPatternAdmitsTheCodePointsTheModelAdmits() {
sts("AssumeRole")
.formParam("RoleArn", "arn:aws:iam::000000000000:role/r" + Character.toString(0x1F600))
.formParam("RoleSessionName", "session")
.when().post("/").then().statusCode(403)
.body(CODE, equalTo("AccessDenied"))
.body(MESSAGE, not(containsString("regular expression pattern")));
sts("AssumeRole")
.formParam("RoleArn", "arn:aws:iam::000000000000:role/r" + Character.toString(0x81))
.formParam("RoleSessionName", "session")
.when().post("/").then().statusCode(400)
.body(CODE, equalTo("ValidationError"))
.body(MESSAGE, containsString("failed to satisfy constraint: Member must satisfy"
+ " regular expression pattern:"));
}
}