Skip to content

fix: extend digest verification to sha512 and set sandbox paths - #850

Open
ericcurtin wants to merge 1 commit into
mainfrom
address-comments
Open

ericcurtin wants to merge 1 commit into
mainfrom
address-comments

Conversation

@ericcurtin

Copy link
Copy Markdown
Contributor

Extend blob digest verification to cover sha512 in addition to sha256, closing a bypass where sha512-addressed blobs were stored without any integrity check. Set correct SandboxPath for Python backends (diffusers, mlx, vllm-metal) so the Darwin sandbox profile resolves UPDATEDLIBPATH to the sibling lib/ directory of the Python bin/ directory.

Extend blob digest verification to cover sha512 in addition to sha256,
closing a bypass where sha512-addressed blobs were stored without any
integrity check. Set correct SandboxPath for Python backends (diffusers,
mlx, vllm-metal) so the Darwin sandbox profile resolves UPDATEDLIBPATH
to the sibling lib/ directory of the Python bin/ directory.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • In WriteBlobWithResume, when diffID.Algorithm is neither sha256 nor sha512 the blob is now written without any integrity check; consider explicitly rejecting unsupported algorithms (or at least logging) instead of silently skipping verification.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `WriteBlobWithResume`, when `diffID.Algorithm` is neither `sha256` nor `sha512` the blob is now written without any integrity check; consider explicitly rejecting unsupported algorithms (or at least logging) instead of silently skipping verification.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for SHA-512 hashing in the blob store and updates the sandbox path configuration for several inference backends (Diffusers, MLX, and vLLM Metal) to ensure correct directory scoping. I have no feedback to provide.

ilopezluna
ilopezluna previously approved these changes Apr 8, 2026
@ilopezluna
ilopezluna self-requested a review April 8, 2026 14:06
@ilopezluna

ilopezluna commented Apr 8, 2026 •

Copy link
Copy Markdown
Contributor
ilopezluna@F2D5QD4D6C model-runner % docker model uninstall-runner --backend vllm     
Uninstalled vllm backend
ilopezluna@F2D5QD4D6C model-runner % docker model install-runner --backend vllm     
Installing vllm backend...
vllm backend installed successfully
ilopezluna@F2D5QD4D6C model-runner % docker model run smollm2-vllm                    
> hello
background model preload failed: preload failed: status=500 body=unable to load runner: error waiting for runner to be ready: vllm-metal terminated unexpectedly: vllm-metal failed: (APIServer pid=92759)     self.input_socket = self.resources.input_socket = make_zmq_socket(
(APIServer pid=92759)                                                       ^^^^^^^^^^^^^^^^
(APIServer pid=92759)   File "/Users/ilopezluna/.docker/model-runner/vllm-metal/lib/python3.12/site-packages/vllm/utils/network_utils.py", line 309, in make_zmq_socket
(APIServer pid=92759)     socket.bind(path)
(APIServer pid=92759)   File "/Users/ilopezluna/.docker/model-runner/vllm-metal/lib/python3.12/site-packages/zmq/sugar/socket.py", line 320, in bind
(APIServer pid=92759)     super().bind(addr)
(APIServer pid=92759)   File "zmq/backend/cython/_zmq.py", line 1009, in zmq.backend.cython._zmq.Socket.bind
(APIServer pid=92759)   File "zmq/backend/cython/_zmq.py", line 190, in zmq.backend.cython._zmq._check_rc
(APIServer pid=92759) zmq.error.ZMQError: Operation not permitted (addr='ipc:///var/folders/xy/2ylpqbs55c7233trwq3lpscm0000gp/T/eca66bed-bc55-41af-9950-e93de87ab5e0')
/v1/engine/core_client.py", line 562, in __init__


Failed to generate a response: error response: status=500 body=unable to load runner: error waiting for runner to be ready: vllm-metal terminated unexpectedly: vllm-metal failed: (APIServer pid=96473)     self.input_socket = self.resources.input_socket = make_zmq_socket(
(APIServer pid=96473)                                                       ^^^^^^^^^^^^^^^^
(APIServer pid=96473)   File "/Users/ilopezluna/.docker/model-runner/vllm-metal/lib/python3.12/site-packages/vllm/utils/network_utils.py", line 309, in make_zmq_socket
(APIServer pid=96473)     socket.bind(path)
(APIServer pid=96473)   File "/Users/ilopezluna/.docker/model-runner/vllm-metal/lib/python3.12/site-packages/zmq/sugar/socket.py", line 320, in bind
(APIServer pid=96473)     super().bind(addr)
(APIServer pid=96473)   File "zmq/backend/cython/_zmq.py", line 1009, in zmq.backend.cython._zmq.Socket.bind
(APIServer pid=96473)   File "zmq/backend/cython/_zmq.py", line 190, in zmq.backend.cython._zmq._check_rc
(APIServer pid=96473) zmq.error.ZMQError: Operation not permitted (addr='ipc:///var/folders/xy/2ylpqbs55c7233trwq3lpscm0000gp/T/53f30cd8-f4af-4372-812a-2ae34c103c08')
/v1/engine/core_client.py", line 562, in __init__

I get this error in vllm-metal

@ilopezluna
ilopezluna dismissed their stale review April 8, 2026 17:10

I have realized it fails when using vllm-metal

var hasher hash.Hash
switch diffID.Algorithm {
case "sha256":
hasher = sha256.New()

@sathiraumesh sathiraumesh Apr 9, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just a suggestion, It may be better to move this to a separate function like

hasher(string algo) (has.Hash){
...
}

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Unresolved blob verification bypasses and custom Python sandbox path issues remain.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity · 2 Medium severity · 1 Low severity

Open (4)
What changed in this PR

Extends blob integrity verification to SHA-512 and configures Darwin sandbox paths for Python backends.

Changes:

  • Adds SHA-512 blob verification.
  • Sets sandbox paths for MLX, Diffusers, and vLLM Metal.
File Summary Findings
pkg/​inference/​backends/​vllm/​vllm_metal.go Configures the vLLM Metal sandbox path. Moderate (4 votes): custom Python paths may remain outside the sandbox.
pkg/​inference/​backends/​mlx/​mlx.go Configures the MLX sandbox path. None.
pkg/​inference/​backends/​diffusers/​diffusers.go Configures the Diffusers sandbox path. None.
pkg/​distribution/​internal/​store/​blobs.go Adds SHA-512 verification. Critical (3 votes): one-byte responses can bypass verification. Moderate (2 votes): resume logic still assumes SHA-256. Nit (4 votes): add SHA-512 success, mismatch, and cleanup tests.

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

case "sha512":
hasher = sha512.New()
}
if hasher != nil {
Comment on lines +281 to +287
var hasher hash.Hash
switch diffID.Algorithm {
case "sha256":
hasher = sha256.New()
case "sha512":
hasher = sha512.New()
}
Socket: socket,
BinaryPath: v.pythonPath,
SandboxPath: v.installDir,
SandboxPath: filepath.Join(v.installDir, "bin"),
Comment on lines +285 to +286
case "sha512":
hasher = sha512.New()

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Unresolved moderate findings affect SHA-512 integrity handling and custom Python sandbox paths.

Review effort: Lite
Findings: 1 High severity · 2 Medium severity · 1 Low severity

Open (4)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

SHA-512 resume handling, test coverage, and custom Python sandbox paths remain unresolved.

Review effort: Lite
Findings: 1 High severity · 2 Medium severity · 1 Low severity

Open (4)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Digest finalization has a bypass, SHA-512 lacks coverage, and custom vLLM interpreters are not correctly sandboxed.

Review effort: Lite
Findings: 1 High severity · 2 Medium severity · 1 Low severity

Open (4)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Unresolved SHA-512 resume/publish verification issues, missing regression coverage, and an incorrect custom Python sandbox path remain.

Review effort: Lite
Findings: 1 High severity · 2 Medium severity · 1 Low severity

Open (4)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

SHA-512 verification remains bypassable or unsupported in key flows, and the custom vLLM Python path and test coverage need fixes.

Review effort: Lite
Findings: 2 High severity · 2 Medium severity · 1 Low severity

Open (5)

Comment on lines +282 to +286
switch diffID.Algorithm {
case "sha256":
hasher = sha256.New()
case "sha512":
hasher = sha512.New()

This branch has not been deployed

No deployments
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.

4 participants