toolcap

package
v0.1.19 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package toolcap provides capability probing for epack tools.

This package provides a single, canonical implementation for querying --capabilities from tool binaries. It consolidates duplicate implementations from internal/tool/probe.go and internal/dispatch/executor.go.

SECURITY:

  • Uses restricted environment to prevent secret exfiltration during probes
  • Uses bounded output capture to prevent OOM from malicious tools
  • Validates JSON for duplicate keys to prevent ambiguous overrides
  • Uses BuildRestrictedEnvSafe to strip proxy credentials

Index

Constants

View Source
const MaxResponseBytes = 64 * 1024

MaxResponseBytes is the maximum size of --capabilities response (64KB). This prevents untrusted tool binaries from causing OOM by returning huge responses.

View Source
const Timeout = 5 * time.Second

Timeout is the maximum time to wait for --capabilities response.

Variables

This section is empty.

Functions

func Probe

func Probe(ctx context.Context, binaryPath string) (*toolprotocol.Capabilities, error)

Probe runs --capabilities on a tool binary and parses the JSON response. Sets EPACK_MODE=capabilities to signal the tool that this is a probe, not execution.

SECURITY:

  • Uses restricted environment to prevent secret exfiltration during probes
  • Uses bounded output capture to prevent OOM from malicious tools
  • Uses BuildRestrictedEnvSafe to strip proxy credentials from untrusted binaries
  • Validates JSON for duplicate keys to prevent ambiguous capability overrides

func ProbeWithBackground

func ProbeWithBackground(binaryPath string) (*toolprotocol.Capabilities, error)

ProbeWithBackground is a convenience wrapper that uses context.Background().

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL