powershellvalidation

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package powershellvalidation checks PowerShell commands before execution.

Package powershellvalidation classifies PowerShell commands for tool permission decisions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommandFromInput

func CommandFromInput(input []byte) string

CommandFromInput extracts the command field from a PowerShell tool payload.

Types

type Intent

type Intent string

Intent describes the host impact of a PowerShell command.

const (
	// IntentReadOnly describes inspection-only commands.
	IntentReadOnly Intent = "read-only"
	// IntentWrite describes commands that write workspace state.
	IntentWrite Intent = "write"
	// IntentDestructive describes commands that can delete or overwrite data.
	IntentDestructive Intent = "destructive"
	// IntentNetwork describes commands that access the network.
	IntentNetwork Intent = "network"
	// IntentProcessManagement describes process-control commands.
	IntentProcessManagement Intent = "process-management"
	// IntentSystemAdmin describes system-level administration commands.
	IntentSystemAdmin Intent = "system-admin"
	// IntentUnknown describes unrecognized commands.
	IntentUnknown Intent = "unknown"
)

func Classify

func Classify(command string) Intent

Classify returns the highest-risk intent found in a PowerShell command.

type Result

type Result struct {
	Severity Severity `json:"severity"`
	Intent   Intent   `json:"intent"`
	Reason   string   `json:"reason,omitempty"`
}

Result reports a PowerShell validation decision.

func Validate

func Validate(command string, mode string, workspace string, additionalDirs []string) Result

Validate classifies a PowerShell command for the active permission mode.

type Severity

type Severity string

Severity is the permission outcome for a PowerShell command.

const (
	// SeverityAllow allows the command without an extra prompt.
	SeverityAllow Severity = "allow"
	// SeverityConfirm requires explicit confirmation before execution.
	SeverityConfirm Severity = "confirm"
	// SeverityBlock blocks the command.
	SeverityBlock Severity = "block"
)

Jump to

Keyboard shortcuts

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