mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
fix(ec2): tolerate a null groupId in the network-interface group-id filter (#2921)
The group-id filter for DescribeNetworkInterfaces resolves to matchesValue(List<String>, String), which called value.matches(...) with no null guard. A real GroupIdentifier entry whose groupId is null (a name-only association) therefore NPE'd the whole request, unlike the sibling matchesValue(String, List<String>) overload that already normalizes with Objects.toString. Normalize the value the same way so every network-interface leaf filter (group-id, subnet-id, status, private-dns-name, ...) tolerates a null field instead of failing. Adds a regression test that carries a null-groupId entry ahead of a real group on the same interface, so the null path is exercised and the real group still matches.
This commit is contained in:
1 parent
5b3c0e01e3
commit
e44df51a79
2 files changed
+27
-1
No files matched your search
@@ -5732,8 +5732,9 @@ public class Ec2Service implements ContainerTeardown, ResourceProvider {
|
||||
}
|
||||
|
||||
private boolean matchesValue(List<String> patterns, String value) {
|
||||
String normalizedValue = Objects.toString(value, "");
|
||||
return patterns.stream()
|
||||
.anyMatch(pattern -> value.matches(wildcardToRegex(pattern)));
|
||||
.anyMatch(pattern -> normalizedValue.matches(wildcardToRegex(pattern)));
|
||||
}
|
||||
|
||||
private boolean matchesFilters(Object resource, Map<String, List<String>> filters, String region) {
|
||||
|
||||
Reference in new issue
Block a user