toolpin

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 24 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package toolpin pins upstream tool definitions and detects tool poisoning and rug pulls (issue #310, OWASP MCP03).

Every tool an upstream server lists is hashed (see Hash for exactly what is hashed) and compared with the hash recorded in the pin file (~/.config/leanproxy/pins.json, mode 0600, written atomically). A server seen for the first time is trusted on first use: its tools are pinned and approved, except tools whose metadata the scanner flags with a high-severity finding. From then on a tool that is added or whose definition changes stays pending until `leanproxy-mcp tools pins approve` accepts it; the policy mode decides what a pending tool means:

  • off: nothing is pinned or checked;
  • warn: (default) events are logged and reported by `doctor security`, and list_tools / search_tools carry a one-line warning;
  • block: pending tools are hidden from discovery and calls to them are refused until approved.

The scanner (Scanner) looks for hidden instructions, sensitive paths, invisible or bidi unicode, external URLs, base64 blobs and overlong descriptions in every new or changed tool, reusing the prompt-injection classifier's pattern engine (pkg/bouncer/injection) with its own pattern set plus the injection guard's default set.

Index

Constants

View Source
const (
	// ApprovalTOFU: approved automatically the first time the server was
	// seen (trust on first use).
	ApprovalTOFU = "tofu"
	// ApprovalManual: approved with `tools pins approve`.
	ApprovalManual = "approved"
)

Approval values of ToolPin.Approval.

View Source
const DefaultMaxDescriptionChars = 2000

DefaultMaxDescriptionChars is the description length (in characters) above which the scanner reports a long-description finding.

View Source
const DefaultRecheckInterval = time.Second

DefaultRecheckInterval is how often Current checks the file for changes made by other processes.

View Source
const FileVersion = 1

FileVersion is the pin file format version.

View Source
const HashPrefix = "sha256:"

HashPrefix prefixes every pin hash.

View Source
const PinsFileEnv = "LEANPROXY_PINS_FILE"

PinsFileEnv overrides the pin file location (tests, sandboxes).

Variables

View Source
var ToolPoisoningPatternDefs = []injection.PatternDef{
	{
		Name:        "tool-use-precondition",
		Pattern:     `\b(before|prior\s+to|instead\s+of)\s+(using|calling|invoking|running|executing)\s+(this|the|any|other|each|every)\s+(\w+\s+)?(tools?|functions?|commands?)\b`,
		Weight:      60,
		Enabled:     true,
		Description: "Tells the model what to do before or instead of using a tool",
	},
	{
		Name:        "instruction-tag",
		Pattern:     `<\s*/?\s*(important|system|instructions?|admin|secret|hidden|critical|note\s+to\s+(the\s+)?(ai|assistant|model))\s*>`,
		Weight:      80,
		Enabled:     true,
		Description: "Pseudo-tag used to smuggle instructions to the model",
	},
	{
		Name:        "role-prefix",
		Pattern:     `(?m)(^|[\[<])\s*(system|assistant)\s*(:|\]|>)`,
		Weight:      60,
		Enabled:     true,
		Description: "Fake system or assistant turn",
	},
	{
		Name:        "conceal-from-user",
		Pattern:     `\b(do\s+not|don'?t|never|without)\s+(tell|telling|inform|informing|mention|mentioning|reveal|revealing|show|showing|alert|alerting|notify|notifying|let)\s+(this\s+|it\s+|anything\s+)?(to\s+)?(the\s+)?(users?|human|operator)\b|\b(the\s+)?users?\s+(must|should|will|need)\s+not\s+(see|know|notice|be\s+told|find\s+out)\b`,
		Weight:      90,
		Enabled:     true,
		Description: "Asks the model to hide something from the user",
	},
	{
		Name:        "sensitive-path",
		Pattern:     `(~/\.ssh\b|\.ssh/|\bid_(rsa|dsa|ecdsa|ed25519)\b|(^|[\s/"'(=:,])\.env\b|/etc/(passwd|shadow)\b|\.aws/credentials|\.netrc\b|\.npmrc\b|\.pypirc\b|\.kube/config\b|\.docker/config\.json|\.git-credentials|\.config/gh/hosts\.ya?ml)`,
		Weight:      50,
		Enabled:     true,
		Description: "Mentions a file that holds secrets",
	},
	{
		Name:        "sensitive-file-access",
		Pattern:     `\b(read|cat|open|load|include|pass|send|upload|attach|copy|forward|post|provide|append|embed|extract|collect|fetch|get|use)\b[^\n]{0,80}?(~/\.ssh\b|\.ssh/|\bid_(rsa|dsa|ecdsa|ed25519)\b|(^|[\s/"'(=:,])\.env\b|/etc/(passwd|shadow)\b|\.aws/credentials|\.netrc\b|\.git-credentials|\.kube/config\b|\.docker/config\.json|\.config/gh/hosts\.ya?ml)`,
		Weight:      90,
		Enabled:     true,
		Description: "Asks the model to read or pass on a file that holds secrets",
	},
	{
		Name:        "secret-in-parameter",
		Pattern:     `\b(pass|put|include|insert|add|send|place|copy|paste|provide)\s+(\S+\s+){0,6}?(contents?|keys?|tokens?|credentials?|passwords?|secrets?|history|conversation)\s+(\S+\s+){0,4}?(in|into|as|via|inside)\s+(the\s+)?\S+\s+(field|parameter|param|argument|arg)\b`,
		Weight:      60,
		Enabled:     true,
		Description: "Asks the model to smuggle data through a parameter",
	},
	{
		Name:        "model-directive",
		Pattern:     `\b(you|the\s+(assistant|model|ai|agent|llm))\s+(must|should|shall|need\s+to|have\s+to|are\s+required\s+to)\s+((always|also|first|now|immediately)\s+)*(call|invoke|read|send|include|pass|forward|ignore|disregard|execute|run)\b`,
		Weight:      50,
		Enabled:     true,
		Description: "Instruction addressed to the model",
	},
	{
		Name:        "tool-override",
		Pattern:     `\b(instead\s+of|rather\s+than|do\s+not|don'?t|never)\s+(use|using|call|calling|invoke|invoking)\s+(the\s+)?[\w.-]+\s+(tool|function|server)\b`,
		Weight:      60,
		Enabled:     true,
		Description: "Steers the model away from another tool (shadowing)",
	},
	{
		Name:        "redirect-traffic",
		Pattern:     `\b(all|every|any)\s+(emails?|messages?|requests?|calls?|payments?|transfers?)\s+(must|should|shall|will)\s+(always\s+)?(be\s+)?(sent|forwarded|redirected|copied|cc'?d|bcc'?d|routed)\s+to\b`,
		Weight:      85,
		Enabled:     true,
		Description: "Redirects other tools' traffic to a fixed destination",
	},
	{
		Name:        "credential-reference",
		Pattern:     `\b(api[\s_-]?keys?|access[\s_-]?tokens?|tokens?|credentials?|passwords?|secrets?|private[\s_-]keys?)\b`,
		Weight:      20,
		Enabled:     true,
		Description: "Mentions credentials",
	},
}

ToolPoisoningPatternDefs is the scanner's own pattern set (separate from the injection guard's defaults, which also run, as "injection/<name>"). Patterns match the injection engine's normalized text: lower-cased, invisible characters dropped, whitespace collapsed. A weight of 80 or more is a high-severity finding, 50 to 79 medium, below 50 low.

