Add OCI skills registry client for push/pull operations#20
Merged
Conversation
Implement the RegistryClient interface with an ORAS-based Registry type that supports pushing and pulling skill OCI artifacts to/from registries (GHCR, ECR, Docker Hub, etc.). Key design choices: - Functional options (WithPlainHTTP, WithCredentialStore) for library use - sizeLimitedStore uses explicit composition (not embedding) to avoid exposing unguarded write methods on the underlying memory.Store - Defense-in-depth size enforcement: sizeLimitedStore checks during oras.Copy, plus re-validation when reading back from memory - Manifest/layer count limits (32 manifests per index, 64 layers per manifest) to prevent resource exhaustion from fan-out attacks - Negative descriptor size rejection - Injectable newTarget factory enables integration testing with in-memory stores instead of requiring a real HTTP registry Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace ~350 lines of manual staging/storing code with ORAS's built-in oras.CopyGraph (push) and oras.Copy (pull). Introduce storeAdapter to bridge the local Store with ORAS content interfaces. Key changes: - storeAdapter wraps Store, routing by media type to PutManifest/PutBlob - validatingTarget enforces size/count limits on the pull path - oras.CopyGraph handles recursive graph traversal for push - oras.Copy handles recursive pull with automatic tagging - Removed SetPlainHTTP mutable setter (WithPlainHTTP option suffices) - Removed all manual staging/storing helpers Review findings addressed: - Compile-time interface assertions for storeAdapter and validatingTarget - Exists distinguishes not-found from real I/O errors - Digest integrity verification in both storeAdapter and validatingTarget - Size cap on storeAdapter.Push (defense-in-depth) - Comment clarifying double-tag behavior in Pull Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
rdimitrov
approved these changes
Feb 6, 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
RegistryClientinterface with an ORAS-basedRegistrytype for pushing/pulling skill OCI artifacts to/from registries (GHCR, ECR, Docker Hub, etc.)oras.CopyGraphandoras.Copyfor recursive content traversal instead of reimplementing the graph walk manuallystoreAdapterthat bridges the localStorewith ORAS content interfaces, and avalidatingTargetwrapper for security enforcement on the pull pathDesign
storeAdapterwraps*Storeto satisfyoras.Target:Push/Fetch/Existsby media type toPutManifest/GetManifestvsPutBlob/GetBlobResolvereads manifest content to build a fullocispec.DescriptorvalidatingTargetwraps anyoras.Targetwith security validation on Push:Registryuses functional options (WithPlainHTTP,WithCredentialStore) and an injectablenewTargetfactory for testability.Testing
newTargetfactory allows integration tests to usememory.Storeas a mock registry — no HTTP server neededstoreAdapterunit tests for Push/Fetch/Exists/Resolve/TagvalidatingTargettests for oversized content, lying descriptors, negative size, and manifest count limitst.Context()andt.Parallel()Dependencies added
oras.land/oras-go/v2— ORAS library for registry operationsgithub.com/opencontainers/image-spec— OCI descriptor/manifest typesTest plan
taskpasses (lint + test, 0 issues)task license-checkpassesCloses #15
🤖 Generated with Claude Code