Commit 4bf5ab9
authored
[ZEPPELIN-6626] Fix JWT expiration validation security vulnerability
### What is this PR for?
This PR fixes a critical security vulnerability in JWT token validation where tokens without expiration time were incorrectly accepted as valid, potentially allowing indefinite unauthorized access. The
fix ensures all JWT tokens must have a valid expiration time and adds comprehensive unit tests to prevent regression.
### What type of PR is it?
Bug Fix
### Todos
* [x] - Fix JWT expiration validation logic to reject null expiration tokens
* [x] - Add security warning logs for rejected tokens
* [x] - Create comprehensive unit tests for JWT validation scenarios
* [x] - Verify backwards compatibility with existing valid tokens
### What is the Jira issue?
* [ZEPPELIN-6266](https://issues.apache.org/jira/browse/ZEPPELIN-6266) Fix JWT expiration validation security vulnerability
### How should this be tested?
* **Automated Unit Tests Added**:
- New test file: `KnoxJwtRealmTest.java` with 3 comprehensive test scenarios
- Run: `mvn test -Dtest=KnoxJwtRealmTest -pl zeppelin-server`
- All tests pass: `Tests run: 3, Failures: 0, Errors: 0, Skipped: 0`
* **Manual Testing Steps**:
1. Create JWT token without expiration time → Should be rejected with security warning
2. Create JWT token with valid future expiration → Should be accepted
3. Create JWT token with past expiration → Should be rejected
4. Check server logs for security warnings: "JWT token has no expiration time - rejecting token for security"
* **Security Validation**:
- Verify that tokens without expiration are properly rejected
- Confirm existing valid tokens continue to work
- Check security event logging
### Screenshots (if appropriate)
N/A - Security fix with no UI changes
### Questions:
* **Does the license files need to update?** No - only modified existing files and added test files with standard Apache license headers
* **Is there breaking changes for older versions?** No - fully backwards compatible. Only affects tokens with missing expiration (which should not exist in proper JWT implementations)
* **Does this needs documentation?** No - internal security fix that doesn't change public APIs or configuration
Closes #5007 from chadongmin/ZEPPELIN-6266.
Signed-off-by: Jongyoul Lee <jongyoul@gmail.com>1 parent ab52456 commit 4bf5ab9
File tree
2 files changed
+108
-4
lines changed- zeppelin-server/src
- main/java/org/apache/zeppelin/realm/jwt
- test/java/org/apache/zeppelin/realm/jwt
2 files changed
+108
-4
lines changedLines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
199 | 201 | | |
200 | 202 | | |
201 | 203 | | |
| |||
Lines changed: 102 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
0 commit comments