Hi all, I have been reviewing the OGNL guard area in main — the refactor from WW-5880/5881, SecurityMemberAccess, the StrutsNodeGuard default, and the test suite under core/src/test/java/org/apache/struts2/ognl/ — against the public record of OGNL bypass research (the S2 bulletins and the 2023 GitHub Security Lab write-up on OGNL sandboxes).
Two observations came out of this. I would like to put both on the list before preparing any PR, so the team can tell me which direction (if any) is welcome and how to scope it. --- Observation 1 — regression tests against public CVE payloads The current test suite validates guard mechanics (node-type exclusion, bean selection, DI wiring, member access rules) thoroughly, but does not include executable regression tests built from the payloads behind the published S2 bulletins or the public research. For example, there is no test that pins "payload X from S2-061 is refused on a default configuration" — the guarantee lives in the code and in reviewers' memory, not in the suite. Proposal: add a new regression test class under core/src/test/java/org/apache/struts2/ognl/ that iterates one test per documented public payload, feeding it through the appropriate entry point (ValueStack.findValue, ParametersInterceptor, tag attributes), and asserting that the current default configuration refuses the evaluation. If any payload is found not to be refused today, I would stop and report it privately per SECURITY.md before proposing a fix. Benefit: a future refactor that unintentionally reopens a known vector fails a test rather than fails a bulletin. All referenced payloads come from public advisories or published research — this is proposed as hardening, not disclosure. --- Observation 2 — sibling packages worth excluding, following WW-5838 WW-5838 recently added java.beans, java.lang.reflect, and java.lang.invoke to the excluded packages in SecurityMemberAccess. That choice is well motivated — each of those packages gives a path to class-loader or method-handle primitives that break the allowlist assumption. Several siblings follow the same reasoning and are not excluded in main today. The candidates I have in mind, with the rationale: - java.lang.ref — WeakReference / SoftReference reachability primitives that have been used as covert channels in restricted VMs. - jdk.internal.* — internal JDK APIs that applications must not reach through OGNL under any configuration. Precedent: Spring, Dropwizard, Jackson all block these explicitly. - sun.misc.* — sun.misc.Unsafe is the canonical visibility bypass; reaching it through OGNL defeats the member-access model entirely. - javax.script — reaching a ScriptEngine (Nashorn, Rhino, GraalJS) from OGNL is an RCE primitive and has been reported as such in Jackson and Spring expression languages. Proposal: a PR titled "WW-XXXX Extend WW-5838 to sibling packages with the same escape primitives", adding these to the default excludedPackageNames, together with a test per package showing the same shape of assertion the WW-5838 commit used. If the team prefers a narrower subset — for example excluding only jdk.internal and sun.misc because they are the strictest "never reachable" cases — I will scope the PR accordingly. --- How the two observations connect If Observation 2 is accepted and the sibling packages are excluded, the regression tests from Observation 1 become the verification that the exclusion actually refuses the payloads it is meant to refuse. The two land as one coherent change — the exclusion plus the proof — rather than as two unrelated PRs. If only Observation 1 is accepted, the regression layer stands on its own: it pins current behaviour, independent of any blocklist change. If only Observation 2 is accepted, I will add the targeted tests for that change without the broader regression layer. --- Before I open a Jira ticket or prepare a PR, I would like to confirm: 1. Is the regression-test direction (Observation 1) welcome, and if so, is the preferred naming by S2-bulletin number or by behaviour description? 2. Of the sibling packages listed under Observation 2, which ones the team considers in-scope for a WW-5838-style exclusion? 3. Is there a current internal refactor of this area that would make either proposal premature? I have read SECURITY.md, THREAT_MODEL.md, CLAUDE.md and AGENTS.md before writing this. Both proposals are framed as hardening per the control test in SECURITY.md — no undisclosed vulnerability is involved; every payload and every package referenced is from a public advisory, a published research artifact, or an established industry precedent. If during implementation anything looks like it crosses into a real bypass of a current control, I will stop and follow the private process. Thanks for the time, Antonio Cuervo
