Skip to content

feat: configure HTTP and FastCGI UNIX socket attributes - #284

Merged
rustatian merged 8 commits into
masterfrom
feat/unix-socket-permissions
Sep 7, 2026
Merged

feat: configure HTTP and FastCGI UNIX socket attributes#284
rustatian merged 8 commits into
masterfrom
feat/unix-socket-permissions

Conversation

@rustatian

Copy link
Copy Markdown
Member

Part of roadrunner-server/roadrunner#1789.

  • Add independent http.unix_socket and http.fcgi.unix_socket settings for mode, UID, and GID.
  • Use tcplisten v1.6.0 and its shared schema. Omitted settings keep the current defaults.
  • Reject malformed ownership values before weak configuration decoding can convert them.
  • Close the actual FastCGI listener during shutdown, including concurrent startup and stop.

These settings apply only to filesystem UNIX listeners. HTTPS, HTTP/3, ACME, and worker credentials remain unchanged.

Copilot AI lite review requested due to automatic review settings September 6, 2026 21:53
@codecov

codecov Bot commented Sep 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.44444% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 88.52%. Comparing base (3f95621) to head (e5a3b4d).

Files with missing lines Patch % Lines
servers/fcgi/fcgi.go 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #284      +/-   ##
==========================================
+ Coverage   88.34%   88.52%   +0.17%     
==========================================
  Files          29       30       +1     
  Lines        1347     1359      +12     
==========================================
+ Hits         1190     1203      +13     
+ Misses        157      156       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The new raw UID/GID validation uses architecture-dependent string parsing (strconv.IntSize), which can incorrectly reject otherwise valid IDs on 32-bit builds.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds independent UNIX socket attribute configuration (mode/uid/gid) for both the plain HTTP and FastCGI listeners, upgrades to tcplisten v1.6.0 (and its shared schema), and improves FastCGI shutdown semantics to reliably close the underlying listener (including during concurrent start/stop).

Changes:

  • Introduce http.unix_socket and http.fcgi.unix_socket config blocks, with early raw UID/GID validation to avoid weak-decoding surprises.
  • Pass UNIX socket options into listener creation (tcplisten.CreateListenerWithOptions) for HTTP/1.1 and FastCGI, and ensure FastCGI closes the real listener on shutdown.
  • Update JSON schema and add extensive tests for decode/validation, ownership handling, and UNIX-socket serving.
File summaries
File Description
tests/unix_socket_test.go New integration-style tests covering config decode, ownership validation, FastCGI UNIX socket serving, and plugin serving over UNIX sockets.
tests/go.mod Bumps tcplisten dependency to v1.6.0 for the tests module.
tests/go.sum Updates sums for tcplisten v1.6.0 in the tests module.
servers/unix_socket_test.go New server-level tests validating UNIX socket ownership/mode behavior across HTTP/1.1, h2c, and FastCGI.
servers/https/https_test.go Aligns expected error text casing (“invalid protocol”).
servers/http11/http.go Threads UNIX socket options into listener creation via CreateListenerWithOptions.
servers/fcgi/fcgi.go Adds synchronized listener lifecycle tracking and closes the actual listener during shutdown (including concurrent start/stop).
servers/fcgi/fcgi_test.go Adds concurrency and shutdown behavior tests for FastCGI server stop/serve interactions and unexpected listener close.
servers/fcgi/config.go Adds unix_socket options to FastCGI config plus validation wrapper.
schema.json References tcplisten v1.6.0 schema for unix_socket and updates address descriptions/examples.
plugin_test.go Updates stub configurer Has behavior and extends per-section unmarshal error coverage to new unix_socket sections.
init.go Adds early raw UID/GID validation and explicit per-subsection unmarshalling for http.unix_socket and http.fcgi.unix_socket.
go.mod Bumps tcplisten dependency to v1.6.0.
go.sum Updates sums for tcplisten v1.6.0.
config/unix_socket_test.go New config-level tests for UNIX socket validation rules and independent HTTP vs FCGI unix_socket options.
config/config.go Adds UnixSocket field to HTTP config and validates both HTTP and FCGI UNIX socket options.
Review details
  • Files reviewed: 14/16 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread init.go Outdated
@rustatian rustatian self-assigned this Sep 7, 2026
@rustatian
rustatian merged commit 07e6c50 into master Sep 7, 2026
8 checks passed
@rustatian
rustatian deleted the feat/unix-socket-permissions branch September 7, 2026 14:45
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