Add sandbox hash subcommand to resandbox by sha256/sha1/md5#236
Merged
Conversation
The existing `sandbox instance` subcommand requires an opaque numeric artifact-instance id, which forces a two-step `search hash` → `sandbox instance` workflow when you already have the hash in hand. This adds a `sandbox hash` subcommand that resolves the hash to its latest artifact instance under the hood and submits that instance. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
sbneto
approved these changes
May 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
polyswarm sandbox hash <provider> <sha256|sha1|md5>so a known sample can be resandboxed by hash without first runningsearch hashto pull out an artifact-instance id.ArtifactInstanceviaapi.search_hashes(next(iter(...))so we don't drain the full list), then forwards that instance id to the existingapi.sandbox_instancespath.sandbox instance's flag surface (--vm_slug,--internet-disabled) and accepts-r/--hash-file/--hash-typelikesearch hash.ClickException.Motivation
The sandbox-submission surface is confusing:
sandbox instanceexpects an artifact-instance id (ArtifactInstance.id), but the CLI argument is namedartifact-id,Polyswarm.sandbox(...)takesinstance_id, and the request body sends the value asartifact_id. cc @sbneto — same value, three names depending on where you stand; worth reconciling on the API/server side too.Test plan
polyswarm sandbox hash --helprenders.polyswarm sandbox hash <provider> <known-sha256>submits and returns a sandbox task.No artifact instances found for hash ….-r fileboth work.--internet-disabledand--vm_slugare forwarded.tests/cli_test.py::SandoxTest.