-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
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
Allow all immutable List subclasses from Java 11 #10026
Allow all immutable List subclasses from Java 11 #10026
Conversation
Yay, your first pull request towards Jenkins core was created successfully! Thank you so much! |
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.
seems ok, do you have a specific need for them though?
@jglick / @dwnusbaum any opinion? |
I used it recently in the Scriptler plugin, which is how I came across this. By only having And then while I was here, I also thought that adding the |
/label ready-for-merge This PR is now ready for merge, after ~24 hours, we will merge it if there's no negative feedback. Thanks! |
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.
-0 I guess. It is not a security threat, but neither is it necessary: jenkinsci/scriptler-plugin#134 (review)
Most of the classes listed in the whitelist were there not because they should be serialized but because they were being serialized by some plugin at the time https://jenkins.io/jep/200 was developed, and it was simpler to allow the class temporarily than to wait for a plugin release removing the usage. New code should only use simple types like ArrayList
. Always look at your actual config.xml
serial form.
Why should something like In terms of the serialized forms, that's currently fair: using an <parameters>
<org.jenkinsci.plugins.scriptler.config.Parameter>
<name>test</name>
<value>value1</value>
</org.jenkinsci.plugins.scriptler.config.Parameter>
</parameters> while using <parameters class="java.util.ImmutableCollections$List12" resolves-to="java.util.CollSer" serialization="custom">
<java.util.CollSer>
<default>
<tag>1</tag>
</default>
<int>1</int>
<org.jenkinsci.plugins.scriptler.config.Parameter>
<name>test</name>
<value>value</value>
</org.jenkinsci.plugins.scriptler.config.Parameter>
</java.util.CollSer>
</parameters> which appears to be because it implements custom serialization methods. But I would argue that the second form should be improved (if possible) rather than always preferring the first form. |
Core could get additional custom XStream converters if necessary. But it is not necessary: the field in an XStream-serialized class should always use the plainest collection possible types—generally A |
I think I see why I would still argue that we should probably add |
A previous commit specifically allowed one of the two subclasses used by `List.of` and `List.copyOf`, but not the other, which can result in unexpected errors and bugs. Add the other to the default allow list of classes to avoid these.
517c7b8
to
fc4a567
Compare
I've pushed a new commit and updated the PR description to reflect that we're only allowing immutable |
As a rule, nothing should ever be added to this whitelist ever again. The damage has already been partially done in this case so this PR is more a matter of completing the mistake. No plugin code should be written which relies on it.
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.
Mostly harmless.
This PR is now ready for merge. We will merge it after approximately 24 hours if there is no negative feedback. /label ready-for-merge |
Congratulations on getting your very first Jenkins core pull request merged 🎉🥳 |
commit 76d4bb8 Author: Jan Faracik <[email protected]> Date: Sun Jan 5 11:01:47 2025 +0000 Fix in case of null provider commit ebb6831 Author: Jan Faracik <[email protected]> Date: Sat Jan 4 15:23:03 2025 +0000 Lint commit 11e4b8d Author: Jan Faracik <[email protected]> Date: Sat Jan 4 14:48:20 2025 +0000 Init commit 519eb19 Merge: 908030e b3b5a69 Author: Kris Stern <[email protected]> Date: Sat Jan 4 16:01:19 2025 +0800 Merge pull request jenkinsci#9980 from basil/OptionHandlerExtension Register `OptionHandler`s through `META-INF/services/annotations` and Annotation Indexer rather than `META-INF/services` and Commons Discovery commit 908030e Merge: d3e8908 fc4a567 Author: Kris Stern <[email protected]> Date: Sat Jan 4 16:00:31 2025 +0800 Merge pull request jenkinsci#10026 from mtughan/allow-immutable-collections Allow all immutable List subclasses from Java 11 commit d3e8908 Author: Jesse Glick <[email protected]> Date: Fri Jan 3 05:43:27 2025 -0500 Correcting API documentation of `builds` vs. `allBuilds` (jenkinsci#10112) commit 89f48c5 Merge: 238c498 e1dff1a Author: Kris Stern <[email protected]> Date: Fri Jan 3 18:00:18 2025 +0800 Merge pull request jenkinsci#10106 from timja/ballColorTd-table [JENKINS-74868] Use new build status symbols in multi branch projects commit 238c498 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Thu Jan 2 20:32:04 2025 -0800 Update dependency io.jenkins.plugins:design-library to v342 (jenkinsci#10111) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> commit 75410bc Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Thu Jan 2 10:45:55 2025 -0800 Update dependency io.jenkins.plugins:json-api to v20241224 (jenkinsci#10110) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> commit 1aa9c57 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Thu Jan 2 10:44:50 2025 -0800 Update Yarn to v4.6.0 (jenkinsci#10109) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> commit e1dff1a Author: Tim Jacomb <[email protected]> Date: Tue Dec 31 19:46:12 2024 +0000 Adjust test commit 5fd9f51 Author: Tim Jacomb <[email protected]> Date: Mon Dec 30 22:20:15 2024 +0000 [JENKINS-74868] Use new build status symbols in multi branch projects commit b3b5a69 Merge: 33d8280 d73c0ea Author: Basil Crow <[email protected]> Date: Tue Dec 17 10:19:22 2024 -1000 Merge branch 'master' into OptionHandlerExtension commit fc4a567 Author: Michael Tughan <[email protected]> Date: Wed Dec 4 15:15:13 2024 -0500 Allow all immutable List subclasses from Java 11 A previous commit specifically allowed one of the two subclasses used by `List.of` and `List.copyOf`, but not the other, which can result in unexpected errors and bugs. Add the other to the default allow list of classes to avoid these. commit 33d8280 Merge: a1c8c83 9965f04 Author: Tim Jacomb <[email protected]> Date: Sun Dec 8 08:32:24 2024 +0000 Merge branch 'master' into OptionHandlerExtension commit a1c8c83 Author: Basil Crow <[email protected]> Date: Fri Nov 15 10:58:26 2024 -0800 Register `OptionHandler`s through `META-INF/services/annotations` and Annotation Indexer rather than `META-INF/services` and Commons Discovery
A previous commit specifically allowed one of the two subclasses used by
List.of
andList.copyOf
, but not the other, which can result in unexpected errors and bugs. Add the other to the default allow list of classes to avoid these.Testing done
None.
Proposed changelog entries
Proposed upgrade guidelines
N/A
Submitter checklist
Desired reviewers
N/A
Before the changes are marked as
ready-for-merge
:Maintainer checklist