mirror of
https://github.com/floci-io/floci.git
synced 2026-12-03 10:17:48 -05:00
fix(lambdaweb): accept a policy Resource in any partition, region or account (#6863)
This commit is contained in:
1 parent
096d336fab
commit
fc1388da6f
4 files changed
+49
-2
No files matched your search
@@ -1524,13 +1524,21 @@ public class LambdaWebService implements Resettable {
|
||||
throw policySyntax();
|
||||
}
|
||||
}
|
||||
String function = AwsArnUtils.parse(functionArn).resource();
|
||||
for (String resource : policyValues(statement.get("Resource"))) {
|
||||
if (!resource.equals(functionArn) && !resource.startsWith(functionArn + "/")) {
|
||||
if (!namesFunction(resource, function)) {
|
||||
throw policySyntax();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** AWS reads only the service and the resource, so any prefix, partition, region or account passes. */
|
||||
private static boolean namesFunction(String resource, String function) {
|
||||
String[] parts = resource.split(":", 6);
|
||||
return parts.length == 6 && "lambda".equals(parts[2])
|
||||
&& (parts[5].equals(function) || parts[5].equals(function + "*") || parts[5].startsWith(function + "/"));
|
||||
}
|
||||
|
||||
private static void requireNotPublic(JsonNode statement) {
|
||||
if (statement.path("Effect").asText().equalsIgnoreCase("Allow") && isPublicPrincipal(statement.get("Principal"))
|
||||
&& !hasTrustedCondition(statement.path("Condition"))) {
|
||||
|
||||
Reference in new issue
Block a user