Skip to content

Add logdispatch.health.enabled property to allow opting out of the health endpoint - #46

Merged
Mahesh-Langote merged 2 commits into
Mahesh-Langote:mainfrom
MakerYuichi:25-health-endpoint-opt-out
Aug 12, 2026
Merged

Add logdispatch.health.enabled property to allow opting out of the health endpoint#46
Mahesh-Langote merged 2 commits into
Mahesh-Langote:mainfrom
MakerYuichi:25-health-endpoint-opt-out

Conversation

@MakerYuichi

Copy link
Copy Markdown
Contributor

Description

The /logdispatch/health endpoint was always registered on any application
using this SDK, with no way to disable it. This meant unauthenticated
requests could always query startup time and uptime, and applications with
strict "no unauthenticated public endpoints" policies (e.g. Spring Security,
API gateways) had no way to opt out short of forking the library.

This PR adds a new logdispatch.health.enabled property (default true,
non-breaking) that, when set to false, prevents the
LogDispatchHealthController bean from being registered at all — so the
endpoint doesn't exist rather than responding with a "disabled" status.
Requests to /logdispatch/health return a plain 404 when disabled, the
same as any other undefined route. The associated rate limiter is skipped
automatically as a result, since it only runs inside the controller.

Fixes #25

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Unit Test A
  • Manual Application Test

Added two new tests to LogDispatchAutoConfigurationTest:

  • shouldNotRegisterHealthControllerWhenHealthDisabled — confirms the
    LogDispatchHealthController bean is absent from the Spring context
    when logdispatch.health.enabled=false.
  • shouldRegisterHealthControllerByDefaultWhenHealthPropertyMissing
    confirms the bean is still registered by default when the property
    is unset, preserving existing behavior.

Full suite run locally: 30/30 tests passing (./mvnw clean test).

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@Mahesh-Langote
Mahesh-Langote merged commit 6a2a027 into Mahesh-Langote:main Aug 12, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] /logdispatch/health Endpoint is Publicly Exposed with No Opt-Out

2 participants