Documentation
¶
Index ¶
- Constants
- func ApplyFixesInFile(wf Workflow, isDryRun bool) error
- func AuditRepository(path FilePath) (*[]Workflow, error)
- func AutoFixRepository(path FilePath, isDryRun bool) error
- func FormatAuditReport(workflows []Workflow) string
- func ReadFile(loc FilePath) ([]byte, error)
- func ScanContent(content []byte, regex *regexp.Regexp) ([]string, error)
- type FilePath
- type Finding
- type GitRepository
- type Inventory
- type InventoryRecord
- type Match
- type Workflow
Constants ¶
const ( Reset = "\033[0m" Red = "\033[31m" Green = "\033[32m" Yellow = "\033[33m" Blue = "\033[34m" Magenta = "\033[35m" Cyan = "\033[36m" Gray = "\033[37m" White = "\033[97m" )
Color codes
const SHA256NotAvailable = "N/A"
Variables ¶
This section is empty.
Functions ¶
func ApplyFixesInFile ¶ added in v1.2.0
ApplyFixesInFile opens the given file, applies all Findings in-place, and writes the file back. It applies fixes in top-to-bottom, left-to-right order so byte offsets remain valid.
func AuditRepository ¶
AuditRepository collects inventory details from current Git repository.
func AutoFixRepository ¶
AutoFixRepository tries to match and replace third-party action references with SHA It uses SHA resolution to find accurate SHA
func FormatAuditReport ¶ added in v1.2.0
FormatAuditReport renders a slice of workflows into a colored CLI report.
Types ¶
type FilePath ¶ added in v1.1.3
type FilePath string
Relative or Absolute path of a file
func BuildRepoPath ¶ added in v1.2.0
BuildRepoPath builds a repo path from arguments If repo is a local path, absolute path is returned If repo is a cloud URL, repository is cloned into a temporary directory for operation.
type Finding ¶ added in v1.2.0
type Finding struct {
Line int // 1-based line number
Column int // 1-based column number
Description string // human-readable problem description
FixSHA string // suggested replacement
FixMsg string // Fix message
Action string
Version string // version
Original string // e.g. "actions/checkout@v2"
}
Finding is a single issue in a workflow file.
type GitRepository ¶
type GitRepository struct {
// contains filtered or unexported fields
}
GitRepository implements Repository interface
func ListRepositoriesAtRoot ¶ added in v1.1.3
func ListRepositoriesAtRoot(root FilePath) ([]*GitRepository, error)
func (GitRepository) ListBranches ¶
func (g GitRepository) ListBranches(fp FilePath) ([]string, error)
func (GitRepository) Name ¶
func (g GitRepository) Name() string
type Inventory ¶
type Inventory struct {
Records []*InventoryRecord `json:"findings"`
}
Inventory aggregates multiple inventory records.
func ScanBranch ¶ added in v1.1.3
ScanBranch scans a given branch for mutable references
type InventoryRecord ¶
type InventoryRecord struct {
Repository string `json:"repository_name"` // Repository name or path
Branch string `json:"branch_name"` // Branch name
FilePath string `json:"actions_file"` // File path where the match was found
Matches []string `json:"matches"` // Regex match results from the file content
}
InventoryRecord holds details for a regex match in a file.