Skip to content
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

Management endpoint access and enabled properties are ignored unless the endpoint ID is an exact match #43302

Closed
francisco-bru opened this issue Nov 27, 2024 · 3 comments
Assignees
Labels
type: bug A general bug
Milestone

Comments

@francisco-bru
Copy link

francisco-bru commented Nov 27, 2024

I'm migrating to 3.4.0 version and I apreciate that management.endpoints.enable-by-default and management.endpoint.id.enabled are deprecated as it says in the release notes.

In these release notes it appears that there are 3 values for the new access properties: none, read-only and unrestricted. However, in the release documentation, the ‘disabled’ is indicated, but disabled is not a valid value:

Caused by: java.lang.IllegalArgumentException: No enum constant org.springframework.boot.actuate.endpoint.Access.disabled

In my application I have an endpoint running with the following configuration:

management.endpoints.enabled-by-default=false
management.endpoint.foo.enabled=true

However when migrating to version 3.4 this endpoint is no longer exposed.
I thought that being deprecated properties and not deleted, I should not make changes yet.
Anyway I have made the following changes:

management.endpoints.access.default=none
management.endpoint.foo.access=unrestricted

and the enpoint is still not exposed.
I have only been able to expose it with the following configuration:

management.endpoints.access.default=unrestricted

But, this is not the correct behaivor.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 27, 2024
@wilkinsona
Copy link
Member

However, in the release documentation, the ‘disabled’ is indicated, but disabled is not a valid value

Sorry, that's a mistake in the docs. It should be none rather than disabled. We'll correct it.

I can't reproduce the runtime behavior that you have described. For example, these properties work for me:

management.endpoints.web.exposure.include=*
management.endpoints.enabled-by-default=false
management.endpoint.foo.enabled=true

The foo endpoint is the only endpoint that's available.

These properties also work for me:

management.endpoints.web.exposure.include=*
management.endpoints.access.default=none
management.endpoint.foo.access=unrestricted

I've tested both with @ConditionalOnAvailableEndpoint and without and the behavior's the same.

If you would like us to spend some more time investigating, please spend some time providing a complete yet minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.

@wilkinsona wilkinsona added the status: waiting-for-feedback We need additional information before we can continue label Nov 27, 2024
@francisco-bru
Copy link
Author

francisco-bru commented Nov 27, 2024

I seem to have found the problem. The bug occurs depending on the endpoint identifier.

That is, if the endpoint identifier was: ‘fooVar’, in the previous version 3.3.6, the following properties were accepted as valid:

management.endpoint.foo-var.enabled=true
management.endpoint.fooVar.enabled=true

However, in version 3.4, only this property is valid:

management.endpoint.fooVar.enabled=true

demo.zip

Another behaviour changed is that in previous version when you have @RestContollerEndpoint (Deprecated):

management.endpoints.enabled-by-default=false
# foo endpoint enabled property not set
# management.endpoint.foo.enabled=true

The endpoint is exposed
However, in version 3.4, the endpoint is not exposed.

I think that in this case, 3.4 fixes the previous behaviour.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Nov 27, 2024
@wilkinsona wilkinsona changed the title SB 3.4.0 management endpoints properties migration doesn't seem work properly Management endpoint access and enabled properties are ignored unless the endpoint ID is an exact match Nov 28, 2024
@wilkinsona wilkinsona added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged status: feedback-provided Feedback has been provided labels Nov 28, 2024
@wilkinsona wilkinsona added this to the 3.4.x milestone Nov 28, 2024
@wilkinsona wilkinsona self-assigned this Nov 28, 2024
@wilkinsona
Copy link
Member

Thanks for the sample. I've now reproduced the problem.

I think that in this case, 3.4 fixes the previous behaviour.

We agree. This was raised in #42987 which led to an update to the release notes being made to describe the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants