spackle

← Spackle home

Threat model

This document models threats to Spackle itself and to the people around a Spackle run. It does not model the systems Spackle examines. Each "Verified by" cell names a test in this repository, as package: TestName. Packages are under internal/.

Scope and assets

Spackle protects these assets:

Asset Why it matters
Your secrets and source Spackle reads the source tree, which may contain credentials and private code
Your machine Spackle runs with your privileges and handles hostile input
The authorized target Testing must stay non-destructive by default and inside the agreed scope
Third parties outside scope A request to a host you did not authorize may be illegal and harmful
API spend Model calls cost money, and a run can be driven to make more of them
Release artifacts Users run the published binaries with their own privileges

Trust boundaries

Party Trust Notes
Operator Trusted Chooses the target, the scope, the provider and the budgets
Target content Untrusted Source files, HTTP responses, scanner output, commit messages, issue text. Any of it may be written by an attacker
Model provider Semi-trusted, possibly remote Receives redacted prompts. Trusted to return completions, not trusted with secrets
Model output Untrusted May be wrong, or steered by injected target content. Validated before use
MCP client Untrusted A model on the other end of standard input. Works inside limits the operator set on the command line
Container runtime Trusted to isolate Docker or Podman, driven through its command line. Spackle depends on its isolation and does not add to it
Release pipeline Trusted, verifiable GitHub Actions builds, signs and attests the artifacts
flowchart TB
    OP[Operator]
    subgraph HOST[Operator machine]
        ENG[Spackle engine: scope, budgets, tool validation]
        RED[Redaction]
        LED[(Ledger and run folder)]
        subgraph SBX[Sandbox container]
            POC[Model-written proofs, patched code, tests]
        end
    end
    subgraph UNTRUSTED[Untrusted input]
        TC[Target content]
        MO[Model output]
        MC[MCP client]
    end
    PROV[Model provider, possibly remote]
    TGT[Authorized target]
    OUT[Hosts outside scope]
    REL[Release pipeline]

    OP -->|target, scope, budgets| ENG
    TC -->|enveloped as data| ENG
    MC -->|tool calls inside operator limits| ENG
    ENG --> RED
    RED -->|redacted prompts| PROV
    PROV --> MO
    MO -->|validated JSON and tool calls| ENG
    ENG -->|runs with the fixed profile| SBX
    ENG -->|scope-bound requests| TGT
    ENG -.->|refused and recorded| OUT
    ENG --> LED
    REL -->|signed artifacts| OP

STRIDE analysis

Spoofing

Threat Where Mitigation Verified by
Target content imitates system or operator instructions to the model Any model stage that reads target content Target content reaches a model only between delimiters that carry a per-run random nonce. An occurrence of the nonce inside content is removed before wrapping, and labels cannot break the opening marker. The engine does not depend on the model obeying: scope, budgets and tool permissions live in Go envelope: TestInjectionCorpus, TestForgedMarkersCannotCloseTheEnvelope, TestLeakedNonceIsNeutralized, TestLabelCannotBreakTheOpeningMarker; agent/tools: TestInjectionCorpus, TestEnvelope
A model claims a finding is demonstrated Investigator drafts Only high and plausible are accepted from a model. demonstrated is set only by a sandbox run that exits 0 and prints the run's random marker agent: TestModelCannotAwardItselfDemonstrated; engine: TestProveThenFixThenVerify
A model cites code or traffic that does not exist Investigator drafts, endpoint assessment Every quote is checked against the file it cites. Evidence ids are kept only if the exchange was recorded agent: TestDraftRejections, TestLineNumbersAreCorrectedFromTheQuote; engine: TestLiveModelAssessmentCannotLeaveScope
A model client authorizes a running target or a paid run on its own behalf MCP server The MCP scan tool accepts only a local directory inside an operator root. Operator settings are not tool arguments. Without --allow-model the model is removed from the configuration before a scan mcp: TestScanRefusesEverythingButADirectoryInsideARoot, TestOperatorSettingsAreNotArguments, TestModelIsStrippedWithoutAllowModel, TestUnknownArgumentIsRefused
A URL disguises its real host with userinfo Scope gate, HTTP client Userinfo is never used for matching and never sent authz: TestPermitsHosts; dast: TestUserinfoIsNeverSent
A scoped hostname is rebound to a different IP address HTTP client, http_request tool Not mitigated. Scope is matched by name and port without DNS. See residual risks authz: TestPermitsHosts, TestPermitsNamesLoopbackAliasing cover the name and port rules only
A user installs a binary that did not come from the project Release download Checksums are signed with cosign keyless signing, and archives carry build provenance attestations and an SBOM. The GitHub Action checks the checksum and the attestation before it runs the binary Verification by the user or the action. There is no unit test for this

