Repository navigation
WW-5662 Run core tests with the OGNL allowlist enabled, as shipped - #2194
Open
sohankanna wants to merge 1 commit into
Open
sohankanna wants to merge 1 commit into
sohankanna wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes WW-5662
struts.allowlist.enableships astrue, but every core test that boots aDispatchergets it forced tofalsebyStrutsTestCaseHelper. That's how WW-5659 (every file upload rejected under the shipped default) passed the full core suite.What I measured first
With the helper forced to
true, the core suite gave 64 failing tests in 23 classes, out of 3,874 (46 failures, 18 errors). That's far smaller than expected. Almost all of them read or write test fixtures (TestBean,TestAction, actions pushed straight onto the stack) that a configuration provider would have allowlisted in a real app. That made option 2 from the ticket practical, staged.Change
StrutsInternalTestCasenow boots withstruts.allowlist.enable=trueunless a test sets it explicitly.allowlistedFixtureClasses(): a test declares the hand-made beans and actions its OGNL expressions touch, and they are appended tostruts.allowlist.classes. The Javadoc says to never list framework classes, because a framework class missing from the allowlist is exactly what these tests should catch.isAllowlistEnabled(), reserved for the classes not migrated yet. Each override carries a one-line reason and a WW-5662 reference, so the remaining gap is listed in the code instead of hidden in a helper default.StrutsInternalTestCase(including the tag tests viaAbstractUITagTest) now runs with the allowlist on, unchanged.LazyParamsAllowlistTeststill covers that path with the allowlist on);size()on a JDKList);StrutsTestCaseHelperkeeps itsfalsedefault, sostruts2-junit-pluginusers see no change. That matches the ticket's non-goals.Something to look at separately
OgnlUtilStrutsTest.testAccessToSizeMethodfails under the shipped allowlist becausepersons.size()on anArrayListis rejected. If that's not intended for production either, it deserves its own ticket. I didn't change any framework behavior here.Testing
mvn -pl core test: 3,876 run, 0 failures, 0 errors, BUILD SUCCESS (with WW-5855's twoTokenHelperTestcases also in the tree, which is why it's 3,876 and not 3,874).