agentleFS
luckyPipewrenchluckyPipewrench/pipelock/AGENTS.md

pipelock

AGENTS.md921 starsChanged 2 months agoApache-2.0View on GitHub

Pipelock is an agent firewall: a network and tool proxy that mediates AI-agent HTTP, WebSocket, and MCP traffic and scans it for secret exfiltration, prompt injection, SSRF, and tool poisoning. Direct egress controls are deployment guidance; binary-enforced coverage applies to mediated traffic. Configured MCP upstreams are an exception to private-address SSRF blocking: local/private servers are allowed, but cloud metadata endpoints remain blocked. The code-checked capability manifest is docs/security/capability-manifest.json. It lists the operator entry point and license gate for each surface…

  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repositoryOne other file it gives its agents.

The file

We split this AGENTS.md into the rules it gives an agent

4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Prefer table-driven tests with t.Run.

    line 192
  2. Distinctive:

    Avoid stuttered exported names.

    line 193
  3. Distinctive:

    Use shared helpers when duplicated paths have the same security meaning.

    line 194
  4. Very specific:

    Prefer existing constants such as config.Action*, config.Mode*, and config.Severity*.

    line 197

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md - Pipelock Contributor Guide

Pipelock is an agent firewall: a network and tool proxy that mediates AI-agent HTTP, WebSocket, and MCP traffic and scans it for secret exfiltration, prompt injection, SSRF, and tool poisoning. Direct egress controls are deployment guidance; binary-enforced coverage applies to mediated traffic. Configured MCP upstreams are an exception to private-address SSRF blocking: local/private servers are allowed, but cloud metadata endpoints remain blocked.

Quick Reference

ItemValue
Modulegithub.com/luckyPipewrench/pipelock
Go1.26+; CI tests Go 1.26 and 1.27
LicenseApache 2.0 core, ELv2 under enterprise/
BinarySingle Go binary; size varies by OS, build tags, and release flags
DependenciesSee go.mod. Run make stats before citing the current direct-dependency count.
<!-- BEGIN capability-manifest (generated; run go generate ./internal/capabilitymanifest) -->

Capability surface

The code-checked capability manifest is docs/security/capability-manifest.json. It lists the operator entry point and license gate for each surface below. Free means no license feature is required.

CapabilityAccessOperator entry pointPlatform or deployment qualifier
HTTP, WebSocket, and proxy mediationFreepipelock runApplies only to traffic routed through Pipelock; direct agent egress needs containment or network policy.
MCP proxy scanningFreepipelock mcp proxyApplies only to MCP transports that run through the Pipelock proxy.
Signed action receiptsFreeflight_recorder
Host containment for agent processesFreepipelock containKernel-enforced containment requires Linux, a private network namespace, nftables, and the managed identities. The recommended unprivileged systemd service emits signed pre-launch posture from a root signer that verifies its own managed namespace and proxy doorway; contain run instead signs a host-side preflight and also emits a post-session workspace statement.
Single-agent process sandboxFreepipelock sandboxKernel isolation requires Linux user namespaces. Without them, best-effort network isolation only sets HTTP(S)_PROXY; seccomp adds restrictions only on linux/amd64.
Global canary tokensFreecanary_tokens
Named agent profilesProagents.<profile>
Per-agent sandbox overridesProagents.<profile>.sandbox
Per-agent crypto address allowlistsProagents.<profile>.allowed_addresses
Read-only operator dashboardPro or Enterprisepipelock dashboard serve
Full assessment artifactsAssesspipelock assess finalize
Conductor fleet coordinationEnterprisepipelock conductor serve
Per-agent coverage certificatesPropipelock dashboard coverage-cert generate
Exemption lifecycle recordsPropipelock dashboard exemption list
Legal-hold metadataPropipelock dashboard legal-hold list
Fleet audit sinkEnterprisepipelock fleet-sink
Fleet receipt reportsEnterprisepipelock conductor fleet report
Emergency kill switchFreekill_switch
Rule bundlesFreerules
Adaptive enforcementFreeadaptive_enforcement
TLS interceptionFreetls_interceptionRequires a configured local CA that the intercepted client trusts; passthrough traffic remains encrypted and cannot be body-scanned.
A2A protocol scanningFreea2a_scanningApplies to A2A traffic carried on Pipelock's supported forward-proxy and MCP HTTP paths.
Browser shieldFreebrowser_shieldApplies only to supported browser response traffic that flows through Pipelock. JavaScript responses are scanned but not rewritten.
Offline receipt verificationFreepipelock verify-receipt
Verdict explanationsFreepipelock explain
Deployment diagnosticsFreepipelock doctor
<!-- END capability-manifest -->

