Skip to content

update crc-org/machine module to latest main#130

Merged
praveenkumar merged 1 commit into
crc-org:mainfrom
anjannath:bump-machine
Jul 24, 2026
Merged

update crc-org/machine module to latest main#130
praveenkumar merged 1 commit into
crc-org:mainfrom
anjannath:bump-machine

Conversation

@anjannath

@anjannath anjannath commented Jul 23, 2026

Copy link
Copy Markdown
Member

this adds RPC logs and switches the RPC server
to listen on unix socket rather than TCP socket

Summary by CodeRabbit

  • Security & Reliability

    • Improved local driver communication by using protected Unix socket connections instead of temporary network ports.
    • Added stricter socket and directory permissions.
  • Diagnostics

    • Added structured logging for driver operations and RPC connection activity, including connection duration and configuration details.
  • Maintenance

    • Updated the bundled machine driver component to a newer version.

this adds RPC logs and switches the RPC  server
to listen on unix socket rather than TCP socket

Signed-off-by: Anjan Nath <kaludios@gmail.com>
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The vendored machine dependency is updated. Plugin RPC transport moves from localhost TCP to secured Unix sockets, with connection lifecycle logging and structured logging across RPC server operations.

Changes

RPC transport and observability

Layer / File(s) Summary
Machine dependency and API sync
go.mod, vendor/modules.txt, vendor/github.com/crc-org/machine/libmachine/drivers/base.go
The machine dependency is pinned to a newer commit, vendor metadata is synchronized, and the unused base-driver parameter is marked explicitly.
Unix socket RPC transport
vendor/github.com/crc-org/machine/libmachine/drivers/plugin/register_driver.go, vendor/github.com/crc-org/machine/libmachine/drivers/rpc/client_driver.go
Plugin registration creates an owner-restricted Unix socket and the RPC client dials it instead of using an ephemeral TCP listener.
RPC connection and method logging
vendor/github.com/crc-org/machine/libmachine/drivers/plugin/register_driver.go, vendor/github.com/crc-org/machine/libmachine/drivers/rpc/server_driver.go
Connection acceptance and closure, RPC operations, configuration byte counts, machine context, and shared-directory counts are logged structurally.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant RegisterDriver
  participant UnixSocket
  participant NewRPCClientDriver
  participant RPCServerDriver
  RegisterDriver->>UnixSocket: create secured plugin.sock listener
  NewRPCClientDriver->>UnixSocket: rpc.DialHTTP("unix", addr)
  UnixSocket->>RPCServerDriver: serve HTTP RPC request
  RPCServerDriver-->>NewRPCClientDriver: return RPC response
Loading

Poem

I’m a rabbit with sockets tucked neat,
Unix paths make the RPC fleet.
Logs hop and sparkle, connections keep time,
Config bytes march in a measured line.
Thump-thump, the vendored code is bright!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: updating crc-org/machine to the latest main branch.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Checkov (3.3.8)
go.mod

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'

🔧 golangci-lint (2.12.2)

Error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions
The command is terminated due to an error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions


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.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@vendor/github.com/crc-org/machine/libmachine/drivers/plugin/register_driver.go`:
- Around line 71-92: The RegisterDriver socket setup must avoid the shared
default crc-machine/plugin.sock when multiple plugin client/server pairs run
concurrently. Update localbinary.Executor.Start and RegisterDriver to create or
propagate a unique CRC_SOCKET_DIR (or equivalent unique socket address) per
plugin instance, and ensure the client consumes the same printed address; retain
the existing directory validation for the selected path.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3c875bf2-d063-44fc-9f4f-b39c928c2c34

📥 Commits

Reviewing files that changed from the base of the PR and between e49656e and 4fe54d6.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (6)
  • go.mod
  • vendor/github.com/crc-org/machine/libmachine/drivers/base.go
  • vendor/github.com/crc-org/machine/libmachine/drivers/plugin/register_driver.go
  • vendor/github.com/crc-org/machine/libmachine/drivers/rpc/client_driver.go
  • vendor/github.com/crc-org/machine/libmachine/drivers/rpc/server_driver.go
  • vendor/modules.txt

Comment on lines +71 to +92
socketDir := os.Getenv("CRC_SOCKET_DIR")
if socketDir == "" {
socketDir = filepath.Join(os.TempDir(), "crc-machine")
}

if err := os.MkdirAll(socketDir, 0700); err != nil {
fmt.Fprintf(os.Stderr, "Error creating socket directory: %s\n", err)
os.Exit(1)
}
socketDirInfo, err := os.Stat(socketDir)
if err != nil {
fmt.Fprintf(os.Stderr, "Error checking socket directory: %s\n", err)
os.Exit(1)
}
if !socketDirInfo.IsDir() || socketDirInfo.Mode().Perm()&0077 != 0 {
fmt.Fprintf(os.Stderr, "Socket directory must be owner-only: %s\n", socketDir)
os.Exit(1)
}

socketPath := filepath.Join(socketDir, "plugin.sock")
os.Remove(socketPath)
listener, err := net.Listen("unix", socketPath)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Map the plugin-launcher implementation before inspecting its environment handling.
fd -t f -e go . vendor/github.com/crc-org/machine/libmachine/drivers/plugin/localbinary \
  -x ast-grep outline {} --items all

# Confirm whether each launched plugin receives a unique CRC_SOCKET_DIR.
rg -n -C 5 'CRC_SOCKET_DIR|func NewPlugin|func .*Address' \
  vendor/github.com/crc-org/machine/libmachine/drivers/plugin/localbinary \
  vendor/github.com/crc-org/machine/libmachine/drivers/rpc

Repository: crc-org/machine-driver-libvirt

Length of output: 4033


Use isolated socket paths per plugin client/server pair.

localbinary.Executor.Start() only launches the driver binary and sets driver-specific env vars, while RegisterDriver always creates crc-machine/plugin.sock. Concurrent clients can start with the same default socket path and os.Remove/Listen can replace another driver’s listener before the client reads the printed address. Pass/create CRC_SOCKET_DIR or a unique address for each plugin and have the plugin print/consume that unique address.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@vendor/github.com/crc-org/machine/libmachine/drivers/plugin/register_driver.go`
around lines 71 - 92, The RegisterDriver socket setup must avoid the shared
default crc-machine/plugin.sock when multiple plugin client/server pairs run
concurrently. Update localbinary.Executor.Start and RegisterDriver to create or
propagate a unique CRC_SOCKET_DIR (or equivalent unique socket address) per
plugin instance, and ensure the client consumes the same printed address; retain
the existing directory validation for the selected path.

Comment thread go.mod

require (
github.com/crc-org/machine v0.0.0-20240926103419-a943b47fd48b
github.com/crc-org/machine v0.0.0-20260721135927-5bcb8a00e0f1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍🏼

@praveenkumar
praveenkumar merged commit 27b4b97 into crc-org:main Jul 24, 2026
2 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.

2 participants