Functions

func Approve

func Approve(f *File, server string, tools []string, all bool, now time.Time) ([]string, error)

Approve accepts pending changes of server in f: the named tools, or every pending tool, identity change and removal with all. With neither tools nor all it accepts only a pending identity change. It returns what was approved.

func ApproveCommand

func ApproveCommand(server, tool string) string

ApproveCommand is the CLI command that approves one tool.

func BlockedMessage

func BlockedMessage(server, tool string, status Status, identity bool) string

BlockedMessage is the error a refused tool call gets.

func Canonical

func Canonical(d Definition) ([]byte, error)

Canonical returns the canonical JSON encoding of d that Hash hashes:

  • one JSON object with the members name, title, description, inputSchema, outputSchema and annotations; a member whose value is empty (""), absent or JSON null is left out, so "no title" and "title": null hash the same;
  • object keys sorted by their UTF-8 bytes at every depth, duplicate keys resolved to the last value (as encoding/json decodes them);
  • no insignificant whitespace;
  • strings escaped as encoding/json does without HTML escaping (<, > and & stay literal), invalid UTF-8 replaced by U+FFFD;
  • integer literals kept as written; other numbers written in the shortest form that round-trips through a float64 (1.0 -> 1, 1e2 -> 100, 0.50 -> 0.5).

