fix: extend digest verification to sha512 and set sandbox paths - #850
ericcurtin wants to merge 1 commit into
Conversation
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.
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In
WriteBlobWithResume, whendiffID.Algorithmis neithersha256norsha512the 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.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
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.
I get this error in vllm-metal |
I have realized it fails when using vllm-metal
| var hasher hash.Hash | ||
| switch diffID.Algorithm { | ||
| case "sha256": | ||
| hasher = sha256.New() |
There was a problem hiding this comment.
Just a suggestion, It may be better to move this to a separate function like
hasher(string algo) (has.Hash){
...
}
There was a problem hiding this comment.
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
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 { |
| 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"), |
| case "sha512": | ||
| hasher = sha512.New() |
| switch diffID.Algorithm { | ||
| case "sha256": | ||
| hasher = sha256.New() | ||
| case "sha512": | ||
| hasher = sha512.New() |



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.