Skip to content

RSPEED-2435: fix rh-identity health probe path matching with root_path#1147

Merged
tisnik merged 1 commit intolightspeed-core:mainfrom
major:mhayden/fix-health-probe-path
Feb 13, 2026
Merged

RSPEED-2435: fix rh-identity health probe path matching with root_path#1147
tisnik merged 1 commit intolightspeed-core:mainfrom
major:mhayden/fix-health-probe-path

Conversation

@major
Copy link
Contributor

@major major commented Feb 13, 2026

Summary

  • Fix health probe auth bypass in rh-identity auth plugin when root_path is configured

Problem

When root_path is set (e.g. /api/lightspeed), request paths become /api/lightspeed/liveness instead of /liveness. The skip_for_health_probes check in rh_identity.py uses an exact match (in ("/readiness", "/liveness")) which fails on the prefixed paths, causing health probes to get 401 and pods to crash-loop.

Fix

# Before
if request.url.path in ("/readiness", "/liveness"):

# After
if request.url.path.rsplit("/", 1)[-1] in ("readiness", "liveness"):

Matches only the final path segment — avoids false positives on paths like /api/v1/conversations/liveness.

Only the rh-identity auth plugin is affected — this is the only auth module used in our deployment.

Jira

https://issues.redhat.com/browse/RSPEED-2435

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 13, 2026

Warning

Rate limit exceeded

@major has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 6 minutes and 30 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Walkthrough

Changes the health-probe skip condition to use path suffix matching instead of exact equality, allowing requests ending with "/readiness" or "/liveness" to be skipped when skip_for_health_probes is enabled.

Changes

Cohort / File(s) Summary
Health Probe Authentication Skip
src/authentication/rh_identity.py
Modified path comparison from exact equality (==) to endswith() for health-probe endpoint detection, enabling pattern-based matching for readiness and liveness endpoints.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • tisnik
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: switching from exact path matching to endswith for health probe detection when root_path is configured.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@major major force-pushed the mhayden/fix-health-probe-path branch from 29fecd5 to 248a8a5 Compare February 13, 2026 14:43
@major major changed the title fix: use endswith for health probe path matching with root_path fix: use endswith for rh-identity health probe path matching with root_path Feb 13, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@src/authentication/rh_identity.py`:
- Around line 220-222: The current endswith check in the authentication bypass
(request.url.path.endswith(...)) is too permissive and allows any multi-segment
path that ends with "/readiness" or "/liveness" to skip auth; update the
condition used where
configuration.authentication_configuration.skip_for_health_probes is checked so
it only compares the last path segment (e.g., compute segment =
request.url.path.rstrip("/").split("/")[-1] and check segment in
("readiness","liveness")) before returning NO_AUTH_TUPLE; keep the existing
skip_for_health_probes flag and maintain support for arbitrary root_path
prefixes.

@major major force-pushed the mhayden/fix-health-probe-path branch from eac834e to 594a21a Compare February 13, 2026 15:02
@major major changed the title fix: use endswith for rh-identity health probe path matching with root_path RSPEED-2435: fix rh-identity health probe path matching with root_path Feb 13, 2026
When root_path is set (e.g. /api/lightspeed), the request path
becomes /api/lightspeed/liveness instead of /liveness. The exact
match fails and health probes get rejected with 401. Match only the
final path segment to handle any prefix.

Signed-off-by: Major Hayden <major@redhat.com>
@major major force-pushed the mhayden/fix-health-probe-path branch from 594a21a to 961d9c7 Compare February 13, 2026 15:05
Copy link
Contributor

@tisnik tisnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tisnik tisnik merged commit 310a8f2 into lightspeed-core:main Feb 13, 2026
20 of 21 checks passed
@major major deleted the mhayden/fix-health-probe-path branch February 13, 2026 15:32
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.

2 participants