Build, Test, Lint

make build          # Compile with version ldflags
make test           # Run the OSS race suite as sequential CI-shaped shards
make test-cover     # Write coverage.html
make lint           # go vet + golangci-lint v2 + gofumpt check
make bench          # Scanner and MCP benchmarks
make fmt            # gofumpt via the pinned golangci-lint formatter
make vet            # Static analysis
make tidy-check     # Verify go.mod/go.sum
make docker         # Docker image
make stats          # Canonical local stats for docs

Pre-commit parity for OSS and enterprise builds:

golangci-lint run --new-from-rev=HEAD ./...
golangci-lint run --build-tags enterprise --new-from-rev=HEAD ./...
make test
make test-sharded-enterprise

Full-repo CI-equivalent lint:

golangci-lint run ./...
golangci-lint run --build-tags enterprise ./...

Architecture

Capability separation is part of the design: agent environments can hold secrets and route traffic through Pipelock; the proxy has network egress and does not store agent credentials. Pipelock reads local environment values for leak detection only.

Three proxy modes share the main listener:

  • Fetch (/fetch?url=...): fetches a URL, extracts text, and scans responses for injection.
  • Forward proxy (CONNECT and absolute-URI): standard HTTP proxy mode; hostnames enter the scanner pipeline.
  • WebSocket (/ws?url=...): bidirectional frame scanning, header DLP, and fragment reassembly.

Scanner Pipeline

internal/scanner/scanner.go is the source of truth. Max URL length is checked before parsing. After parsing and hostname canonicalization, URL scanning currently runs:

  1. Scheme (http/https)
  2. CRLF injection
  3. Path traversal
  4. Strict-mode allowlist
  5. Domain blocklist
  6. Core SSRF literal-IP floor, including private and metadata IP literals
  7. SigV4 presigned-URL credential carve-out
  8. Core DLP immutable floor
  9. DLP (65 built-in credential patterns + checksum validators + env/file leak detection)
  10. Path entropy analysis (also runs query entropy)
  11. Subdomain entropy analysis
  12. Nested URL destinations in query parameters (allowlist, blocklist, SSRF on URL-shaped values)
  13. SSRF / DNS resolution for private IPs, metadata, and rebinding
  14. Rate limiting
  15. Data budget
  16. Final context check

Nested destinations sit after every check that needs no network and before the first that does. A check that can time out must not run ahead of one that cannot, or a slow resolver decides the request before the content findings are made.

Core and configured DLP run before DNS resolution; SSRF/DNS runs after them. cfg.Internal = nil disables DNS-based configured SSRF checks, not the literal-IP core SSRF floor.

MCP Proxy

pipelock mcp proxy wraps MCP servers with bidirectional scanning. Runtime modes in internal/cli/runtime/mcp.go are:

  • Subprocess stdio: pipelock mcp proxy -- COMMAND
  • Stdio-to-HTTP upstream: --upstream http://... or --upstream https://...
  • Stdio-to-WebSocket upstream: --upstream ws://... or --upstream wss://...
  • HTTP reverse proxy: --listen ADDR --upstream http://...

MCP scanning layers include response scanning, input scanning (mcp_input_scanning), tool scanning (mcp_tool_scanning), tool policy (mcp_tool_policy), chain detection (tool_chain_detection), session binding (mcp_session_binding), binary integrity, provenance, media policy, taint, redaction, and contracts where configured.

Configured MCP upstream dialing uses the cloud metadata floor in internal/mcp/upstream_dial.go. It permits local/private MCP servers; it doesn't apply the full private-address SSRF policy used for agent-chosen destinations.

Config And Runtime

internal/config/schema.go is the authoritative list of top-level YAML fields and action constants. Config loads from YAML; hot reload uses fsnotify plus SIGHUP with atomic swaps of config, scanner, and session state. Kill switch runtime activation state persists across reloads.

