Skip to content

restrict deserialized classes in LeveldbConfigurationStore log decode#8557

Open
naruto-lgtm wants to merge 1 commit into
apache:trunkfrom
naruto-lgtm:leveldb-conf-store-deser-allowlist
Open

restrict deserialized classes in LeveldbConfigurationStore log decode#8557
naruto-lgtm wants to merge 1 commit into
apache:trunkfrom
naruto-lgtm:leveldb-conf-store-deser-allowlist

Conversation

@naruto-lgtm

Copy link
Copy Markdown

Description of PR

LeveldbConfigurationStore.deserLogMutations reads the scheduler configuration mutation log back from the LevelDB store with a raw ObjectInputStream.readObject(). Anyone who can write the store directory (yarn.scheduler.configuration.leveldb-store.path) can replace the serialized LinkedList<LogMutation> with a gadget payload, and the RM will instantiate arbitrary Serializable classes off the classpath on the next load/recovery.

The sibling ZKConfigurationStore already decodes the same LinkedList<LogMutation> through commons-io ValidatingObjectInputStream with an explicit class allowlist; the LevelDB store was left on the unrestricted path. This change applies the same allowlist (LinkedList, LogMutation, HashMap, String) inside the decode helper so the restriction lives next to the read rather than relying on the store being trusted.

How was this patch tested?

Round-tripped a real LinkedList<LogMutation> (a HashMap of updates plus a user string) through the patched helper - it deserializes unchanged. A serialized object of a class outside the allowlist is now rejected with InvalidClassException ("Class name not accepted") instead of being constructed. Built hadoop-yarn-server-resourcemanager with the change.

For code changes:

  • Does the title or this PR starts with the corresponding JIRA issue id (e.g. 'HADOOP-17799. Your PR title ...')?
  • Object storage: have the integration tests been executed and the endpoint declared according to the connector-specific documentation?
  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?
  • If applicable, have you updated the LICENSE, LICENSE-binary, NOTICE-binary files?

AI Tooling

If an AI tool was used:

@naruto-lgtm naruto-lgtm force-pushed the leveldb-conf-store-deser-allowlist branch from e139021 to f39469c Compare July 8, 2026 06:31
@naruto-lgtm

Copy link
Copy Markdown
Author

Rebased onto current trunk to retrigger CI. The previous Jenkins run hung in an unrelated RM test after TestLeveldbConfigurationStore passed 10/10, and the Actions build check needed the branch off a newer base.

@naruto-lgtm naruto-lgtm force-pushed the leveldb-conf-store-deser-allowlist branch from f39469c to b790705 Compare July 8, 2026 06:35
@hadoop-yetus

Copy link
Copy Markdown

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 34s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
-1 ❌ test4tests 0m 0s The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch.
_ trunk Compile Tests _
+1 💚 mvninstall 45m 50s trunk passed
+1 💚 compile 1m 25s trunk passed with JDK Ubuntu-21.0.11+10-1-24.04.2-Ubuntu
+1 💚 compile 1m 27s trunk passed with JDK Ubuntu-17.0.19+10-1-24.04.2-Ubuntu
+1 💚 checkstyle 1m 18s trunk passed
+1 💚 mvnsite 1m 28s trunk passed
+1 💚 javadoc 1m 12s trunk passed with JDK Ubuntu-21.0.11+10-1-24.04.2-Ubuntu
+1 💚 javadoc 1m 11s trunk passed with JDK Ubuntu-17.0.19+10-1-24.04.2-Ubuntu
+1 💚 spotbugs 2m 36s trunk passed
+1 💚 shadedclient 31m 21s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 0m 59s the patch passed
+1 💚 compile 0m 56s the patch passed with JDK Ubuntu-21.0.11+10-1-24.04.2-Ubuntu
+1 💚 javac 0m 56s the patch passed
+1 💚 compile 0m 56s the patch passed with JDK Ubuntu-17.0.19+10-1-24.04.2-Ubuntu
+1 💚 javac 0m 56s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 0m 51s the patch passed
+1 💚 mvnsite 1m 2s the patch passed
+1 💚 javadoc 0m 47s the patch passed with JDK Ubuntu-21.0.11+10-1-24.04.2-Ubuntu
+1 💚 javadoc 0m 47s the patch passed with JDK Ubuntu-17.0.19+10-1-24.04.2-Ubuntu
+1 💚 spotbugs 2m 25s the patch passed
+1 💚 shadedclient 30m 6s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 unit 110m 20s hadoop-yarn-server-resourcemanager in the patch passed.
+1 💚 asflicense 0m 36s The patch does not generate ASF License warnings.
238m 8s
Subsystem Report/Notes
Docker ClientAPI=1.55 ServerAPI=1.55 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8557/2/artifact/out/Dockerfile
GITHUB PR #8557
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets
uname Linux 4567e73ae717 5.15.0-176-generic #186-Ubuntu SMP Fri Mar 13 11:01:42 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / f39469c
Default Java Ubuntu-17.0.19+10-1-24.04.2-Ubuntu
Multi-JDK versions /usr/lib/jvm/java-21-openjdk-amd64:Ubuntu-21.0.11+10-1-24.04.2-Ubuntu /usr/lib/jvm/java-17-openjdk-amd64:Ubuntu-17.0.19+10-1-24.04.2-Ubuntu
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8557/2/testReport/
Max. process+thread count 961 (vs. ulimit of 10000)
modules C: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager U: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8557/2/console
versions git=2.43.0 maven=3.9.15 spotbugs=4.9.7
Powered by Apache Yetus 0.14.1 https://yetus.apache.org

