fix(stepfunctions): decode escaped double-quoted literals (#9397)

The intrinsic argument splitter keeps an escaped double quote inside a double-quoted argument, but resolving the argument returned the backslash with it, so States.Array("a\"b,c", 'x') gave a first element of a\"b,c. A double-quoted argument now decodes \" and \\, and leaves any other backslash sequence as written, as a single-quoted one does with AWS's reserved escapes.
This commit is contained in:
Jimmy Liu Jia authored and GitHub committed 2026-11-24 19:06:33 -04:00
1 parent deb3865f32
commit a8d1208bc8
2 files changed
+18 -4

No files matched your search

@@ -6098,10 +6098,11 @@ public class AslExecutor {
}
if (arg.startsWith("'") && arg.endsWith("'")) {
return objectMapper.getNodeFactory().textNode(
unescapeIntrinsicLiteral(arg.substring(1, arg.length() - 1)));
unescapeIntrinsicLiteral(arg.substring(1, arg.length() - 1), '\''));
}
if (arg.startsWith("\"") && arg.endsWith("\"")) {
return objectMapper.getNodeFactory().textNode(arg.substring(1, arg.length() - 1));
return objectMapper.getNodeFactory().textNode(
unescapeIntrinsicLiteral(arg.substring(1, arg.length() - 1), '"'));
}
if ("true".equals(arg) || "false".equals(arg)) {
return objectMapper.getNodeFactory().booleanNode(Boolean.parseBoolean(arg));
@@ -6121,12 +6122,13 @@ public class AslExecutor {
}
}
private static String unescapeIntrinsicLiteral(String literal) {
private static String unescapeIntrinsicLiteral(String literal, char quote) {
StringBuilder value = new StringBuilder(literal.length());
for (int i = 0; i < literal.length(); i++) {
char c = literal.charAt(i);
if (c == '\\' && i + 1 < literal.length()
&& isIntrinsicEscapedCharacter(literal.charAt(i + 1))) {
&& ((quote == '\'' && isIntrinsicEscapedCharacter(literal.charAt(i + 1)))
|| (quote == '"' && (literal.charAt(i + 1) == '"' || literal.charAt(i + 1) == '\\')))) {
value.append(literal.charAt(++i));
} else {
value.append(c);