-
Notifications
You must be signed in to change notification settings - Fork 693
[GEODE-10535] Secure Session Deserialization with Application-Level Security Model using ObjectInputFilter (JEP 290) #7966
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GEODE-10535] Secure Session Deserialization with Application-Level Security Model using ObjectInputFilter (JEP 290) #7966
Conversation
- Implement per-application deserialization filtering using standard JEP 290 API - Add ObjectInputFilter parameter to ClassLoaderObjectInputStream constructor - Update GemfireHttpSession to read filter configuration from ServletContext - Add comprehensive security tests covering RCE and DoS prevention - Add 52 tests validating gadget chain blocking and resource limits - Add example configuration in session-testing-war web.xml This provides application-level security isolation, allowing each web application to define its own deserialization policy independent of cluster configuration.
|
All checks have passed, @sboorlagadda |
- Add comprehensive security guide for configuring deserialization protection - Document JEP 290 ObjectInputFilter pattern syntax and examples - Include best practices, troubleshooting, and migration guidance - Add navigation link in HTTP Session Management chapter overview
sboorlagadda
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think adding a log if users have not configured a filter should be good improvement and other nitpicks.
| String filterPattern = getServletContext() | ||
| .getInitParameter("serializable-object-filter"); | ||
| ObjectInputFilter filter = filterPattern != null | ||
| ? ObjectInputFilter.Config.createFilter(filterPattern) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we concerned with any duplicate object creations? Should we guard them against races?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I appreciate your excellent point, @sboorlagadda. I've implemented filter caching using the double-checked locking pattern with volatile fields. The changes include:
- Added
private volatile ObjectInputFilter cachedFilterto cache the filter instance - Added
private volatile boolean filterLoggedto ensure one-time logging - Implemented
getOrCreateFilter()method that creates and caches the filter on first use - The double-checked locking ensures thread-safety without synchronization overhead on subsequent calls
This eliminates both the performance overhead of recreating the filter on every deserialization and prevents race conditions in multi-threaded servlet environments.
| throws IOException { | ||
| super(in); | ||
| this.loader = loader; | ||
| setObjectInputFilter(filter); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add a null check?
if (filter != null) {
setObjectInputFilter(filter);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch! Added a null check.
- Implement filter caching using double-checked locking with volatile fields to eliminate race conditions and improve performance - Add null check before setObjectInputFilter() for defensive programming - Add INFO logging when filter is configured and WARN logging when not configured to improve security visibility Addresses review comments by @sboorlagadda on PR apache#7966
|
Thank you for your brilliant idea, @sboorlagadda. Implemented comprehensive logging in the getOrCreateFilter() method. I appreciate your thoughtful review. |
|
Hi @sboorlagadda, |
sboorlagadda
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved
|
Thank you so much for your review and approval @sboorlagadda |
- Implement filter caching using double-checked locking with volatile fields to eliminate race conditions and improve performance - Add null check before setObjectInputFilter() for defensive programming - Add INFO logging when filter is configured and WARN logging when not configured to improve security visibility Addresses review comments by @sboorlagadda on PR #7966
Secure Session Deserialization with Application-Level Security Model
Overview
This PR implements Application-Level Security Model for Apache Geode session management using Java's standard ObjectInputFilter API (JEP 290). This approach provides Application-Level Security Model isolation, aligning with industry standards and Geode's existing fine-grained authorization model.
An alternative architecture is implemented in [GEODE-10515] Enhance Session Attribute Handling with Input Validation (#7941).
Testing: 52 comprehensive tests (all passing)
Security Coverage: 26 gadget classes + 10 dangerous package patterns blocked
Architecture
Application-Level Security Model
Key Principle: Each application enforces its own security boundary, independent of cluster configuration.
Security Guarantees
Protection Against Critical Vulnerabilities
Remote Code Execution (RCE)
Denial of Service (DoS)
Severity Assessment
Architecture Comparison
1. Application-Level Security Model
2. TCCL Approach - Cluster-Level Security
3. PR-7941/GEODE-10515 Custom Filter - Hardcoded Security
Summary:
Decision Matrix
Architectural Consistency
Geode's Existing Security Model
Geode already provides fine-grained authorization through
SecurityManager:Current State:
With ObjectInputFilter:
Result: Architectural consistency - both use fine-grained, Application-Level Security Model.
Industry Standards
OWASP Deserialization Cheat Sheet
resolveClass()overrideSecurity Frameworks
Implementation Details
Files Changed (7 files, 1,502 insertions, 1 deletion)
Production Code (9 lines)
1. GemfireHttpSession.java
2. ClassLoaderObjectInputStream.java
3. web.xml - Configuration Example
Test Files (1,243 lines)
4. ClassLoaderObjectInputStreamTest.java
5. DeserializationSecurityTest.java
6. GadgetChainSecurityTest.java
Testing
Test Coverage Summary
Running Tests
Configuration Guide
Basic Configuration
Step 1: Add filter pattern to
web.xmlStep 2: Deploy WAR file (no cluster restart needed)
Pattern Syntax (JEP 290)
Multi-Application Example
E-commerce Application
Analytics Application
CMS Application
Result: Each application has isolated security policy
Checklist
References
Recommendation
This PR implements Application-Level Security Model using Java's ObjectInputFilter API (JEP 290). It provides:
Recommended for most use cases - provides the best balance of security, simplicity, and operational flexibility.
For all changes, please confirm:
develop)?gradlew buildrun cleanly?