Documentation
¶
Overview ¶
Package toolreview holds the value types shared by the tool-review layers (storage, runtime and the security scanner) for Spec 117. It is a leaf package: it imports only the standard library, so storage (which imports the scanner) and the scanner can both depend on it without an import cycle.
Index ¶
Constants ¶
const ( // BaselineSourceDiscovery: a trusted discovery pass established the // server's first tool baseline. BaselineSourceDiscovery = "discovery" // BaselineSourceServerApproval: an operator approved the server through // the security (review) approval, with or without tools. BaselineSourceServerApproval = "server_approval" // BaselineSourceInferred: back-filled from approved/changed records that // predate the marker (an older store). BaselineSourceInferred = "inferred" )
Baseline decision sources (Spec 117 FR-020).
const ErrorCodeReviewNotRecorded = "review_not_recorded"
ErrorCodeReviewNotRecorded is the stable error_code of the HTTP 503 a transition answers while the server's last capture could not be fully recorded (Spec 117 FR-018).
const ErrorCodeReviewOutOfDate = "review_out_of_date"
ErrorCodeReviewOutOfDate is the stable error_code of the HTTP 409 an approval bound to an out-of-date review answers (Spec 117 FR-008).
Variables ¶
var ErrReviewNotRecorded = errors.New("tool definitions could not be recorded; retry the capture")
ErrReviewNotRecorded reports that a server's latest tool capture could not be fully recorded (a storage or index write failed part-way through the pass), so the stored definitions may be older than what the upstream now serves (Spec 117 FR-018). While a server is in this state its tools are not dispatched and nothing is approved or enabled for it; the next complete capture clears it. HTTP maps it to 503, MCP to a tool error with this text.
Functions ¶
This section is empty.
Types ¶
type BaselineDecision ¶
type BaselineDecision struct {
DecidedAt time.Time `json:"decided_at"`
Source string `json:"source"`
By string `json:"by,omitempty"`
}
BaselineDecision records that a server's tool baseline has been decided. While it exists, a new or replaced tool on that server is never auto-approved as a first baseline (Spec 117 FR-020..FR-024, issue #1567).
type StaleToolReviewError ¶
type StaleToolReviewError struct {
Server string
// Changed: the review fingerprint differs from the reviewed one.
Changed []string
// Unreviewed: in the validated set but absent from expected_hashes (or
// sent with an empty value).
Unreviewed []string
// MissingBlocks: block targets that no longer have an approval record
// (bound requests only).
MissingBlocks []string
}
StaleToolReviewError reports that a review-bound approval (Spec 117 PR-2, issue #1566) no longer matches the tool definitions the core holds: a tool the approval would make reachable changed (definition or safety hints) since the review the client sent, appeared after it, or a block target no longer exists. Nothing was approved.
Error() always contains "out of date" and never "dangerous": the macOS tray (#1572) and the Web review screen reload the review on "out of date" and key their force-approval dialog on "dangerous".
func NewStaleToolReviewError ¶
func NewStaleToolReviewError(server string, changed, unreviewed, missingBlocks []string) *StaleToolReviewError
NewStaleToolReviewError returns the error with every list sorted and deduplicated, or nil when all lists are empty.
func (*StaleToolReviewError) Error ¶
func (e *StaleToolReviewError) Error() string