So key order and whitespace never change the hash, while any change of a value (a word of the description, a schema property, a hint) does.

func CanonicalJSON

func CanonicalJSON(raw []byte) ([]byte, error)

CanonicalJSON re-encodes one JSON document canonically (see Canonical).

func DefaultPath

func DefaultPath() (string, error)

DefaultPath is $HOME/.config/leanproxy/pins.json.

func Hash

func Hash(d Definition) (string, error)

Hash returns "sha256:<hex>" of the canonical JSON of d (see Canonical).

func IsInvisible

func IsInvisible(r rune) bool

IsInvisible reports the characters Sanitize strips from tool metadata: zero-width characters and marks (U+200B..U+200F), bidi embeddings and overrides (U+202A..U+202E), invisible operators (U+2060..U+2064), bidi isolates (U+2066..U+2069), the zero-width no-break space (U+FEFF) and Unicode tag characters (U+E0000..U+E007F, "ASCII smuggling").

func NormalizeToolName

func NormalizeToolName(name string) string

NormalizeToolName folds a tool name for the shadowing check: lower case, letters and digits only ("Create-Issue" and "create_issue" collide).

func Render

func Render(canonical json.RawMessage) string

Render returns the text form of a canonical definition that diffs are computed on: one "field:" header per present field, the description one line per line, schemas and annotations pretty-printed with sorted keys.

func Reset

func Reset(f *File, server string) error

Reset forgets every pin of server; the next refresh pins it again on first use.

func StripInvisible

func StripInvisible(s string) (string, bool)

StripInvisible returns s without the IsInvisible characters, and whether any was removed. s is returned as is when it holds none.

func StripInvisibleJSON

func StripInvisibleJSON(raw json.RawMessage) (json.RawMessage, bool)

StripInvisibleJSON removes the IsInvisible characters from every string value (not the object keys) of a JSON document, and reports whether it changed anything. A document without any is returned byte for byte; a changed one is re-encoded canonically (see Canonical). Invalid JSON is returned unchanged.

func UnifiedDiff

func UnifiedDiff(oldDef, newDef json.RawMessage, oldLabel, newLabel string) string

UnifiedDiff returns the unified diff (3 lines of context) of two canonical definitions; either may be empty (added or removed tool).

Types

type Collision

type Collision struct {
	Server, Tool           string
	OtherServer, OtherTool string
}

Collision is one cross-server tool name collision.

func Collisions

func Collisions(f *File, server string) []Collision

Collisions returns the tool name collisions between server and the other pinned servers (every server when server is "").

type Config

type Config struct {
	// Mode is off, warn (default) or block.
	Mode Mode `yaml:"mode,omitempty"`
	// Path overrides the pin file (default ~/.config/leanproxy/pins.json;
	// the LEANPROXY_PINS_FILE environment variable wins over both).
	Path string `yaml:"path,omitempty"`
	// AllowedDomains are URL hosts the scanner does not report in tool
	// descriptions (a host matches itself and its subdomains). The host of
	// an HTTP/SSE server's own URL is always allowed for that server.
	AllowedDomains []string `yaml:"allowed_domains,omitempty"`
	// MaxDescriptionChars is the description length above which a
	// long-description finding is reported (default 2000).
	MaxDescriptionChars int `yaml:"max_description_chars,omitempty"`
}

Config is the `security.tool_pinning:` block. A nil *Config means the defaults: mode warn, the default pin file, no extra allowed domains.

func (*Config) EffectiveMaxDescriptionChars

func (c *Config) EffectiveMaxDescriptionChars() int

EffectiveMaxDescriptionChars returns max_description_chars or the default.

func (*Config) EffectiveMode

func (c *Config) EffectiveMode() Mode

EffectiveMode returns the configured mode, or ModeWarn when unset.

func (*Config) ResolvePath

func (c *Config) ResolvePath() (string, error)

ResolvePath returns the pin file path: LEANPROXY_PINS_FILE when set, then the configured path, then DefaultPath.

func (*Config) Validate

func (c *Config) Validate() error

Validate rejects an unknown mode and a negative length. A nil receiver is valid.

type Definition

