-
Notifications
You must be signed in to change notification settings - Fork 12
feature: tls information for PHP worker #210
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
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Valery Piashchynski <[email protected]>
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing Touches🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds TLS information propagation to PHP workers by implementing a new TLS middleware that extracts TLS connection details and passes them via the RR_TLS_INFO
header. The middleware extracts comprehensive TLS information including version, cipher suite, certificates, and verification chains when a TLS connection is established.
Key changes:
- Added new TLS middleware that extracts and serializes TLS connection information
- Integrated the middleware into HTTP and HTTP3 server handlers
- Updated dependency checksums to reflect new package versions
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
middleware/tls_info.go | New middleware that extracts TLS connection details and adds them to request headers |
init.go | Integration of TLS middleware into HTTP and HTTP3 server request handling chains |
go.work.sum | Updated dependency checksums for various cloud and library packages |
|
||
tlsinfo, err := json.Marshal(info) | ||
if err != nil { | ||
log.Warn("failed to parse TLS info", zap.Error(err)) |
Copilot
AI
Jul 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message 'failed to parse TLS info' is misleading. JSON marshaling is being performed, not parsing. Consider changing to 'failed to marshal TLS info' for accuracy.
log.Warn("failed to parse TLS info", zap.Error(err)) | |
log.Warn("failed to marshal TLS info", zap.Error(err)) |
Copilot uses AI. Check for mistakes.
|
||
tlsinfo, err := json.Marshal(info) | ||
if err != nil { | ||
log.Warn("failed to parse TLS info", zap.Error(err)) |
Copilot
AI
Jul 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When JSON marshaling fails, the middleware continues execution without setting the TLS info header. This could lead to inconsistent behavior where some requests have TLS info and others don't during partial failures. Consider either returning early or setting a default/error indicator in the header.
log.Warn("failed to parse TLS info", zap.Error(err)) | |
log.Warn("failed to parse TLS info", zap.Error(err)) | |
r.Header.Add("RR_TLS_INFO", "error") | |
} else { | |
r.Header.Add("RR_TLS_INFO", string(tlsinfo)) |
Copilot uses AI. Check for mistakes.
|
||
r.Header.Add("RR_TLS_INFO", string(tlsinfo)) | ||
next.ServeHTTP(w, r) | ||
r.Header.Del("RR_TLS_INFO") |
Copilot
AI
Jul 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The header is deleted after calling next.ServeHTTP(), but if an error occurs during request processing, the header will still be deleted. Consider using defer to ensure cleanup happens regardless of how the request processing completes.
Copilot uses AI. Check for mistakes.
Reason for This PR
closes: https://github.com/orgs/roadrunner-server/discussions/2205
Description of Changes
RR_TLS_INFO
.License Acceptance
By submitting this pull request, I confirm that my contribution is made under
the terms of the MIT license.
PR Checklist
[Author TODO: Meet these criteria.]
[Reviewer TODO: Verify that these criteria are met. Request changes if not]
git commit -s
).CHANGELOG.md
.