Tampering

Threat Where Mitigation Verified by
Model-written code modifies the working tree or the host Prover, fixer, debug mode Model-written code runs only in the sandbox. Source is mounted read-only and copied inside the container. The root filesystem is read-only. With no runtime, nothing model-written is executed sandbox: TestBuildArgsRequiredArguments, TestBuildArgsForbiddenArguments, TestIntegrationSourceMountIsReadOnly, TestIntegrationRootFilesystemIsReadOnly; engine: TestNoRuntimeMeansNothingIsExecuted
A proof replaces a file of the target, or a fix edits the test or the proof Prover, fixer A proof may only add files under spackle_poc/. A fix may only change existing files that are not test or proof files agent: TestReproduceRejectsScriptsThatReplaceTargetFiles; engine: TestPatchThatDoesNotCloseTheProofIsRejected, TestPatchThatBreaksTheBuildIsRejected
A model-written command is interpreted by a shell Sandbox The only shell text is a fixed bootstrap. The command is passed as positional parameters. Mount paths that could inject mount options are refused sandbox: TestBuildArgsBootstrapIsFixed, TestBuildArgsRejectsMountOptionInjection, TestIntegrationHostileCmdIsNotInterpreted
A fix lands in the operator's working tree or current branch Fixer Patches go to a file in the run folder and to a new branch in a separate worktree engine: TestFixesLandOnABranchAndLeaveTheWorkingTreeAlone; gitx: TestWorktreeLeavesWorkingTreeUntouched
A target repository runs code through git Git calls Hooks, fsmonitor and signature display are disabled on every git call. Text conversion and external diff are disabled when a commit is shown. A repository whose own configuration names a program for git to run (a filter, diff or merge driver, and for push a credential helper or ssh command) is not given to git at all and is treated as a plain directory. Arguments that look like options are refused gitx: TestOptionInjectionIsRefused, TestRepositoryConfigThatRunsProgramsIsRefused; agent/tools: TestGitRefusals, TestGitStaysInsideTargetSubdirectory
The ledger is edited after a run to hide or invent events ledger.jsonl A ledger is created exclusively, appended only, and never overwritten. The reader rejects missing, reordered and truncated events. It is not cryptographically chained. See residual risks ledger: TestCreateRefusesToOverwrite, TestReadDetectsMissingEvent, TestReadReportsTruncatedLine
Malicious scanner output injects fake leads or instructions External scanner adapters Scanner output is parsed into typed leads. Lead text is enveloped before a model sees it. A lead that fails validation is rejected. Drafts must quote real code, and the reviewer tries to refute each finding from fresh context engine: TestInvalidLeadIsRejectedNotReported, TestReviewerRefutationDismissesWithReason; agent: TestPlanValidatesAgainstTheRealTarget
Target content changes the scope, budget or tool permissions Any model stage No tool exists that can change them. Hostile tool requests are refused and the run continues agent: TestHostileToolRequestsAreRefusedAndTheRunContinues; agent/tools: TestConfinement, TestCallErrors
Target content breaks out of a report HTML, Markdown, terminal and JSON reports Every renderer escapes target content for its format report: TestInjectionHTML, TestInjectionMarkdown, TestInjectionTerminal, TestInjectionJSON
A dependency or CI action is replaced with a malicious version Build and release Three direct dependencies in the binary, and one more (goldmark) that only the site generator uses. GitHub Actions are pinned by commit SHA. Releases carry an SBOM and provenance Dependency review and provenance verification. There is no unit test for this

Repudiation

Threat Where Mitigation Verified by
An operator denies having authorized a running target Scope gate Authorization is explicit: a scope file, a [scope] table, or a typed confirmation of the exact host. The scope, its source and the operator's statement are recorded in the ledger authz: TestGateNoScope, TestGateInteractive, TestGatePrecedence; engine: TestLiveScanStaysInScopeAndRecordsEvidence
A finding cannot be traced to its evidence Reports Reports are a pure function of the ledger. Each running-target finding links to its stored exchanges. Each sandbox run is a ledger event with its isolation profile and an output file engine: TestReportIsReproducibleFromTheLedgerAlone, TestLedgerRecordsEverySandboxRun; report: TestRenderIsDeterministic, TestGolden
Work skipped under a budget cap goes unnoticed Budget enforcement A budget.skip event lists what was not examined, and the report shows the list engine: TestBudgetExhaustionDegradesAndSaysWhatWasSkipped, TestMaxFindingsIsRecordedAsSkipped
A dismissed finding disappears without a reason Reviewer A dismissal requires a reason, and the reason is kept on the finding and in the ledger engine: TestReviewerRefutationDismissesWithReason, TestInvestigatorNoFindingDismissesTheLead; agent: TestReviewVerdicts
A report overstates what was shown Reports Confidence and proof status are printed with what they mean report: TestHonestLabels

