Lift minimum JDK version to 21 and remove SecurityManager - #2214
holgerfriedrich wants to merge 11 commits into
Conversation
| <libraries> | ||
| </libraries> | ||
| <javase>17</javase> | ||
| <javase>21</javase> |
There was a problem hiding this comment.
That's require change on the karaf-maven-plugin and dependencies. I will create another PR (as planned) to tackle that.
| import static org.ops4j.pax.exam.CoreOptions.maven; | ||
| import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.*; | ||
|
|
||
| @Ignore("Disabled due to removal of SecurityManager. ref Apache Karaf GitHub issue #2082") |
There was a problem hiding this comment.
I would rather remove the test (to avoid confusion) or refactor it instead of ignoring it.
There was a problem hiding this comment.
Ok, if I just remove the SecurityManager assertion, the test completes.
I am not sure if I get completely what this test was intended for (it checks that all bundles come up after applying a specific config - but how this was related to SecurityManager, I still don't get).
I pushed the change to ignore that no SecurityManager is there.
|
@jbonofre is there anying else open I should address? |
|
@holgerfriedrich I think this PR is pretty good, it just needs dependent PRs. I will tackle that. |
023bbe9 to
8ed17ca
Compare
|
@holgerfriedrich do you mind to share your email address with me ? I just realize that you didn't subscribe on the dev mailing list, and you are not on The ASF slack Karaf channel. Thanks ! |
8ed17ca to
d2e0bc8
Compare
|
Hi @holgerfriedrich @jbonofre, I've got here some ugly patches that seem to make the Subject-related stuff work on java 25. Basically, there's an issue with that in 25, Subject.callAs() and current() use a ScopedValue and its binding "gets lost" across "thread-boundaries", of which there are a bunch :) It gets ugly, because every time you do something like ExecutorService.submit() you have to also "pass" the current Subject. Gets even worse, because Gogo needs a similar treatment... Anyway, wondering if it might help if I share what we've got here with you... or if you already have something like it? Or if I might help in some other way? :) |
|
@arusevm I'm finalizing camel-karaf release. I will be back on Karaf just after, tackling this. Sorry for the delay. |
7a69588 to
264b04b
Compare
|
Thanks @holgerfriedrich for the update ! I will do a new pass because I have a bunch of changes on the way. |
7e6e4fd to
05bbfa0
Compare
|
@jbonofre may I ask you to have a look at this again? I rebased it in the last days and got the CI green. It is a major step towards Java 25 compatibility. |
c54ec28 to
7a3001e
Compare
7a3001e to
050898c
Compare
|
@holgerfriedrich I removed the specs bundles. Can you please rebase? What's your take about JDK 17 / JDK 21? |
050898c to
6e02242
Compare
|
@jbonofre if we do not consider writing a compat layer on our own, we need then new API available from JDK18. So 21 LTS is the natural choice. |
|
@holgerfriedrich I agree. I'm advocating for JDK 21 for Karaf 4.5.x. I propose to go that way (including updating our CI). |
6e02242 to
1bd0efa
Compare
|
@jbonofre how shall we proceed with this one? |
|
@holgerfriedrich there is needed wersion of aries proxy compatible with jdk 25, it seems that their repo is already compatible with jdk 25 but no new release yet. |
|
@holgerfriedrich @kamilkrzywanski I think we can move forward with this PR and tackle more required updates in follow up PRs (I'm working on Aries releases). |
|
@holgerfriedrich I will be back on this one with you to finalize it. |
|
Any progress on this? The Cytoscape project is trying to upgrade to Java 25 and right now, this PR seems to be what we need to start moving in that direction. Once this is committed, we should be able to use the nightly builds to start our testing and (if necessary) make the required changes to our REST infrastructure. |
|
@scootermorris I'm back on this one for Karaf 4.5.0. I will push some improvements/fixes and we will good to go. Let's say mid next week. |
|
@jbonofre Great to hear! Looking forward to it. |
051e1a7 to
34c40e9
Compare
|
@jbonofre Should I rebase again to check? |
34c40e9 to
2f4d98e
Compare
|
@jbonofre I had to rework, since the files added in the meantime need changes as well. |
|
@holgerfriedrich thanks for that! I'm working with Domonik for a new Aries Proxy release including the change. |
6784b86 to
50f8c79
Compare
* Lift minimum JDK version to 21 * Remove occurrences of SecurityManager, as getSecurityManager returns null since JDK 18 * Enable verbose deprecation warnings * Replace getSubject and doAs calls, getSubject can no longer be activated via JRE command line as SecurityManager has been removed in JDK 25. A replacement is available since Java 21. doAs was deprecated and is replaced by callAll. * Remove SecurityManager form JavaSecurityTest
Subject.current()/callAs() use a plain ScopedValue on JDK 25 (no SecurityManager fallback like on JDK 21), which doesn't survive a new Thread or an ExecutorService hop. Since Felix Gogo runs each command on its own executor thread, this broke current-user lookup and RBAC checks (bundle:list/bundle:info losing bundle visibility). - JaasHelper.doAs/runAs now use Subject.callAs() instead of the old AccessControlContext/SubjectDomainCombiner plumbing; drop the now dead OsgiSubjectDomainCombiner/DelegatingProtectionDomain classes. - SecuredCommand.execute() re-binds the subject from the session on whatever thread runs the command, since Session is always passed explicitly there regardless of the executing thread. - LocalConsoleManager, ShellFactoryImpl and SuCommand store the subject on the session so SecuredCommand can read it back.
Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
50f8c79 to
a9b9add
Compare
|
@jbonofre any news about Aries update? |
|
@fabgio I'm on Aries stuff and related. I will get back to that later today or tomorrow: I'm busy with Karaf 4.4.12 release prep right now. |
|
@fabgio Karaf 4.5.0 (including this PR) will be my top priority as soon as Karaf 4.4.12 is out. |
|
I did some testing in the past with the (already committed but not yet published) From here you can continue with Java 25 default: Then it needs a small patch to bring in the new version and additional dependencies: This makes all our tests work on a Java 25. For newer Java versions, aries needs another patch, apache/aries#912. I tried this and got it working with Java 27. |
This is a first step to prepare the 4.5 branch for running with Java 25.
Starting Karaf in Java 25 does not yet work, as a few functions related to the SecurityManager have been deprecated long time ago and cannot be activated any longer via command line switches.
As a new API has been added in Java 18, I for new lift the minimum required version to Java 21 (LTS).
Maybe this is not the way to go - as there has been some discussions if we could introduce an abstraction layer to allow Java 17 as well.
null since JDK 18
Disable JavaSecurityTest, Rework JavaSecurityTest #2082** getSubject can no longer be activated via JRE command line as
SecurityManager has been removed in JDK 25.
A replacement is available since Java 21.
** doAs was deprecated and is replaced by callAll.
For Java 25, another set of modifications is still needed and will be submitted as another PR.
Locally, I got Karaf compiling, passing the tests, and starting with Java 25. 🥳