approval

package
v1.20.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 10 Imported by: 1 module, 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CancelRequest

func CancelRequest(ac *client.AlpaconClient, id string) error

func FindCommandApprovalRequestID added in v1.18.0

func FindCommandApprovalRequestID(ac *client.AlpaconClient, commandID string) (string, error)

FindCommandApprovalRequestID reads the requester's pending command approvals: the command detail does not carry the approval request's id.

func GetApprovalRequestRaw

func GetApprovalRequestRaw(ac *client.AlpaconClient, id string) ([]byte, error)

Types

type ApprovalMetadata added in v1.16.0

type ApprovalMetadata struct {
	CommandID   string            `json:"command_id"`
	Command     *CommandDetail    `json:"command"`
	Sudo        *SudoDetail       `json:"sudo"`
	Intent      string            `json:"intent"`
	WorkSession *WorkSessionRef   `json:"work_session"`
	Changes     *RequestedChanges `json:"changes"`
}

ApprovalMetadata is the part of an approval's metadata the CLI renders.

type ApprovalRequest

type ApprovalRequest struct {
	ID          string             `json:"id"`
	RequestType string             `json:"request_type"`
	RequestData string             `json:"request_data"`
	Description string             `json:"description"`
	Status      string             `json:"status"`
	RequestedBy *types.UserSummary `json:"requested_by"`
	ReviewedBy  *types.UserSummary `json:"reviewed_by"`
	ReviewedAt  *time.Time         `json:"reviewed_at"`
	// RejectionNote is the reason the approver wrote when rejecting; empty when
	// they gave none, and absent on an older server.
	RejectionNote string            `json:"rejection_note"`
	AddedAt       time.Time         `json:"added_at"`
	Metadata      *ApprovalMetadata `json:"metadata"`
}

func GetApprovalRequest

func GetApprovalRequest(ac *client.AlpaconClient, id string) (*ApprovalRequest, error)

type ApprovalRequestAttributes

type ApprovalRequestAttributes struct {
	ID            string              `json:"id"           table:"ID"`
	Type          string              `json:"request_type" table:"Type"`
	Status        string              `json:"status"       table:"Status"`
	RequestData   utils.TruncatedText `json:"request_data" table:"Request"`
	RequestedBy   string              `json:"requested_by" table:"Requested By"`
	AddedAt       utils.Timestamp     `json:"added_at"     table:"Added At"`
	ReviewedBy    string              `json:"reviewed_by"    table:"-"`
	ReviewedAt    utils.Timestamp     `json:"reviewed_at"    table:"-"`
	RejectionNote string              `json:"rejection_note" table:"-"`
}

func ListApprovalRequests

func ListApprovalRequests(ac *client.AlpaconClient, status, requestType string) ([]ApprovalRequestAttributes, error)

func ListMyApprovalRequests

func ListMyApprovalRequests(ac *client.AlpaconClient, status, requestType string) ([]ApprovalRequestAttributes, error)

type CommandDetail added in v1.16.0

type CommandDetail struct {
	CommandID     string `json:"command_id"`
	Line          string `json:"line"`
	ServerName    string `json:"server_name"`
	RunAs         string `json:"runas"`
	RiskLevel     string `json:"risk_level"`
	RunsWithSudo  bool   `json:"runs_with_sudo"`
	Purpose       string `json:"purpose"`
	DeclaredAgent string `json:"declared_agent"`
	// ReviewSummary, Tier2Reasoning and Factors reach only a viewer who may decide the request.
	ReviewSummary  string         `json:"review_summary"`
	Tier2Reasoning string         `json:"tier2_reasoning"`
	Factors        []RiskFactor   `json:"factors"`
	FileExecution  *FileExecution `json:"file_execution"`
	// VerdictEvidence is absent on a server that predates it.
	VerdictEvidence VerdictEvidence `json:"verdict_evidence"`
}

CommandDetail is the part of a command_exec approval's detail payload the CLI renders. The full payload is available with --output json.

type EvidenceClaim added in v1.20.0

type EvidenceClaim struct {
	Claim  string
	Ranges []EvidenceRange
}

EvidenceClaim is one claim and the script lines it rests on. An empty Ranges means the claim could not be placed in the script.

type EvidenceRange added in v1.20.0

type EvidenceRange struct {
	StartLine int `json:"start_line"`
	EndLine   int `json:"end_line"`
}

EvidenceRange is a span of 1-based script lines, both ends included.

type FileExecution added in v1.16.0

type FileExecution struct {
	Content     *string  `json:"content"`
	SHA256      string   `json:"sha256"`
	Path        string   `json:"path"`
	Interpreter string   `json:"interpreter"`
	Args        []string `json:"args"`
	RunAs       string   `json:"runas"`
	RunAsGroup  string   `json:"runas_group"`
	// ReuseDays is what the requester proposed for a standing approval; null
	// when none was proposed.
	ReuseDays *int `json:"reuse_days"`
	// GrantDays is what approving with a standing approval would grant now.
	// Present only while the request is pending.
	GrantDays *int `json:"grant_days"`
}

FileExecution is what the approver is asked to clear for a file execution request. Content is the script as the server shows it to approvers (with acknowledged exposures masked) and is null when the server withholds it.

type RequestedChanges added in v1.16.0

type RequestedChanges struct {
	Title       string      `json:"title"`
	Description string      `json:"description"`
	Scopes      []string    `json:"scopes"`
	Servers     []ServerRef `json:"servers"`
	// ServersHidden counts the requested servers left out of Servers because the
	// caller does not reach them; nil from a server that predates the count.
	ServersHidden         *int         `json:"servers_hidden,omitempty"`
	SudoPolicies          []SudoPolicy `json:"sudo_policies"`
	TargetAccountUsername string       `json:"target_account_username"`
}

type RiskFactor added in v1.16.0

type RiskFactor struct {
	Type   string `json:"type"`
	Detail string `json:"detail"`
}

type ServerRef added in v1.16.0

type ServerRef struct {
	Name string `json:"name"`
}

type SudoDetail added in v1.16.0

type SudoDetail struct {
	Command            string `json:"command"`
	RunAs              string `json:"runas"`
	Purpose            string `json:"purpose"`
	ServerName         string `json:"server_name"`
	RiskLevel          string `json:"risk_level"`
	GrantStatus        string `json:"grant_status"`
	DeclaredAgent      string `json:"declared_agent"`
	Tier2Reasoning     string `json:"tier2_reasoning"`
	DescriptionAligned *bool  `json:"description_aligned"`
}

SudoDetail is the sudo approval's detail payload. Purpose is that of the command that started the sudo, null for a sudo typed in Websh. Tier2Reasoning and DescriptionAligned reach deciders only; a null DescriptionAligned is no judgment.

type SudoPolicy added in v1.16.0

type SudoPolicy struct {
	Commands []string `json:"commands"`
}

type VerdictEvidence added in v1.20.0

type VerdictEvidence []EvidenceClaim

VerdictEvidence is the claims behind the AI's verdict on a file execution, each tied to lines of FileExecution.Content. The server sends it only to a viewer who may decide the request and is not its requester.

It decodes leniently, because it only helps the approver read the script: a value that is not a list reads as no evidence, an item without a non-blank claim and a ranges list is dropped, and so is a range that is not a pair of line numbers. A claim left with no range stays, unlocated, as the server keeps one.

func (*VerdictEvidence) UnmarshalJSON added in v1.20.0

func (v *VerdictEvidence) UnmarshalJSON(data []byte) error

type WorkSessionRef added in v1.16.0

type WorkSessionRef struct {
	ID     string `json:"id"`
	Title  string `json:"title"`
	Status string `json:"status"`
}

Jump to

Keyboard shortcuts

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