From add5166ce3e8fe95cf16699291ff4c67e59659eb Mon Sep 17 00:00:00 2001 From: Joris Kuipers Date: Fri, 5 Apr 2024 20:37:20 +0200 Subject: [PATCH] Allow Thymeleaf to check for allowed method access of Java supertypes To prevent Thymeleaf templates from accessing methods on built-in Java types that are not allowed, it ships with a list of allowed supertypes. Its org.thymeleaf.util.ExpressionUtils type has an isMemberAllowed method that calls getDeclaredMethods() on those types, so that needs to work for all these types in a native image. Recent versions of Thymeleaf have expanded the list with two additional types, which is why the M2 version has 7 new entries while the RC1 / latest has 9. For details, check out https://github.com/thymeleaf/thymeleaf/blob/3.1-master/lib/thymeleaf/src/main/java/org/thymeleaf/util/ExpressionUtils.java --- .../thymeleaf/3.1.0.M2/reflect-config.json | 49 +++++++++++++++ .../thymeleaf/3.1.0.RC1/reflect-config.json | 63 +++++++++++++++++++ 2 files changed, 112 insertions(+) diff --git a/metadata/org.thymeleaf/thymeleaf/3.1.0.M2/reflect-config.json b/metadata/org.thymeleaf/thymeleaf/3.1.0.M2/reflect-config.json index 94b28d84..4ac66690 100644 --- a/metadata/org.thymeleaf/thymeleaf/3.1.0.M2/reflect-config.json +++ b/metadata/org.thymeleaf/thymeleaf/3.1.0.M2/reflect-config.json @@ -1,4 +1,53 @@ [ + { + "name": "java.util.Collection", + "allDeclaredMethods": true, + "condition": { + "typeReachable": "org.thymeleaf.util.ExpressionUtils" + } + }, + { + "name": "java.lang.Iterable", + "allDeclaredMethods": true, + "condition": { + "typeReachable": "org.thymeleaf.util.ExpressionUtils" + } + }, + { + "name": "java.util.List", + "allDeclaredMethods": true, + "condition": { + "typeReachable": "org.thymeleaf.util.ExpressionUtils" + } + }, + { + "name": "java.util.Map", + "allDeclaredMethods": true, + "condition": { + "typeReachable": "org.thymeleaf.util.ExpressionUtils" + } + }, + { + "name": "java.util.Map$Entry", + "allDeclaredMethods": true, + "condition": { + "typeReachable": "org.thymeleaf.util.ExpressionUtils" + } + }, + { + "name": "java.util.Set", + "allDeclaredMethods": true, + "condition": { + "typeReachable": "org.thymeleaf.util.ExpressionUtils" + } + }, + { + "name": "java.util.Calendar", + "allDeclaredMethods": true, + "condition": { + "typeReachable": "org.thymeleaf.util.ExpressionUtils" + } + }, { "name": "org.thymeleaf.expression.Dates", "allPublicMethods": true, diff --git a/metadata/org.thymeleaf/thymeleaf/3.1.0.RC1/reflect-config.json b/metadata/org.thymeleaf/thymeleaf/3.1.0.RC1/reflect-config.json index 2d2d2d37..e142f973 100644 --- a/metadata/org.thymeleaf/thymeleaf/3.1.0.RC1/reflect-config.json +++ b/metadata/org.thymeleaf/thymeleaf/3.1.0.RC1/reflect-config.json @@ -1,4 +1,67 @@ [ + { + "name": "java.util.Collection", + "allDeclaredMethods": true, + "condition": { + "typeReachable": "org.thymeleaf.util.ExpressionUtils" + } + }, + { + "name": "java.lang.Iterable", + "allDeclaredMethods": true, + "condition": { + "typeReachable": "org.thymeleaf.util.ExpressionUtils" + } + }, + { + "name": "java.util.Iterator", + "allDeclaredMethods": true, + "condition": { + "typeReachable": "org.thymeleaf.util.ExpressionUtils" + } + }, + { + "name": "java.util.List", + "allDeclaredMethods": true, + "condition": { + "typeReachable": "org.thymeleaf.util.ExpressionUtils" + } + }, + { + "name": "java.util.Map", + "allDeclaredMethods": true, + "condition": { + "typeReachable": "org.thymeleaf.util.ExpressionUtils" + } + }, + { + "name": "java.util.Map$Entry", + "allDeclaredMethods": true, + "condition": { + "typeReachable": "org.thymeleaf.util.ExpressionUtils" + } + }, + { + "name": "java.util.Set", + "allDeclaredMethods": true, + "condition": { + "typeReachable": "org.thymeleaf.util.ExpressionUtils" + } + }, + { + "name": "java.util.Calendar", + "allDeclaredMethods": true, + "condition": { + "typeReachable": "org.thymeleaf.util.ExpressionUtils" + } + }, + { + "name": "java.util.stream.Stream", + "allDeclaredMethods": true, + "condition": { + "typeReachable": "org.thymeleaf.util.ExpressionUtils" + } + }, { "name": "org.thymeleaf.expression.Dates", "allPublicMethods": true,