snoopdave commented on code in PR #199:
URL: https://github.com/apache/roller/pull/199#discussion_r4174844584


##########
app/src/test/java/org/apache/roller/weblogger/pojos/wrapper/WrapperPojoConfinementTest.java:
##########
@@ -0,0 +1,143 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the
+ * top level directory of this distribution.
+ */
+package org.apache.roller.weblogger.pojos.wrapper;
+
+import java.io.StringWriter;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Properties;
+
+import org.apache.roller.weblogger.pojos.User;
+import org.apache.roller.weblogger.pojos.Weblog;
+import org.apache.roller.weblogger.pojos.WeblogEntry;
+import org.apache.velocity.VelocityContext;
+import org.apache.velocity.app.VelocityEngine;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
+/**
+ * Covers what a template can reach through the pojo wrappers.
+ *
+ * <p>Weblog templates are authored by weblog administrators, a role Roller
+ * treats as untrusted and renders under <code>SecureUberspector</code>. The
+ * wrappers exist precisely so that role only sees a safe surface, so the
+ * wrapped objects themselves must stay out of the template-visible surface.
+ * Java rendering code that does need them goes through {@link Wrappers},
+ * which is never put in a template context.
+ */
+public class WrapperPojoConfinementTest {
+
+    private static final Class<?>[] WRAPPED_TYPES = {
+            Weblog.class, WeblogEntry.class, User.class,
+    };
+
+    private static VelocityEngine engine;
+
+    @BeforeAll
+    public static void setUpEngine() {
+        // the same introspection sandbox the weblog renderer configures
+        Properties props = new Properties();

Review Comment:
   🐞Claude Issue: **Important:** The test copies the uberspector setting 
instead of loading `WEB-INF/velocity.properties`. If the renderer's 
configuration changes, for example a different or chained uberspector or added 
introspector restrictions, this test still passes against a configuration that 
is no longer real. Load the shipped file (from 
`src/main/webapp/WEB-INF/velocity.properties`, or the classpath copy if there 
is one) and init the engine from it, keeping only the resource-loader settings 
the test needs.



-- 
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]

Reply via email to