Information disclosure

Threat Where Mitigation Verified by
A secret value is sent to a model provider Every provider call llm.Redacting wraps every provider: system prompt, user text, tool results and replayed tool arguments pass through secret detection. Tools redact their own output first llm: TestRedactingKeepsSecretsFromTheProvider, TestRedactingDropsRawTurnThatContainsASecret; agent: TestSecretsInTargetNeverReachTheModel; engine: TestSecretsNeverReachTheModelInAFullRun, TestDebugSecretInFailureOutputNeverReachesTheProvider
A secret value appears in the ledger, the evidence or a report Seeders, ledger, evidence, reports Secret leads carry the file, line, rule and a short hash of the value, never the value. Sandbox output and recorded exchanges are redacted before they are stored engine: TestSecretValuesNeverReachTheRunDirectory; redact: TestApplyNeverLeaksAnyPlantedSecret, TestMatchCarriesNoValue; dast: TestExchangeRedaction
An API key is taken from a flag or a config file, or sent to another host Configuration, provider clients Keys are read only from environment variables. The config has no key field, and a value that looks like a key is rejected. A spackle.toml found in the working directory (often the scanned code) cannot set an endpoint, a key variable, an openai-compatible model, scope, sandbox images or network, a pull request, the state or output directory, prices or a budget raise; only a file named with --config can. Provider clients never follow redirects config: TestNoAPIKeyFieldExists, TestValidationProblems, TestFoundConfigIsNotTrusted; llm: TestNewKeyHandling
Injected content tells the model to read files outside the target Read tools Paths are confined to the target root. Symbolic links that leave it are refused agent/tools: TestConfinement, TestSymlinkEscapeIsRefused, TestOutsideFileIsNeverReadable; walk: TestResolveRefusesSymlinkEscape, TestListRefusesSymlinkOutOfRoot
Injected content tells the model to send data to another host http_request tool, sandbox The tool reaches only the authorized scope. The source-code tools have no network at all. The sandbox has no network by default dast: TestHTTPToolOutOfScope, TestDoOutOfScopeSendsNothing; engine: TestLiveModelAssessmentCannotLeaveScope; sandbox: TestIntegrationDefaultProfileHasNoNetwork
--offline leaks traffic to a remote address Provider and running-target clients A provider whose endpoint is not loopback is refused before any request. The dialer refuses every non-loopback address. A remote running target is refused llm: TestNewRefusesRemoteProvidersWhenOffline, TestOfflineDialerRefusesNonLoopback, TestLoopbackDetection; engine: TestOfflineRefusesARemoteLiveTarget
A request leaves the authorized scope through a redirect or a followed link HTTP client, crawler, http_request tool Redirects are followed by Spackle itself, each hop checked against the scope. Out-of-scope links are not fetched dast: TestRedirectOutOfScopeNotFollowed, TestSuppliedClientCannotFollowRedirects, TestBaselineOpenRedirectIsNotFollowed, TestDoRefusesPathOutsidePrefix
An MCP client reads outside the roots or outside the runs directory MCP server Paths are resolved, including symbolic links, and must be inside a root. A run id that contains a path separator is refused mcp: TestScanRefusesASymlinkThatLeavesTheRoot, TestRunIDCannotNameAPath
Source excerpts reach a hosted provider Model stages By design when a hosted provider is configured. PRIVACY.md states what is sent. A local model or no model avoids it Documented behavior, not a defect

Denial of service