type Definition struct {
	Name         string          `json:"name"`
	Title        string          `json:"title,omitempty"`
	Description  string          `json:"description,omitempty"`
	InputSchema  json.RawMessage `json:"inputSchema,omitempty"`
	OutputSchema json.RawMessage `json:"outputSchema,omitempty"`
	Annotations  json.RawMessage `json:"annotations,omitempty"`
}

Definition is the part of an MCP tool definition that is pinned: name, title, description, inputSchema, outputSchema and annotations. Icons and _meta are not pinned (they do not reach the model as instructions).

type Event

type Event struct {
	Time     time.Time `json:"time"`
	Kind     EventKind `json:"kind"`
	Server   string    `json:"server"`
	Tool     string    `json:"tool,omitempty"`
	Severity Severity  `json:"severity,omitempty"`
	Detail   string    `json:"detail,omitempty"`
	// Diff is the unified diff of the approved and the new definition
	// (tool_added, tool_changed).
	Diff string `json:"diff,omitempty"`
}

Event is one pinning event, as logged, counted and shown by the dashboard.

func RecentEvents

func RecentEvents() []Event

RecentEvents returns this process's latest pinning events, newest first (at most 200; diffs left out).

type EventKind

type EventKind string

EventKind is the kind of a pinning event.

const (
	// EventServerPinned: a server was seen for the first time and its
	// tools pinned (trust on first use).
	EventServerPinned EventKind = "server_pinned"
	// EventToolAdded: a server lists a tool that is not pinned.
	EventToolAdded EventKind = "tool_added"
	// EventToolChanged: a tool's definition differs from the approved one.
	EventToolChanged EventKind = "tool_changed"
	// EventToolRemoved: a pinned tool is no longer listed.
	EventToolRemoved EventKind = "tool_removed"
	// EventToolReverted: a changed tool is back to its approved definition.
	EventToolReverted EventKind = "tool_reverted"
	// EventServerIdentityChanged: the serverInfo name differs from the
	// pinned one.
	EventServerIdentityChanged EventKind = "server_identity_changed"
	// EventToolFlagged: the scanner reported a medium or high finding.
	EventToolFlagged EventKind = "tool_flagged"
	// EventToolShadowed: two servers expose tools whose normalized names
	// collide.
	EventToolShadowed EventKind = "tool_shadowed"
)

type File

type File struct {
	Version int                    `json:"version"`
	Servers map[string]*ServerPins `json:"servers"`
}

File is the pin file (pins.json).

func (*File) SortedServerNames

func (f *File) SortedServerNames() []string

SortedServerNames returns the pinned server names in order.

type Finding

type Finding struct {
	// Rule names the heuristic or pattern ("tool-use-precondition",
	// "hidden-unicode", "injection/ignore-previous-instructions", ...).
	Rule     string   `json:"rule"`
	Severity Severity `json:"severity"`
	// Field is the part of the definition it was found in: title,
	// description, inputSchema, outputSchema or annotations.
	Field string `json:"field"`
	// Detail explains the finding (never more than a host name or a
	// count from the scanned text).
	Detail string `json:"detail,omitempty"`
}

Finding is one scanner result for a tool.

func (Finding) String

func (f Finding) String() string

type Mode

type Mode string

Mode is the tool pinning policy (security.tool_pinning.mode).

const (
	// ModeOff disables pinning and drift detection.
	ModeOff Mode = "off"
	// ModeWarn logs drift and adds a warning to discovery output (default).
	ModeWarn Mode = "warn"
	// ModeBlock hides new or changed tools and refuses calls to them until
	// they are approved.
	ModeBlock Mode = "block"
)

type Observed

type Observed struct {
	Hash       string          `json:"hash"`
	Definition json.RawMessage `json:"definition"`
	Findings   []Finding       `json:"findings,omitempty"`
	SeenAt     time.Time       `json:"seen_at"`
}

Observed is a definition seen from the upstream but not approved.

type Options

type Options struct {
	Mode    Mode
	Store   *Store
	Scanner *Scanner
	Logger  *slog.Logger
	// ServerDomains maps a server to URL hosts that belong to it (an
	// HTTP/SSE server's own host), never reported by the scanner.
	ServerDomains map[string][]string
	// Now overrides the clock (tests).
	Now func() time.Time
}

Options configures a Pinner.

type Pinner

type Pinner struct {
	// contains filtered or unexported fields
}

