Documentation
¶
Overview ¶
Package behavioral compares what an MCP capability says it does against what its handler actually reaches, using only the graph the source pass already built: no LLM, just a fixed vocabulary matched against the description and a fixed catalogue of filesystem/network/process/credential calls matched against everything the handler statically reaches. Reachability is co-occurrence evidence, not a traced dataflow proof.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CredentialLikeName ¶ added in v1.3.0
CredentialLikeName reports whether an environment variable or setting name looks like it holds a credential (KEY, SECRET, TOKEN, PASSWORD, ...), by the vocabulary the credential checks use
Types ¶
type Analyzer ¶
type Analyzer struct{}
func (*Analyzer) Analyze ¶
func (*Analyzer) Analyze(ctx context.Context, target model.Target, ac *analyzer.AnalysisContext) model.AnalyzerResult
func (*Analyzer) Describe ¶
func (*Analyzer) Describe() analyzer.Description
type CredentialCall ¶ added in v1.3.0
type CredentialCall struct {
Call string `json:"call"`
// Address is fixed, configured, caller or unsettled
Address string `json:"address"`
To string `json:"to,omitempty"`
}
CredentialCall is one network call that carries a credential. To is the host, the name of the constant or setting that starts the address, or what the address is when neither is known.
type Effects ¶ added in v1.3.0
type Effects struct {
WritesFiles []string `json:"writes_files,omitempty"`
RunsPrograms []string `json:"runs_programs,omitempty"`
SendsData []string `json:"sends_data,omitempty"`
// ReadsText: the handler reaches a request or reads a file, so what it returns may carry text
// from outside the server: "network", "files"
ReadsText []string `json:"reads_text,omitempty"`
}
Effects is what the calls a handler reaches change or send, read from the names of the calls. Every list holds "file:line callee" and is empty when the names show nothing of the kind.
type Egress ¶ added in v1.3.0
type Egress struct {
// FixedHosts are literal hosts in the code: in a call's address, or in the constant it starts with
FixedHosts []string `json:"fixed_hosts,omitempty"`
// Configured are the constants and settings that start an address the code does not spell out
Configured []string `json:"configured_addresses,omitempty"`
// CallerAddressed are the calls whose address the caller's data starts
CallerAddressed []string `json:"caller_addressed,omitempty"`
// Unsettled counts the network calls whose address the names do not settle
Unsettled int `json:"unsettled,omitempty"`
// CredentialNames are the environment variables the handler reads that are named like a credential
CredentialNames []string `json:"credential_names,omitempty"`
// CredentialCalls are the network calls that carry a credential, and where each is addressed
CredentialCalls []CredentialCall `json:"credential_calls,omitempty"`
// CredentialInResult: the handler's own result carries a credential
CredentialInResult bool `json:"credential_in_result,omitempty"`
}
Egress says where the network calls a handler reaches are addressed, and where the credentials it reads go. It reads names along the handler's calls (walkFlow), not a traced flow: an address is the caller's when the caller's data starts it, the server's own when a literal host, a constant or a setting does, and unsettled when the names do not say.
func EgressOf ¶ added in v1.3.0
EgressOf reads the network calls handler reaches and the credentials they carry; nil when there are none. envVars are the environment variables the handler reads.
func (*Egress) LoopbackHosts ¶ added in v1.3.0
LoopbackHosts are the fixed hosts of an egress that name this machine: work a handler hands to the server's own backend or daemon, which the scanner does not follow
type HandlerBehavior ¶ added in v1.2.0
type HandlerBehavior struct {
Network bool `json:"network"`
Filesystem bool `json:"filesystem"`
Process bool `json:"process"`
Credentials bool `json:"credentials"`
SensitivePaths []string `json:"sensitive_paths,omitempty"`
EnvVars []string `json:"env_vars,omitempty"`
URLs []string `json:"urls,omitempty"`
ReachedFunctions int `json:"reached_functions"`
ReachesUnresolved bool `json:"reaches_unresolved_calls"`
// Egress is where the handler's network calls and credentials go; nil when it reaches none.
// Only the inventory fills it (EgressOf): the analyzers do not read it.
Egress *Egress `json:"egress,omitempty"`
}
HandlerBehavior is what a capability's handler can reach through the call graph: the categories the behavioral checks compare against the description, and the concrete evidence behind them