Threat Where Mitigation Verified by
Target content drives the run to spend without limit Model stages Hard caps on tokens, spend, wall time and sandbox runs, a turn limit per conversation, and stagnation detection. Caps cannot be turned off and no tool can raise them budget: TestCapsCannotBeTurnedOff, TestEachCapTrips, TestStagnation; agent: TestBudgetExhaustionStopsTheLoop, TestTurnLimitAsksForAFinalAnswer, TestStagnationStopsARepeatingModel; engine: TestSandboxRunCapIsEnforced
An MCP client multiplies load or spend MCP server Tool calls run one at a time. max_findings can only lower the configured limit. Oversized messages are rejected mcp: TestToolCallsRunOneAtATime, TestMaxFindingsOnlyLowersTheLimit, TestOversizedMessageIsRejected
A proof forks without bound, exhausts memory or never ends Sandbox Process, memory and CPU limits, and a wall-clock timeout enforced by the host that kills and removes the container sandbox: TestBuildArgsRequiredArguments, TestIntegrationTimeoutKillsContainer, TestRunFakeTimeoutKillsStuckCLI, TestRunFakeOutputCap
A hostile repository contains huge files, binaries or pathological lines Mapper, seeders, read tools Files over 1 MiB and binary files are skipped and recorded. Tool output is capped by constants no argument can raise walk: TestListSkipsDependencyDirsBinariesAndHugeFiles; agent/tools: TestReadFileRefusesOversizeFile, TestGrepLongLineDoesNotHang, TestTruncation
A hostile target returns an endless body or an endless redirect chain HTTP client At most 1 MiB of a response is read. Redirects stop at 5 hops and count against the request cap dast: TestBodyCapsAndUTF8, TestRedirectHopLimit, TestRequestCapStopsRedirectChain
Spackle overloads or damages the authorized target Running-target probe A request cap and a rate limit bound every run. Probes use safe methods and harmless marker values. State-changing methods need allow_unsafe_methods in the scope, and a redirect never repeats a state-changing request dast: TestRequestCap, TestRateLimitSleeps, TestPostNeedsUnsafeMethods, TestBaselineUnsafeForms, TestRedirectDoesNotRepeatPost; authz: TestCaps, TestPermitsMethods

Elevation of privilege

Threat Where Mitigation Verified by
Injected content tries to run commands on the host Model stages The model has no shell tool. Tools are read-only and come from a fixed registry. Model-written code runs only in the sandbox agent: TestHostileToolRequestsAreRefusedAndTheRunContinues; agent/tools: TestDefsAndNames, TestRandomArgsNeverPanic; engine: TestNoRuntimeMeansNothingIsExecuted
Model-written code escapes the container to the host Sandbox No network, all capabilities dropped, no new privileges, read-only root, an unprivileged user. A kernel or runtime vulnerability is outside this control. See residual risks sandbox: TestBuildArgsRequiredArguments, TestBuildArgsForbiddenArguments, TestIntegrationProcessIsNotRoot, TestIntegrationDefaultProfileHasNoNetwork
Spackle is used as a backdoor into the operator machine Whole module No package opens a listener. MCP speaks over standard input and output only. There are no credentials to default policy: TestNoListenersInModule
Spackle sends traffic to a target nobody authorized Scope gate A running target requires a scope or a typed confirmation of the exact host, loopback included. With --yes or no terminal there is no prompt, so a scope is required. A wrong scope source is a refusal, never a fall-through. Routes read from source with --routes-from are checked against the scope like links authz: TestGateNoScope, TestGateLoopbackStillNeedsScope, TestGatePrecedence, TestZeroAndNilGrant; engine: TestLiveTargetIsRefusedWithoutAuthorizedScope; dast: TestNewClientNeedsGrant, TestBaselineSeedsStayInScope
A model fixes its own finding by breaking the program Fixer A patch must compile, must not regress a passing test suite, and must make the proof stop working engine: TestPatchThatBreaksTheBuildIsRejected, TestPatchThatDoesNotCloseTheProofIsRejected, TestDebugFixThatBreaksAPassingSuiteIsRejected
A test command chosen by target content runs on the host Test runs in scan and debug The suite and single-test commands are one of a fixed set the mapper picks, or [test] from the operator's config file, never text the target or a model supplies. They are argument vectors with no shell, run only in the sandbox, and a [test] command is named in the run notes. A spackle.toml read from inside the scanned project is operator configuration and should be reviewed as such engine: TestScanUsesTheConfiguredTestCommand, TestDebugUsesTheConfiguredTestCommands; config: TestTestCommands
--pr publishes model-written changes without review Fixer A pull request is opened only when asked, and always as a draft engine: TestPRFlagOpensADraftPullRequestOnlyWhenAsked

A gate cannot stop an operator who lies about authorization. The gate makes authorization explicit and records it in the ledger. It prevents a run from reaching a running target by accident, and it leaves a record of who claimed what.

Residual risks

These are known and accepted for v0.2.2.

Design decisions log

This page is rendered from docs/THREAT_MODEL.md in the repository.