table

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package table provides a human-readable table output formatter for terminal display.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Formatter

type Formatter struct {
	// ShowRaw, when true, appends a trailing RAW column holding the unredacted
	// secret value. When false, no RAW column is emitted at all.
	ShowRaw bool

	// ColorEnabled, when true, wraps severity text with ANSI color codes.
	// Should be enabled only when writing to a terminal, not to files.
	ColorEnabled bool
}

Formatter outputs findings as a human-readable table for terminal display.

func (*Formatter) FileExtension

func (f *Formatter) FileExtension() string

FileExtension returns the text file extension.

func (*Formatter) Format

func (f *Formatter) Format(w io.Writer, findings []finding.Finding) error

Format writes findings as a formatted table to the given writer. Columns: SEVERITY | DETECTOR | FILE | LINE | REDACTED | STATUS | REMEDIATION When ShowRaw is true, a trailing RAW column is appended. A summary line is appended at the bottom.

DetectorID, FilePath, and Redacted are attacker-influenced (a malicious file name or a permissive custom detector rule can embed arbitrary bytes) and are sanitized via output.SanitizeForDisplay before reaching this writer, which is a real terminal when the CLI is run interactively. This strips control/ANSI-escape bytes so a crafted finding cannot inject terminal escape sequences into the operator's session.

Jump to

Keyboard shortcuts

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