Documentation
¶
Index ¶
- func CancelRequest(ac *client.AlpaconClient, id string) error
- func FindCommandApprovalRequestID(ac *client.AlpaconClient, commandID string) (string, error)
- func GetApprovalRequestRaw(ac *client.AlpaconClient, id string) ([]byte, error)
- type ApprovalMetadata
- type ApprovalRequest
- type ApprovalRequestAttributes
- type CommandDetail
- type EvidenceClaim
- type EvidenceRange
- type FileExecution
- type KubeRequest
- type RequestedChanges
- type RiskFactor
- type ServerRef
- type SudoDetail
- type SudoPolicy
- type VerdictEvidence
- type WorkSessionRef
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"`
RequesterKind string `json:"requester_kind"`
DecisionDeadline *time.Time `json:"decision_deadline"`
KubeRequest *KubeRequest `json:"kube_request"`
}
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
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 KubeRequest ¶ added in v1.21.0
type KubeRequest struct {
SessionID string `json:"session_id"`
Cluster types.ClusterSummary `json:"cluster"`
Verb string `json:"verb"`
APIGroup string `json:"api_group"`
APIVersion string `json:"api_version"`
Resource string `json:"resource"`
Subresource string `json:"subresource"`
Namespace *string `json:"namespace"`
Name *string `json:"name"`
Query map[string][]string `json:"query"`
ContentType string `json:"content_type"`
// IsChange identifies a change set. It is nil when the response omits the field.
IsChange *bool `json:"is_change"`
// Body holds the request text as sent. It is absent from lists and null when withheld or cleared.
Body *string `json:"body"`
GrantExpiresAt *time.Time `json:"grant_expires_at"`
}
KubeRequest describes the Kubernetes write or delete that requires approval.
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 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