security

package
v2.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2026 License: MIT Imports: 33 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package security is the security audit: what makes this installation unsafe as each feature is set up, the known flaws and malware of the packages it runs, and what to do about each, which icebath puts right itself where it can. It audits when a person asks, as a server starts and every while after, and tells the person what it found

Index

Constants

View Source
const Advisories = "security.advisories"

Name of the check of the known flaws and malware of every package the installation runs

Variables

This section is empty.

Functions

func Cleartext

func Cleartext(address string) bool

Whether an address is reached unencrypted on another computer: http or ws to a host that is not this computer's loopback, where what goes over it, keys and passwords too, can be read on the way

func ID

func ID(check, key string) string

Id of a finding: the name of its check, and its key after a slash when it has one

func Listening

func Listening(address string) bool

Whether a listen address, as host and port, takes connections from other computers: an address with no host or a wildcard one takes them on every network of this computer, one of a network this computer is on takes them from that network; a loopback one takes none

func Looked

func Looked(ctx context.Context, text string)

Says in the report what the check running in the context looked at, such as how many packages it asked about, which the report shows beside it; nothing outside a check of an audit

func Owned

func Owned(path string) bool

Whether the user icebath runs as owns the file or folder at the path, so it may change who else may do what with it

func Private

func Private(path string) error

Makes the file or folder at the path its owner's alone, as icebath makes its own: only its owner reads and changes it, and on Windows the administrators and the system besides

func Replaceable

func Replaceable(path string) (string, error)

The folder closest to the path that others may change the entries of, so they can put another file or folder in its place: the folder itself or one above it, a folder whose entries only their owners may remove left out; empty when there is none

func Shown

func Shown(address string) string

The address with any password in it left out, as a finding may name it

func Skipped

func Skipped(name string, skips []string) bool

Whether the check of the name is left out by a skip list, such as the one the settings of the audit keep: its name or a start of it before a dot is listed

func Told

func Told(findings []Found, standing int) string

What the person is told of findings the audit came to on its own, the most serious first: what it is, how many more stand, and where to see them all

func Unwritable

func Unwritable(path string) error

Takes the right to change the file or folder at the path away from everyone but its owner, the administrators and the system, leaving what others may read or run of it as it is

Types

type Audit

type Audit struct {
	// Checks left out besides those the profile skips, each by its name or the start of names before a dot, such as mcp
	Skip []string
	// The checks that ask a service over the network are left out, so the audit stays on this computer
	Offline bool
}

How one audit goes

type Check

type Check struct {
	// Unique across icebath, the feature first and lower case, such as server.address: dismissals and the skip setting name it, and Doctor
	// lists it as security.<name>
	Name string
	// What it looks at, as the report heads it
	Title string
	// It looks at this computer or at what every profile shares, so it says the same for every profile
	Global bool
	// It asks a service over the network, so an audit asked to stay on this computer leaves it out
	Online bool
	// Looks at the installation as the profile of the settings has it: what it found unsafe, none when nothing. An error is the check
	// failing to look, said in the report in place of findings
	Run func(ctx context.Context, cfg *config.Config) ([]Finding, error)
}

One thing of the installation a feature checks for what makes it unsafe

type Checks

type Checks []Check

A registrant whose checks are fixed once registered

func (Checks) Checks

func (c Checks) Checks(*config.Config) []Check

type Component

type Component struct {
	// Ecosystem as OSV names it, such as Go, npm or PyPI, and the name and version as that ecosystem writes them
	Ecosystem, Name, Version string
	// What has it, as a person reads it, such as the MCP server github
	Source string
	// The same for every profile, such as a package of icebath itself
	Global bool
	// What to do about a flaw of it, whole sentences; to update it to a fixed version when empty. Repairs and Repair as a finding has them
	Fix, Repairs string
	Repair       func(ctx context.Context) (string, error)
}

A package the installation runs, of an ecosystem OSV knows, asked about its known flaws and malware by the advisories check

type Finding