Pinner applies the pinning policy: Observe records what the upstreams serve and reports drift, Check tells whether a tool may be used. A nil *Pinner is valid and disabled. It is safe for concurrent use.

func New

func New(cfg *Config, serverDomains map[string][]string, logger *slog.Logger) (*Pinner, error)

New builds the pinner of a `security.tool_pinning` block. It returns nil (pinning disabled) for mode off.

func NewWithOptions

func NewWithOptions(o Options) *Pinner

NewWithOptions builds a pinner from its parts. Store is required.

func (*Pinner) Check

func (p *Pinner) Check(server, tool string) (Status, bool)

Check returns a tool's status and whether the policy refuses it (block mode, and the tool is new, changed, or its server's identity changed).

func (*Pinner) HasPending

func (p *Pinner) HasPending() bool

HasPending reports whether any server has a tool or identity change awaiting approval.

func (*Pinner) IdentityPending

func (p *Pinner) IdentityPending(server string) bool

IdentityPending reports whether server's serverInfo name changed and awaits approval.

func (*Pinner) Mode

func (p *Pinner) Mode() Mode

Mode is the policy mode (ModeOff for a nil pinner).

func (*Pinner) Observe

func (p *Pinner) Observe(server string, info *ServerInfo, defs []Definition) []Event

Observe compares what server lists now (info may be nil when unknown) with its pins, updates the pin file and returns the events. A server not pinned yet is trusted on first use: every tool is pinned and approved, except tools with a high-severity scanner finding, which stay pending.

func (*Pinner) Observed

func (p *Pinner) Observed(server string) bool

Observed reports whether this process has compared server's tools with its pins yet. Until then a tool's status comes from the pin file alone, and the upstream may already serve something else.

func (*Pinner) OnEvent

func (p *Pinner) OnEvent(fn func(Event))

OnEvent registers fn, called for every event Observe reports.

func (*Pinner) Servers

func (p *Pinner) Servers() []string

Servers returns the pinned server names.

func (*Pinner) Store

func (p *Pinner) Store() *Store

Store is the pin file store (nil for a nil pinner).

func (*Pinner) Unapproved

func (p *Pinner) Unapproved(server string) ([]Unapproved, bool)

Unapproved returns server's tools awaiting approval (sorted) and whether its identity change awaits approval.

func (*Pinner) Wait

func (p *Pinner) Wait(timeout time.Duration) bool

Wait blocks until no Observe call is in progress, or until timeout, and reports whether it got there. A proxy calls it before it exits.

Observe publishes the new pins in memory before it writes the file and logs its events, and it usually runs on a background refresh. So a client can already see a change (a warning in list_tools, a hidden tool) while the write is still under way; a proxy that exits at that moment would lose the pin file update and the log line that explains it. Observe only does local work (a file write, logging), so the wait is short.

type Scanner

type Scanner struct {
	// contains filtered or unexported fields
}

Scanner looks for poisoning signals in tool metadata. It is safe for concurrent use.

func NewScanner

func NewScanner(o ScannerOptions) *Scanner

NewScanner builds a scanner with ToolPoisoningPatternDefs and the injection guard's default patterns.

func (*Scanner) Scan

func (s *Scanner) Scan(d Definition, serverDomains []string) []Finding

