Skip to content

Skills and plugins: bound memory and disk used by fetched content #7438

Backlog

Description

@rdimitrov

Summary
The size limits on skill and plugin content fetched from OCI registries and git repositories have gaps. A crafted artifact or repository can make thv use much more memory or disk than the limits suggest.

Current behaviour

  • Git: LimitedFs (pkg/git/fs.go) counts each symlink as a file but doesn't count the bytes stored for it in the in-memory filesystem.
  • OCI manifests: the 1 MB manifest cap and the layer and manifest count checks in toolhive-core oci/artifact/validate.go apply only to descriptors with a manifest media type. A child manifest declared with any other media type is stored under the 100 MB blob cap, and pkg/skills/skillsvc/oci.go then reads and unmarshals it.
  • OCI config: the image config blob has no cap of its own beyond the 100 MB blob cap, and pkg/skills/skillsvc/oci.go unmarshals it in full.
  • Tar extraction (toolhive-core): sparse entries count toward the stream cap by their size on the wire, but each one is expanded with io.ReadAll up to the per-file limit. The file-count limit is checked only after extraction (pkg/skills/installer.go).
  • Local store: content is pulled into the shared local OCI store before validation finishes, and artifacts that fail validation stay there. There is no total-size cap per artifact and no cleanup.

Proposed change

  • Count symlink bytes against the LimitedFs budget, or refuse symlinks in skill repositories.
  • Apply caps by what the content is, not only by its declared media type: enforce the manifest cap on anything parsed as a manifest, and add a small cap for config blobs.
  • Count the expanded size of sparse tar entries (or reject them), and enforce the file-count limit while extracting.
  • Pull into a temporary store and keep only artifacts that pass validation, or delete rejected ones; add a total-size cap per artifact.

Activity

  1. added
    bug
    skills
    on Dec 1, 2026
  2. added
    needs-triage
    on Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugneeds-triageregistrysecurityskills

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions