|
| 1 | +--- |
| 2 | +title: Serialization |
| 3 | +--- |
| 4 | + |
| 5 | +<!-- |
| 6 | +Licensed to the Apache Software Foundation (ASF) under one or more |
| 7 | +contributor license agreements. See the NOTICE file distributed with |
| 8 | +this work for additional information regarding copyright ownership. |
| 9 | +The ASF licenses this file to You under the Apache License, Version 2.0 |
| 10 | +(the "License"); you may not use this file except in compliance with |
| 11 | +the License. You may obtain a copy of the License at |
| 12 | +
|
| 13 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 14 | +
|
| 15 | +Unless required by applicable law or agreed to in writing, software |
| 16 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 17 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 18 | +See the License for the specific language governing permissions and |
| 19 | +limitations under the License. |
| 20 | +--> |
| 21 | + |
| 22 | +Apache Geode offers mechanisms to control and filter object serialization, particularly |
| 23 | + in the context of security and performance. This is primarily achieved through: |
| 24 | + |
| 25 | + |
| 26 | +## Global Serialization Filter (Java) |
| 27 | + |
| 28 | +For deployments using Java, a global serialization filter can be enabled to restrict the types of objects that can be serialized and |
| 29 | +deserialized within the Geode process. This helps mitigate risks associated with deserialization of untrusted data, a common vulnerability. |
| 30 | + |
| 31 | +- To enable this, the Java system property `geode.enableGlobalSerialFilter` is set to true when starting Geode locators and servers. |
| 32 | + |
| 33 | +- Additionally, the `serializable-object-filter` configuration option, used in conjunction with `validate-serializable-objects,` is used to |
| 34 | +specify a whitelist of user-defined classes that are allowed to be serialized/deserialized, in addition to standard JDK and Geode classes. |
| 35 | + This allows for fine-grained control over which custom objects are permitted in the system. |
| 36 | + |
| 37 | +## PDX Serialization |
| 38 | + |
| 39 | +Apache Geode's Portable Data eXchange (PDX) serialization offers a more robust and flexible approach to data serialization, providing features |
| 40 | +like schema evolution and language independence. While not a "filter" in the same sense as the global serialization filter, PDX provides control |
| 41 | +over how objects are serialized and deserialized. |
| 42 | + |
| 43 | +- **PdxSerializer:** You can implement a custom `PdxSerializer` to define how specific domain objects are serialized and deserialized, allowing |
| 44 | + for selective handling of fields or transformations during the process. |
| 45 | + |
| 46 | +- **Reflection-Based Auto-Serialization:** PDX also supports automatic reflection-based serialization, where Geode can serialize objects without |
| 47 | + requiring explicit implementation of `PdxSerializable` in your domain classes. This can be configured to include or exclude specific types based |
| 48 | + on criteria like package names, providing a form of type filtering. |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | + In conclusion, Apache Geode provides serialization filtering capabilities through a global filter for security hardening in Java 8 environments and |
| 54 | + through the flexible configurations of PDX serialization for fine-grained control over data handling and type inclusion/exclusion. |
0 commit comments