type Finding struct {
	// Name of the finding within its check, the same from one audit to the next, such as the name of the server it is of, which a
	// dismissal or a repair of it alone names; empty for the only finding of a check
	Key      string
	Severity Severity
	// What is unsafe, one line, sentence case, no trailing period
	Title string
	// Why that is unsafe, whole sentences: what someone could do with it
	About string
	// What to do about it, whole sentences, naming the screen or command that does it
	Fix string
	// What Repair does, one sentence said before it runs; empty with no Repair
	Repairs string
	// Puts it right when the person asks icebath to, answering what it did in a sentence; nil when only the person can
	Repair func(ctx context.Context) (string, error)
}

One thing that makes the installation unsafe

func Swappable

func Swappable(path, key, what string) ([]Finding, error)

What makes a program icebath runs unsafe to run: others may change the file of it, or what is in the folder it is in, so they swap it for one of their own that runs as the person. The key starts the keys of the findings within their check, and what says what the program is, such as the icebath program; none when neither is so

type Found

type Found struct {
	// Name of the check and the key of the finding, a slash between them, the way the person names it to dismiss or repair it
	ID         string   `json:"id"`
	Check      string   `json:"check"`
	CheckTitle string   `json:"check_title"`
	Key        string   `json:"key,omitempty"`
	Severity   Severity `json:"severity"`
	Title      string   `json:"title"`
	About      string   `json:"about,omitempty"`
	Fix        string   `json:"fix,omitempty"`
	// What a repair of it does, empty when only the person can put it right
	Repairs string `json:"repairs,omitempty"`
	// The person looked at it and chose to keep it: it is listed, and counts for nothing
	Dismissed bool `json:"dismissed,omitempty"`
	// Its check looks at this computer or at what every profile shares
	Global bool `json:"global,omitempty"`
}

One finding as a report keeps it

type Inventory

type Inventory interface {
	// Packages of the profile of the settings, each with what has it; an error when they could not be listed
	Components(ctx context.Context, cfg *config.Config) ([]Component, error)
}

Registrant whose feature runs packages OSV knows. One that only brings packages implements Checks returning nil

type Ran

type Ran struct {
	Name   string `json:"name"`
	Title  string `json:"title"`
	Global bool   `json:"global,omitempty"`
	Online bool   `json:"online,omitempty"`
	// What it said it looked at, such as how many packages it asked about
	Looked string `json:"looked,omitempty"`
	// Why it could not look, and why it was left out; both empty for a check that looked
	Failure string `json:"failure,omitempty"`
	Skipped string `json:"skipped,omitempty"`
	// How many things it found
	Findings int `json:"findings"`
}

One check as an audit ran it

type Reach

type Reach struct {
	// They may read it, or for a folder list it or open what is in it
	Read bool
	// They may change it, or for a folder add, rename and remove what is in it
	Write bool
	// Who they are, as a person reads it, such as every user of this computer
	Who string
}

What people other than the owner of a file or folder may do with it

func Others

func Others(path string) (Reach, error)

What people other than its owner may do with the file or folder at the path; nothing for a path that is not there

func (Reach) Open

func (r Reach) Open() bool

Whether others may do anything with it

func (Reach) Said

func (r Reach) Said() string

What others may do, in words: read, change, or read and change

func (Reach) Subject

func (r Reach) Subject() string

Who they are as a sentence starts with them, others when nothing names them

type Registrant

type Registrant interface {
	// Checks of the profile of the settings, read quickly: what is slow goes in Run
	Checks(cfg *config.Config) []Check
}

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

func (*Registry) Checks

func (r *Registry) Checks(cfg *config.Config) []Check

Every check the registrants bring for the profile of the settings, in the order they were registered, a name taken by an earlier check never given to a later one

func (*Registry) Components

func (r *Registry) Components(ctx context.Context, cfg *config.Config) ([]Component, error)

Every package the registrants run for the profile of the settings, what kept one registrant from listing its own said in the error

func (*Registry) Host

func (r *Registry) Host() *Security

Host the registry is nested in, through which plugins read the audit

func (*Registry) Register

func (r *Registry) Register(registrant Registrant)

type Repaired

type Repaired struct {
	ID, Title string
	// What the repair did, and why it failed, empty when it did not
	Said, Failure string
}