The kill switch controller in internal/killswitch/killswitch.go OR-composes seven activation sources: config, API, remote kill, stale bundle, uncertain Conductor apply, SIGUSR1, and sentinel file. Any active source denies traffic, subject to endpoint and IP exemptions in the controller; IP allowlist exemptions do not apply during uncertain Conductor apply.

Emission is non-blocking for webhook output through an async buffer; syslog is synchronous UDP. Event severity is defined by event type, while configuration controls emission thresholds.

Testing

  • Race detector command: make test (OSS) or make test-sharded-enterprise (enterprise)
  • Coverage target for new code: 95%, including error paths.
  • Test-count command: go test -v ./... 2>&1 | grep -c -- '--- PASS:'
  • Synchronization uses channels or poll-with-deadline, not time.Sleep.
  • Network tests bind :0 and read back the selected address; fixed ports are checked by scripts/check-test-stability.sh.
  • Security-sensitive boolean defaults need tests for omitted, YAML null/blank, explicit false, explicit true, reload with change, and reload without change.
  • Transport claims need coverage for each applicable surface: fetch, forward proxy, CONNECT, WebSocket, MCP stdio, MCP HTTP/SSE. Document transport-specific exceptions.
  • Hot-reload tests cover first load, first reload, unrelated reload, downgrade/revocation, stale cached state, and preservation of runtime security state.

Test Patterns

cfg := config.Defaults()
cfg.Internal = nil                    // avoids DNS SSRF in unit tests; core literal-IP floor remains
cmd.SetOut(&buf)                      // CLI output capture
httptest.NewServer(handler)           // proxy tests with configured SSRF disabled
prometheus.NewRegistry()              // metrics isolation per test
net.ListenConfig{}.Listen(ctx, ...)   // free port binding

Linter Pitfalls

LinterRuleFix
errorlinterr == ErrFooerrors.Is(err, ErrFoo)
staticcheckQF1012fmt.Fprintf(w, ...) instead of w.WriteString(fmt.Sprintf(...))
gosecG101Build fake credentials at runtime from split strings
errcheckignored error_ = fn() or _, _ = w.Write(b) for intentional ignores
errcheckfmt output_, _ = fmt.Fprintf(w, ...) for command output
usestdlibvars"GET"http.MethodGet
goconstrepeated stringExtract a named const
gosecG3010o750 for directories
gosecG302/G3060o600 for files
gosecG304filepath.Clean(path); validate containment across trust boundaries
noctxbare listenernet.ListenConfig{}.Listen(ctx, ...)
unparamunused param_ prefix
gofumptformattingmake fmt (uses the pinned formatter)

Non-Obvious Task Traps

  • Adding a DLP pattern touches URL tests (scanner_test.go), text tests (text_dlp_test.go), preset YAML in configs/, and docs if default counts change.
  • Transport or security behavior changes need parity tests across applicable surfaces and exploit-style regression cases.
  • Example config snippets are executable claims; render and validate Helm/YAML examples instead of prose-checking them.
  • Stateful security features need create, rotate, revoke, recover, and inspect/approve coverage.

Code Style

  • Format with gofumpt.
  • Wrap errors as fmt.Errorf("context: %w", err).
  • Prefer table-driven tests with t.Run.
  • Avoid stuttered exported names.
  • Use shared helpers when duplicated paths have the same security meaning.
  • File permissions are 0o600; directory permissions are 0o750.
  • CLI output goes through cmd.OutOrStdout() / cmd.SetOut(&buf).
  • Prefer existing constants such as config.Action*, config.Mode*, and config.Severity*.
  • Functions with more than six parameters use an options struct; new behavior should not extend long parameter lists.
  • Public code, comments, tests, fixtures, and docs use neutral placeholder domains such as api.vendor.example.

CI And Releases

Public CI includes test, lint, build, vulnerability scan, CodeQL, Pipelock self-scan, platform smoke tests, and release/hardening checks. Release tags (v*) run GoReleaser for binaries, container images, and package metadata.

See CONTRIBUTING.md for the full contributor guide. PRs are squash-merged.

Security

Report vulnerabilities through GitHub Security Advisories, not public issues.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.