Skip to content

Conversation

@kirklund
Copy link
Contributor

Backport all necessary commits for GEODE-9758 and GEODE-9980

…pache#7121)

Adds support for customizing source set paths of ClassAnalysisRule.

PROBLEM

Modules external to Geode must be structured the same as Geode
source code in order to use ClassAnalysisRule and the
Analyze*Serializables tests. This is necessary to better facilitate
pluggability of modules that need to provide sanctioned serializable
lists.

SOLUTION

Add source set path customization to ClassAnalysisRule, introduce
a new layer of Analyze*Serializables test base classes that can be
directly extended in order to customize source set paths in
ClassAnalysisRule. Also includes improvements to some iterating
of classes during analysis.

(cherry picked from commit 5d1e919)
Move SanctionedSerializables to new package
org.apache.geode.internal.serialization.filter.

(cherry picked from commit db64b49)
Extract part of SystemPropertyHelper to geode-common for use in
modules that are upstream from geode-core.

Define new DEFAULT_PREFIX that maps to GEODE_PREFIX and use that
everywhere that GEODE_PREFIX was previously used.

* Inline prefix constants in SystemPropertyHelper
* Use static imports for system property prefixes.
* Split up large tests in SystemPropertyHelperTest.
* Fix JAXBService

(cherry picked from commit ebf8479)
GEODE-9758: Add internal serial filter API apache#7217

Expand ObjectInputStreamFilterWrapper to be an internal API which
supports all of Geode's uses of Java's ObjectInputFilter.

Introduce a new system property, geode.enableGlobalSerialFilter, to
enable a process-wide filter with all serializable Geode classes on the
classpath and the value of serializable-object-filter accept-listed.

To enable the process-wide filter with GFSH start commands, add:

* --J=-Dgeode.enableGlobalSerialFilter=true

Functional Capabilities

The internal API lives in geode-serialization and works on OpenJDK
based JREs providing a facade for Java's ObjectInputFilter in Java 8
and Java 9 or greater using reflection. The API provides the following
capabilities:

* creating an ObjectInputFilter
* setting an ObjectInputFilter on an ObjectInputStream
* getting an ObjectInputFilter from a ObjectInputStream
* setting a process-wide ObjectInputFilter
* getting a process-wide ObjectInputFilter

Design Notes

The API defines the following primary interface types:

* factory interfaces for creating instances of types within the API
* filter interfaces to split out single ops from Java's
  ObjectInputFilter
* configuration interfaces for handling system properties, logging,
  and config validation

The concrete classes in the API receive parameters injected via a
constructor for any collaborators that are not specified by the
interfaces. This is intentional even when the instance is only used
once before de-referencing it. All collaborators that are defined in
the interface are passed in as parameters to the implementing
method; all others are passed in via the constructor and stored as
fields.

(cherry picked from commit 7978abf)
(cherry picked from commit f974238)
@kirklund kirklund force-pushed the GEODE-9758-support-1.12-backport-PR2 branch from 363402f to 09155d2 Compare March 29, 2022 17:34
@kirklund kirklund marked this pull request as ready for review March 29, 2022 17:37
Copy link
Contributor

@onichols-pivotal onichols-pivotal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opting-in to automated commit message feedback via COMMITWATCHERS. Guidelines in https://cwiki.apache.org/confluence/display/GEODE/Commit+Message+Format (which are totally optional, and yes, a bit pedantic) suggest your first commit summary should be 50 characters or less (not including bug# and pr#) to avoid truncation in github and other tools (yours is 64 characters...longer is ok and just check that you've prioritized the most salient words before the 47-character mark).

What matters most is not formatting, but including enough detail for future contributors to understand what you changed and why.

@kirklund kirklund force-pushed the GEODE-9758-support-1.12-backport-PR2 branch from 754956d to 626bf58 Compare March 29, 2022 21:01
Improves the error handling of serial filter configuration and
filtering. The API throws a runtime exception wrapping any thrown
exceptions.

When geode.enableGlobalSerialFilter is FALSE:
* Startup succeeds without throwing any exceptions even if an older
  version of Java throws "java.lang.ClassNotFoundException
  sun.misc.ObjectInputFilter".

When geode.enableGlobalSerialFilter is TRUE:
* Startup fails by throwing an exception when configuration of serial
  filter fails for any reason.

Renames ObjectInputFilter to avoid confusion with the Java interface of
the same name.

Fixes a bug found in ReflectiveFacadeGlobalSerialFilterTest which
resulted in configuring a non-mocked process-wide serial filter that
polluted the JVM for all later tests.

Fixes other minor details in LocatorLauncher, InternalDataSerializer
and various related tests.

(cherry picked from commit ce57e9f)
@kirklund kirklund force-pushed the GEODE-9758-support-1.12-backport-PR2 branch from 626bf58 to 75fa136 Compare March 29, 2022 22:09
@kirklund kirklund merged commit 5169450 into apache:support/1.12 Mar 30, 2022
@kirklund kirklund deleted the GEODE-9758-support-1.12-backport-PR2 branch March 30, 2022 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants