github-advanced-security[bot] commented on code in PR #3376:
URL: https://github.com/apache/avro/pull/3376#discussion_r2083524732
##########
lang/java/avro/src/main/java/org/apache/avro/specific/SpecificDatumReader.java:
##########
@@ -128,31 +150,43 @@
return (trustedPackages.size() == 1 && "*".equals(trustedPackages.get(0)));
}
- private void checkSecurity(Class clazz) throws ClassNotFoundException {
- if (trustAllPackages() || clazz.isPrimitive()) {
+ private void checkSecurity(String className) throws ClassNotFoundException {
+ if (trustAllPackages() || PRIMITIVES.contains(className)) {
return;
}
+ for (String trustedClass : getTrustedClasses()) {
+ if (className.equals(trustedClass)) {
+ return;
+ }
+ }
+
boolean found = false;
- Package thePackage = clazz.getPackage();
- if (thePackage != null) {
- for (String trustedPackage : getTrustedPackages()) {
- if (thePackage.getName().equals(trustedPackage) ||
thePackage.getName().startsWith(trustedPackage + ".")) {
- found = true;
- break;
- }
+ for (String trustedPackage : getTrustedPackages()) {
Review Comment:
## Deprecated method or constructor invocation
Invoking [SpecificDatumReader.getTrustedPackages](1) should be avoided
because it has been deprecated.
[Show more
details](https://github.com/apache/avro/security/code-scanning/3325)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]