Documentation
¶
Overview ¶
Package inputguard provides lightweight input-hygiene checks for user-supplied CLI values.
This is deliberately NOT a security boundary. Authorization is enforced server-side by the API token; these checks only keep obviously-malformed values (invalid UTF-8, control characters such as ANSI escape sequences) out of requests and out of any text that tfctl echoes back to a terminal or an audit log, where they could corrupt output or spoof messages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RedactPath ¶
RedactPath returns a version of an HTTP path suitable for logging or error messages, with sensitive segments replaced with a redaction placeholder. It is intended for use in telemetry and audit logs, not for security-critical redaction of secrets.
func Validate ¶
Validate reports whether s is safe to use as a CLI input value. It rejects:
- invalid UTF-8, and
- control characters (including ANSI escape sequences),
which have no legitimate place in a command-line value and can corrupt terminal output or audit logs. It returns an *InvalidInputError on failure.
This is input hygiene, not authorization: it does not attempt to judge whether a value is "allowed", only that it is well-formed printable text.
Types ¶
type InvalidInputError ¶
type InvalidInputError struct {
// Value is the offending input.
Value string
// Reason is a short, human-readable explanation.
Reason string
}
InvalidInputError describes why a value failed validation. The offending value is always rendered with %q so control characters are escaped rather than written raw to a terminal.
func (*InvalidInputError) Error ¶
func (e *InvalidInputError) Error() string