What one repair came to

type Report

type Report struct {
	Profile string    `json:"profile"`
	At      time.Time `json:"at"`
	// Every check, in the order they were registered, those left out with why
	Checks []Ran `json:"checks"`
	// What the checks found, the standing ones most serious first, then the dismissed ones
	Findings []Found `json:"findings"`
}

What one audit of a profile found, as every icebath reads it from the profile's folder

func (Report) Counts

func (r Report) Counts() map[Severity]int

How many findings stand at each severity, by severity

func (Report) Failed

func (r Report) Failed(threshold Severity) bool

Whether a finding that stands is at least as serious as the threshold, which programs read as the audit failing

func (Report) Find

func (r Report) Find(word string) (Found, error)

The finding a person names: its number in the report as listed, its id, or the start of one id alone; a sentence saying why when none or several are

func (Report) Standing

func (r Report) Standing() []Found

Findings that stand: those nobody dismissed

type Security

type Security struct {
	Registry
	// contains filtered or unexported fields
}

The security audit: the checks every feature brings, the packages they run asked of OSV, the report each profile keeps of its last audit, the findings a person dismissed and the repairs icebath makes when asked; and the audit of every profile as a server starts and every while after, the person told what it found

func New

func New(cfg *config.Config) *Security

func (*Security) Audit

func (s *Security) Audit(ctx context.Context, cfg *config.Config, how Audit) (Report, error)

Audits the installation as the profile of the settings has it now, keeps the report in the profile's folder for every icebath to read, and hands it back. The findings the profile dismissed are marked so, and count for nothing

func (*Security) Dismiss

func (s *Security) Dismiss(cfg *config.Config, ids []string, restore bool) (Report, error)

Dismisses the findings of the ids for the profile of the settings, or takes them back when restore says so, then marks the report kept of the profile again: a dismissed finding is still listed, and counts for nothing

func (*Security) Last

func (s *Security) Last(cfg *config.Config) (Report, bool)

The report of the last audit of the profile of the settings, the findings it dismissed since marked so; false when it was never audited

func (*Security) Register

func (s *Security) Register(registrant Registrant)

Adds a registrant; a registry nested in the host reaches it through Host

func (*Security) Repair

func (s *Security) Repair(ctx context.Context, cfg *config.Config, ids []string) ([]Repaired, Report, error)

Puts right the findings of the ids that icebath can, every one it can when none is named: the checks they are of look again, each repair runs one at a time as the finding stands now, and the whole audit runs again after them so the report kept says how things stand. A finding of an id that no longer stands, or that only the person can put right, is told as such

func (*Security) Start

func (s *Security) Start(ctx context.Context)

Audits every profile whose settings ask for it once a long-lived server starts, in the background, and again every while its settings say as long as the server runs: each finding that stands goes to the log, and the person on the profile is told of the serious ones

func (*Security) Telling

func (s *Security) Telling(tell func(profile, text string))

Has the audit tell the person on a profile what it found as a server started, such as in the session in front of a window on it

type Severity

type Severity int

How serious a finding is, most serious last

const (
	// An advisory whose record says no severity
	Unknown Severity = iota
	// Worth knowing, little harm on its own
	Low
	// Harm needs something more, such as a stranger who already got in
	Medium
	// Others can read your keys or run commands as you once they find it
	High
	// Anyone who finds it runs commands as you, or it is known malware
	Critical
)

func ParseSeverity

func ParseSeverity(word string) (Severity, bool)

Severity the word names in any case, moderate being medium as OSV writes it; false for a word that names none

func (Severity) MarshalText

func (s Severity) MarshalText() ([]byte, error)

func (Severity) String

func (s Severity) String() string

Name of the severity as reports write it

func (Severity) Title

func (s Severity) Title() string

Name of the severity with a capital, as a person reads it at the start of a line

func (*Severity) UnmarshalText

func (s *Severity) UnmarshalText(text []byte) error

Directories

Path Synopsis
/security: the security audit from any client that runs the server's commands.
/security: the security audit from any client that runs the server's commands.

Jump to

Keyboard shortcuts

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