Scan returns the findings for d, most severe first. serverDomains are extra allowed URL hosts (the server's own).

type ScannerOptions

type ScannerOptions struct {
	// AllowedDomains are URL hosts never reported (with their subdomains).
	AllowedDomains []string
	// MaxDescriptionChars is the long-description threshold (default
	// DefaultMaxDescriptionChars).
	MaxDescriptionChars int
}

ScannerOptions configures a Scanner.

type ServerInfo

type ServerInfo struct {
	Name    string `json:"name"`
	Version string `json:"version,omitempty"`
}

ServerInfo is an upstream's serverInfo (name and version).

type ServerPins

type ServerPins struct {
	// ServerInfo is the approved serverInfo.
	ServerInfo *ServerInfo `json:"server_info,omitempty"`
	// PendingServerInfo is set when the server now reports another name
	// (server_identity_changed) until it is approved.
	PendingServerInfo *ServerInfo `json:"pending_server_info,omitempty"`
	FirstSeen         time.Time   `json:"first_seen"`
	UpdatedAt         time.Time   `json:"updated_at"`
	// Tools maps the upstream tool name to its pin.
	Tools map[string]*ToolPin `json:"tools"`
}

ServerPins is what is pinned for one configured server.

func (*ServerPins) SortedToolNames

func (sp *ServerPins) SortedToolNames() []string

SortedToolNames returns the pinned tool names in order.

type Severity

type Severity string

Severity ranks a scanner finding.

const (
	SeverityLow    Severity = "low"
	SeverityMedium Severity = "medium"
	SeverityHigh   Severity = "high"
)

func MaxSeverity

func MaxSeverity(fs []Finding) Severity

MaxSeverity returns the highest severity of fs ("" when empty).

func (Severity) AtLeast

func (s Severity) AtLeast(min Severity) bool

AtLeast reports whether s is as severe as min or more.

type Status

type Status string

Status is the pinning state of a tool.

const (
	// StatusUnknown: the tool is not pinned (pinning off, or never seen).
	StatusUnknown Status = ""
	// StatusApproved: the upstream serves the approved definition.
	StatusApproved Status = "approved"
	// StatusChanged: the definition changed since it was approved.
	StatusChanged Status = "changed"
	// StatusNew: the tool was never approved (added after the server was
	// first pinned, or flagged by the scanner on first use).
	StatusNew Status = "new"
	// StatusRemoved: the upstream no longer lists the tool.
	StatusRemoved Status = "removed"
)

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store reads and writes the pin file. Writes are atomic (temporary file in the same directory, fsync, rename) with mode 0600 in a 0700 directory. Every Update re-reads the file first, so changes made by another process (the CLI approving a tool, another proxy) are merged rather than overwritten; the remaining window between that read and the rename is last-writer-wins.

func OpenStore

func OpenStore(path string) (*Store, error)

OpenStore loads path (a missing file is an empty pin set).

func (*Store) Current

func (s *Store) Current() *File

Current returns the pin set. The returned File is shared and must not be modified. At most once per recheck interval it checks whether the file changed on disk (another process wrote it) and reloads it.

func (*Store) Existed

func (s *Store) Existed() bool

Existed reports whether the file existed when last read.

func (*Store) Path

func (s *Store) Path() string

Path is the pin file path.

func (*Store) Reload

func (s *Store) Reload() error

Reload re-reads the file now.

func (*Store) SetRecheckInterval

func (s *Store) SetRecheckInterval(d time.Duration)

SetRecheckInterval changes how often Current re-reads a file changed on disk (0: on every call).

func (*Store) Update

func (s *Store) Update(fn func(f *File) error) error

Update applies fn to a fresh copy of the pin file (re-read from disk) and writes the result atomically. When fn returns an error nothing is written. When the write fails the in-memory pins still take the new state (enforcement must not fall back to the old pins) and the error is returned.

type ToolPin

type ToolPin struct {
	// Hash is the approved definition's hash ("" when the tool was never
	// approved).
	Hash string `json:"hash,omitempty"`
	// Definition is the approved definition, canonical JSON (see
	// Canonical), kept for diffs.
	Definition json.RawMessage `json:"definition,omitempty"`
	// Findings are the scanner findings of the approved definition.
	Findings   []Finding  `json:"findings,omitempty"`
	FirstSeen  time.Time  `json:"first_seen"`
	Approval   string     `json:"approval,omitempty"`
	ApprovedAt *time.Time `json:"approved_at,omitempty"`
	// Pending is the definition the upstream serves now when it differs
	// from the approved one (or the tool was never approved).
	Pending *Observed `json:"pending,omitempty"`
	// RemovedAt is set while the upstream no longer lists the tool.
	RemovedAt *time.Time `json:"removed_at,omitempty"`
}

ToolPin is the pin of one tool: the approved definition and, when the upstream now serves something else, the pending one.

func (*ToolPin) Diff

func (t *ToolPin) Diff(server, tool string) string

Diff returns the diff of a tool pin: approved definition against the pending one (empty when nothing is pending).

func (*ToolPin) NeedsApproval

func (t *ToolPin) NeedsApproval() bool

NeedsApproval reports whether the tool is pending (new or changed).

func (*ToolPin) Status

func (t *ToolPin) Status() Status

Status returns the tool's pinning state.

type Unapproved

type Unapproved struct {
	Tool     string
	Status   Status
	Severity Severity
}

Unapproved is a tool awaiting approval.

Jump to

Keyboard shortcuts

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