-
Notifications
You must be signed in to change notification settings - Fork 40.8k
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
Java Info Contributor #28136
Java Info Contributor #28136
Conversation
Thanks for the PR, @jonatan-ivanov. Note to the Boot team's future selves: I've labelled this for merging with amendments as we might rename some of the DTOs. |
What's the reason this kind of info gets exposed by default? Similar like with #25134, I see this as a potential source of information leakage that can potentially lead to exploits. |
Thanks for taking a look at this, @vpavic. We went back and forth on that one quite a bit. Since 2.5, the info endpoint is not exposed by default. When you expose it over HTTP and you're using Spring Security, it is secured by default. In the end, we concluded that should be sufficient. |
Yes, I'm aware of However, I wouldn't conflate the secure setting with enabling individual contributors that might be source of information leakage. IMO anything that can be categorized as such should be an opt-in feature with a dedicated configuration property. There are no such assumptions with, for example, error attributes (#7872) or favicon (#17925). Or even It's also important to take into consideration that many people expose their info endpoints to the public. Even Spring does that itself. So many have likely made adjustments upgrading to 2.5 (where Finally, but admittedly very much my personal take that many others might not share depending on environments they run their applications in, I really don't see value in this being enabled by default. If I have at least some control over the runtime infrastructure, or am running containers, I pretty much control the JVM runtime so I don't need an application endpoint to tell me details about it as it was a conscious choice. So putting it out there can only be a risk of some kind. |
I think I share some of your concerns this being enabled by default vs. opt-in but I disagree with this:
The whole idea behind this feature (at least from my side) is making applications more observable so that we can detect things that should never ever happen but somehow they do, e.g.: you think you use a certain Java version because you have control over it and set it explicitly but somehow you end-up with a different version. Let me give you a few examples, I saw every single one of them in production:
From my perspective: if I have at least some control over the runtime infrastructure, or am running containers, I should control the JVM runtime but in fact I don't control it 100% and I never will so I need something (like an application endpoint) to tell me details about it so that I can verify. |
We're going to flip the default. See #28310 (we couldn't reopen this PR because the branch is gone) |
Thanks @philwebb. @jonatan-ivanov I acknowledge that things you listed can happen but most of those are IMO simply negligence of core (software) engineering principles like reproducibility. Builds should be reproducible and the same goes for infra setup/scripting. So I believe that education on those principles is what addresses the listed issues, not another putting another potential problem (information leakage) on top of it. |
I agree with you on this wholeheartedly except the very end: no matter what you do, software is insanely complex and we are all humans, we all make mistakes, you can't really avoid it (sometimes software and also hardware make mistakes too). This is why we have logs, metrics, distributed tracing, this is why write tests, and also this is why we have Spring Boot Actuator. You can call it information leakage but I would call it "observability" instead. |
I don't think anyone argued in the direction of not having it at all - this can certainly be helpful in some cases. |
@jonatan-ivanov how do you see it regarding
However, the Java version I actually use is: Do you think that exposing |
@dmengelt I don't quite remember why didn't I include Let me re-run the tests tonight and get back to you (you can find them here if you are curious, see |
I re-ran the tests against 35 images, TL;DR: it seems only the Corretto 11 and 17 images has some value that provide extra information (maybe the Zulu 11 and 17 images too but I'm not sure, see below). Based on this I can see why past me did not include it but, since it can make sense in some cases, I think at least it worth to ask the Boot Team in an issue (should be fairly easy to implement but it could potentially change the response: Details
|
One more thing, I found: it seems this was introduced in JEP-322 (Java 10) but they wanted to remove it though the community found it useful so they kept it. With the comments on that issue I would say that the property makes sense for the Zulu and the Corretto images and might make sense for more distributions in the future. |
thanks @jonatan-ivanov |
Thanks very much for the extensive research, @jonatan-ivanov. |
Are there any particular reasons why |
I can't see much benefit in knowing |
This
InfoContributor
add Java-related details to actuator's info endpoint as part of the Enhanced Observability effort: #25476When configured, it looks like this:
If you are curious what would this look like on other OpenJDK distributions or using native-image, I tested 30+ of the most popular OpenJDK images (latest and current LTS), you can see the results in this public gist:
java-info.md
. You can see where the values above are different (e.g.: different java and vm vendors or different jre and vm versions, etc.)If you want to run your own tests, please take a look at this repo: https://github.com/jonatan-ivanov/app-info
A couple of notes regarding these changes:
JavaInfoContributor
is auto-configured by defaultMap<String,Object>
in theInfoContributor