Skip to content

Commit

Permalink
Add protobuf collections as safe ones (#7438)
Browse files Browse the repository at this point in the history
protobuf collections used are specific ones implementing JDK
interfaces. They are in-memory collection so it is safe to handle them
like the JDK ones.
  • Loading branch information
jpbempel authored Aug 26, 2024
1 parent ab9943c commit d5b629d
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ public static boolean isSafe(Collection<?> collection) {
// All Collection implementations from JDK base module are considered as safe
return true;
}
if (className.startsWith("com.google.protobuf.")) {
// All Collection implementations from Google ProtoBuf are considered as safe
return true;
}
return false;
}

Expand All @@ -170,6 +174,10 @@ public static boolean isSafe(Map<?, ?> map) {
// All Map implementations from JDK base module are considered as safe
return true;
}
if (className.startsWith("com.google.protobuf.")) {
// All Map implementations from Google ProtoBuf are considered as safe
return true;
}
return false;
}

Expand Down

0 comments on commit d5b629d

Please sign in to comment.