Always render the port in the HttpWaitStrategy probe URI - #12098
bunnysayzz wants to merge 1 commit into
Conversation
buildLivenessUri dropped the port suffix when the mapped check port was 80 (plain HTTP) or 443 (TLS). That elision is only valid when host:<port> really is the mapped service, which cannot be assumed here: with custom WaitStrategyTarget implementations or proxied environments the resolved check port can be 443 while the service is not at https://host/, silently probing the wrong endpoint. An explicit port is also what the "un-map the port for logging" path relies on: URI.getPort() returns -1 when the port is elided, which breaks the exposed-port lookup and trips the "Unexpected error occurred" warning on every wait. Fixes testcontainers#12096.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthrough
ChangesHTTP liveness URI
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~5 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to Probe URIs now retain the configured port, including default ports. No concrete remaining failure is established, so the change appears ready for normal CI. Security Architecture ReviewSecurity architecture risk: ⚪ Minimal · up to The change makes the existing probe port explicit without introducing a new destination source or weakening connection security. Standard HTTP and HTTPS default-port destinations remain equivalent, and no material security risk was identified in the changed behavior. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
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. Comment |
Fixes #12096.
buildLivenessUridropped the port suffix when the resolved check port was 80 (plain HTTP) or 443 (TLS). That elision is only valid whenhost:<port>really is the mapped service, which cannot be assumed here: with customWaitStrategyTargetimplementations or proxied environments the resolved check port can be 443 while the service is not athttps://host/, silently probing the wrong endpoint.It also broke the port un-mapping in the log line:
URI.getPort()returns -1 when the port is elided, so the exposed-port lookup threwIllegalStateException(caught, but every wait logged "Unexpected error occurred").This always renders the explicit port. In the standard case
https://host:443/pathconnects exactly likehttps://host/path, so no behavior change there, and the logged/timeout URIs now show the port actually being probed.Could not compile locally (no JDK on this machine); relying on CI for the build.
Summary by CodeRabbit