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 user asks, as a server starts and every while after, and tells the user what it found
Index ¶
- Constants
- func Cleartext(address string) bool
- func ID(check, key string) string
- func Listening(address string) bool
- func Looked(ctx context.Context, text string)
- func Owned(path string) bool
- func Private(path string) error
- func Replaceable(path string) (string, error)
- func Shown(address string) string
- func Skipped(name string, skips []string) bool
- func Told(findings []Found, standing int) string
- func Unwritable(path string) error
- type Audit
- type Check
- type Checks
- type Component
- type Finding
- type Found
- type Inventory
- type Ran
- type Reach
- type Registrant
- type Registry
- type Repaired
- type Report
- type Security
- func (s *Security) Audit(ctx context.Context, cfg *config.Config, how Audit) (Report, error)
- func (s *Security) Dismiss(cfg *config.Config, ids []string, restore bool) (Report, error)
- func (s *Security) Last(cfg *config.Config) (Report, bool)
- func (s *Security) Register(registrant Registrant)
- func (s *Security) Repair(ctx context.Context, cfg *config.Config, ids []string) ([]Repaired, Report, error)
- func (s *Security) Start(ctx context.Context)
- func (s *Security) Telling(tell func(profile, text string))
- type Severity
Constants ¶
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 ¶
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 Listening ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 Skipped ¶
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 ¶
What the user 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 ¶
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 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 user 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 user asks icebath to, answering what it did in a sentence. nil when only the user can
Repair func(ctx context.Context) (string, error)
}
One thing that makes the installation unsafe
func Swappable ¶
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 user. 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 user 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 user can put it right
Repairs string `json:"repairs,omitempty"`
// The user 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 user 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 ¶
What people other than its owner may do with the file or folder at the path. Nothing for a path that is not there
type Registrant ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func (*Registry) Checks ¶
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 ¶
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) 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) Failed ¶
Whether a finding that stands is at least as serious as the threshold, which programs read as the audit failing
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 user dismissed and the repairs icebath makes when asked. And the audit of every profile as a server starts and every while after, the user told what it found
func (*Security) Audit ¶
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 ¶
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 ¶
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 user can put right, is told as such
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 ¶
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 (Severity) Title ¶
Name of the severity with a capital, as a user reads it at the start of a line