This message was automatically generated.

@hadoop-yetus

Copy link
Copy Markdown

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 36s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
-1 ❌ test4tests 0m 0s The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch.
_ trunk Compile Tests _
+1 💚 mvninstall 43m 0s trunk passed
+1 💚 compile 1m 26s trunk passed with JDK Ubuntu-21.0.11+10-1-24.04.2-Ubuntu
+1 💚 compile 1m 29s trunk passed with JDK Ubuntu-17.0.19+10-1-24.04.2-Ubuntu
+1 💚 checkstyle 1m 20s trunk passed
+1 💚 mvnsite 1m 32s trunk passed
+1 💚 javadoc 1m 14s trunk passed with JDK Ubuntu-21.0.11+10-1-24.04.2-Ubuntu
+1 💚 javadoc 1m 12s trunk passed with JDK Ubuntu-17.0.19+10-1-24.04.2-Ubuntu
+1 💚 spotbugs 2m 38s trunk passed
+1 💚 shadedclient 31m 26s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 0m 59s the patch passed
+1 💚 compile 0m 55s the patch passed with JDK Ubuntu-21.0.11+10-1-24.04.2-Ubuntu
+1 💚 javac 0m 55s the patch passed
+1 💚 compile 1m 0s the patch passed with JDK Ubuntu-17.0.19+10-1-24.04.2-Ubuntu
+1 💚 javac 1m 0s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 0m 52s the patch passed
+1 💚 mvnsite 1m 7s the patch passed
+1 💚 javadoc 0m 49s the patch passed with JDK Ubuntu-21.0.11+10-1-24.04.2-Ubuntu
+1 💚 javadoc 0m 46s the patch passed with JDK Ubuntu-17.0.19+10-1-24.04.2-Ubuntu
+1 💚 spotbugs 2m 22s the patch passed
+1 💚 shadedclient 30m 2s patch has no errors when building and testing our client artifacts.
_ Other Tests _
-1 ❌ unit 110m 46s /patch-unit-hadoop-yarn-project_hadoop-yarn_hadoop-yarn-server_hadoop-yarn-server-resourcemanager.txt hadoop-yarn-server-resourcemanager in the patch passed.
+1 💚 asflicense 0m 37s The patch does not generate ASF License warnings.
236m 5s
Reason Tests
Failed junit tests hadoop.yarn.server.resourcemanager.scheduler.capacity.TestLeafQueue
Subsystem Report/Notes
Docker ClientAPI=1.55 ServerAPI=1.55 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8557/3/artifact/out/Dockerfile
GITHUB PR #8557
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets
uname Linux 52594eb9d3cb 5.15.0-176-generic #186-Ubuntu SMP Fri Mar 13 11:01:42 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / b790705
Default Java Ubuntu-17.0.19+10-1-24.04.2-Ubuntu
Multi-JDK versions /usr/lib/jvm/java-21-openjdk-amd64:Ubuntu-21.0.11+10-1-24.04.2-Ubuntu /usr/lib/jvm/java-17-openjdk-amd64:Ubuntu-17.0.19+10-1-24.04.2-Ubuntu
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8557/3/testReport/
Max. process+thread count 940 (vs. ulimit of 10000)
modules C: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager U: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8557/3/console
versions git=2.43.0 maven=3.9.15 spotbugs=4.9.7
Powered by Apache Yetus 0.14.1 https://yetus.apache.org

This message was automatically generated.

@naruto-lgtm

Copy link
Copy Markdown
Author

The -1 in the latest Yetus run is TestLeafQueue#testMaxApplicationsWithNodeLabels erroring inside Mockito spy stubbing (WrongTypeOfReturnValue on getNumAsyncSchedulerThreads), which is a stubbing race on the CapacityScheduler spy, not this patch; the change only touches deserialization in LeveldbConfigurationStore and TestLeafQueue has no reference to the configuration store. The previous Yetus run on the same branch passed the full resourcemanager suite with TestLeafQueue green. On test4tests, the manual verification steps are in the description under 'How was this patch tested'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants