output

package
v0.31.3 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package output renders tlsanalyzer scan evidence into human-readable and machine-readable reports.

The package contains helpers for console summaries, Markdown reports, JSON schema v1 reports, SARIF and JUnit XML. It is used by the CLI and batch runner, and can be reused by callers that already have scan.TLSScanResult values and optional policy results.

JSON output follows the documented schema_version contract. Human-readable wording may evolve during preview releases, while JSON field removals, renames or type changes require a schema version change.

Index

Constants

View Source
const JSONSchemaVersion = "1.1"

Variables

This section is empty.

Functions

func BuildJSONBatchReport added in v0.20.0

func BuildJSONBatchReport(scannerVersion string, generatedAt time.Time, reports []TargetReport, metadata BatchRunMetadata) ([]byte, error)

BuildJSONBatchReport builds a dependency-free aggregate JSON report for batch scans.

func BuildJSONReport added in v0.8.4

func BuildJSONReport(host, port, serverName, scannerVersion string, generatedAt time.Time, results []scan.TLSScanResult, policyResults ...*policy.Result) ([]byte, error)

func BuildJUnitBatchReport added in v0.20.0

func BuildJUnitBatchReport(reports []TargetReport) ([]byte, error)

BuildJUnitBatchReport builds one JUnit XML report with one suite per target.

func BuildJUnitReport added in v0.19.0

func BuildJUnitReport(host, port, serverName, scannerVersion string, results []scan.TLSScanResult, policyResult *policy.Result) ([]byte, error)

BuildJUnitReport builds a JUnit XML report for CI systems.

func BuildMarkdownReportFromResults

func BuildMarkdownReportFromResults(host, port, serverName, scannerVersion string, generatedAt time.Time, results []scan.TLSScanResult, policyResults ...*policy.Result) string

func BuildSARIFBatchReport added in v0.20.0

func BuildSARIFBatchReport(reports []TargetReport) ([]byte, error)

BuildSARIFBatchReport builds one SARIF v2.1.0 report for multiple targets.

func BuildSARIFReport added in v0.19.0

func BuildSARIFReport(host, port, serverName, scannerVersion string, results []scan.TLSScanResult, policyResult *policy.Result) ([]byte, error)

BuildSARIFReport builds a SARIF v2.1.0 report from policy failures and scan errors.

func PrintBatchSummary added in v0.20.0

func PrintBatchSummary(w io.Writer, reports []TargetReport)

PrintBatchSummary writes a compact human-readable summary for batch scans.

func PrintCertSummary

func PrintCertSummary(w io.Writer, cert *x509.Certificate, cipher string, version string, checkExpiry bool, validation scan.CertValidation)

func PrintCipherSuites

func PrintCipherSuites(w io.Writer, ciphers []string, discovery string)

func PrintCompactScanResults added in v0.14.0

func PrintCompactScanResults(w io.Writer, results []scan.TLSScanResult)

func PrintScanSummary added in v0.8.11

func PrintScanSummary(w io.Writer, results []scan.TLSScanResult)

func PrintTLSPosture added in v0.12.0

func PrintTLSPosture(w io.Writer, result scan.TLSScanResult)

func WriteJUnitBatchReportToFile added in v0.20.0

func WriteJUnitBatchReportToFile(reports []TargetReport, outputPath string) error

WriteJUnitBatchReportToFile writes one JUnit XML report for all batch targets.

func WriteJUnitReportToFile added in v0.19.0

func WriteJUnitReportToFile(host, port, serverName, scannerVersion string, results []scan.TLSScanResult, outputPath string, policyResult *policy.Result) error

WriteJUnitReportToFile writes a JUnit XML report for scan status and policy failures.

func WriteMarkdownReportToFile

func WriteMarkdownReportToFile(host, port, serverName, scannerVersion string, results []scan.TLSScanResult, outputPath string, policyResults ...*policy.Result) error

func WriteSARIFBatchReportToFile added in v0.20.0

func WriteSARIFBatchReportToFile(reports []TargetReport, outputPath string) error

WriteSARIFBatchReportToFile writes one SARIF report for all batch targets.

func WriteSARIFReportToFile added in v0.19.0

func WriteSARIFReportToFile(host, port, serverName, scannerVersion string, results []scan.TLSScanResult, outputPath string, policyResult *policy.Result) error

WriteSARIFReportToFile writes SARIF v2.1.0 output for policy and scan findings.

Types

type BatchRunMetadata added in v0.20.0

type BatchRunMetadata struct {
	TargetCount  int    `json:"target_count"`
	Concurrency  int    `json:"concurrency"`
	Retries      int    `json:"retries"`
	RetryBackoff string `json:"retry_backoff"`
}

BatchRunMetadata describes the operational settings used by a batch run.

type JSONBatchReport added in v0.20.0

type JSONBatchReport struct {
	SchemaVersion  string            `json:"schema_version"`
	ScannerVersion string            `json:"scanner_version"`
	GeneratedAt    string            `json:"generated_at"`
	Batch          BatchRunMetadata  `json:"batch"`
	Targets        []JSONBatchTarget `json:"targets"`
}

JSONBatchReport is the aggregate JSON document emitted for batch scans.

type JSONBatchTarget added in v0.20.0

type JSONBatchTarget struct {
	Host       string          `json:"host"`
	Port       string          `json:"port"`
	ServerName string          `json:"server_name,omitempty"`
	Attempts   int             `json:"attempts"`
	ExitCode   int             `json:"exit_code"`
	Error      string          `json:"error,omitempty"`
	Report     json.RawMessage `json:"report"`
}

JSONBatchTarget contains batch metadata and the embedded single-target JSON report.

type JSONCertificate added in v0.8.4

type JSONCertificate struct {
	SubjectCommonName  string   `json:"subject_common_name"`
	IssuerCommonName   string   `json:"issuer_common_name"`
	ValidFrom          string   `json:"valid_from"`
	ValidTo            string   `json:"valid_to"`
	DaysUntilExpiry    int      `json:"days_until_expiry"`
	PublicKeyAlgorithm string   `json:"public_key_algorithm,omitempty"`
	PublicKeyBits      int      `json:"public_key_bits,omitempty"`
	PublicKeyCurve     string   `json:"public_key_curve,omitempty"`
	SignatureAlgorithm string   `json:"signature_algorithm,omitempty"`
	DNSNames           []string `json:"dns_names,omitempty"`
}

type JSONProbeResult added in v0.10.0

type JSONProbeResult struct {
	CipherSuite              string `json:"cipher_suite"`
	Status                   string `json:"status"`
	Evidence                 string `json:"evidence,omitempty"`
	Alert                    string `json:"alert,omitempty"`
	AlertLevel               *uint8 `json:"alert_level,omitempty"`
	AlertDescription         *uint8 `json:"alert_description,omitempty"`
	SelectedGroup            string `json:"selected_group,omitempty"`
	HelloRetryRequest        bool   `json:"hello_retry_request,omitempty"`
	HelloRetryRequestRetried bool   `json:"hello_retry_request_retried,omitempty"`
	Error                    string `json:"error,omitempty"`
}

type JSONReport added in v0.8.4

type JSONReport struct {
	Host           string           `json:"host"`
	Port           string           `json:"port"`
	ServerName     string           `json:"server_name,omitempty"`
	SchemaVersion  string           `json:"schema_version"`
	ScannerVersion string           `json:"scanner_version"`
	GeneratedAt    string           `json:"generated_at"`
	Policy         *policy.Result   `json:"policy,omitempty"`
	Results        []JSONScanResult `json:"results"`
}

type JSONScanResult added in v0.8.4

type JSONScanResult struct {
	Version                   string            `json:"version"`
	VersionID                 uint16            `json:"version_id"`
	Supported                 bool              `json:"supported"`
	Status                    string            `json:"status"`
	ErrorMessage              string            `json:"error_message,omitempty"`
	DurationMillis            int64             `json:"duration_millis"`
	HandshakeAttempts         int               `json:"handshake_attempts"`
	KeyExchangeGroup          string            `json:"key_exchange_group,omitempty"`
	ALPNProtocol              string            `json:"alpn_protocol,omitempty"`
	CipherDiscovery           string            `json:"cipher_discovery"`
	NegotiatedCipherSuite     string            `json:"negotiated_cipher_suite,omitempty"`
	CipherSuites              []string          `json:"cipher_suites,omitempty"`
	CipherSuitesObserved      bool              `json:"cipher_suites_observed"`
	CipherProbeDurationMillis int64             `json:"cipher_probe_duration_millis,omitempty"`
	CipherProbeResults        []JSONProbeResult `json:"cipher_probe_results,omitempty"`
	RawProbeFullHandshake     *bool             `json:"raw_probe_completed_full_handshake,omitempty"`
	Warnings                  []string          `json:"warnings,omitempty"`
	Certificate               *JSONCertificate  `json:"certificate,omitempty"`
	CertValidationStatus      string            `json:"certificate_validation_status,omitempty"`
	CertValidationMessage     string            `json:"certificate_validation_message,omitempty"`
}

type TargetReport added in v0.20.0

type TargetReport struct {
	Host           string
	Port           string
	ServerName     string
	ScannerVersion string
	Attempts       int
	Results        []scan.TLSScanResult
	Policy         *policy.Result
	Error          string
	ExitCode       int
}

TargetReport contains the scan evidence and policy outcome for one batch target.

Jump to

Keyboard shortcuts

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