Documentation
¶
Index ¶
- Variables
- func CargoReadReason(err error, path string, volume func(string) bool) string
- func CondaChannelDisplay(raw string) (string, bool)
- func CondaConfigKind(scope string) string
- func CondaSanitizeURL(raw string) (string, bool)
- func GoPathKey(goos, p string) string
- func GoProtection(home string, includeNetworkVolumes *bool) (protected func(string) string, volume func(string) bool)
- func GoReadReason(err error) string
- func GoSourceID(identity, kind, path string) string
- func GoWithinRoots(goos, path string, roots []string) bool
- func MavenConfigKind(manager, scope string) string
- func MavenLabel(s string) bool
- func MavenXML(data []byte) (*xml.Decoder, error)
- func MavenXMLEnd(dec *xml.Decoder) error
- func RubyGemName(s string) bool
- func RubyToken(s string) bool
- func SanitizeCargoURL(raw string) (string, bool)
- func SanitizeComposerURL(raw string) (string, bool)
- func SanitizeRubyURL(raw string) (string, bool)
- func SwiftAbsPath(p string) bool
- func SwiftJSON(data []byte, v any) error
- func SwiftLibraryGuard(protected func(string) string, volume func(string) bool, roots []string) func(string) string
- func SwiftRegistryName(s string) bool
- func SwiftRegistryScope(s string) bool
- func SwiftURL(raw string) (display string, literalAuth, ok bool)
- func TrustedPipUserPaths(exec executor.Executor, home string) []string
- type BunDetector
- type CargoConfigDetector
- type CargoConfigScope
- type CargoConfigSnapshot
- func (s CargoConfigSnapshot) DirectorySources() []string
- func (s CargoConfigSnapshot) InstallRoots() []string
- func (s CargoConfigSnapshot) LocalPaths() []string
- func (s CargoConfigSnapshot) LocalRegistries() []string
- func (s CargoConfigSnapshot) LockfilePath(contextDir string) (path string, unresolved bool)
- func (s CargoConfigSnapshot) RegistryIndex(contextDir, alias string) (string, bool)
- type CargoContextDir
- type ComposerConfigDetector
- type ComposerConfigScope
- type ComposerConfigSnapshot
- type ComposerPaths
- type CondaConfigDetector
- type CondaConfigScope
- type CondaConfigSnapshot
- func (a *CondaConfigSnapshot) ContentGuard(path string) string
- func (a *CondaConfigSnapshot) Env(key string) string
- func (a *CondaConfigSnapshot) Environment(prefix string, partial bool)
- func (a *CondaConfigSnapshot) Finish() model.CondaConfigAudit
- func (a *CondaConfigSnapshot) Manifest(path string, channels []string, status string, reasons []string) bool
- func (a *CondaConfigSnapshot) Root(path string, partial bool)
- type GoEnvDetector
- type GoEnvScope
- type GoEnvSnapshot
- type GradleVerification
- type JavaProperty
- type MavenConfigDetector
- type MavenConfigScope
- type MavenConfigSnapshot
- func (a *MavenConfigSnapshot) ContentGuard(path string) string
- func (a *MavenConfigSnapshot) Finish() (model.MavenConfigAudit, model.GradleConfigAudit)
- func (a *MavenConfigSnapshot) Manifest(dir, path string, repos []MavenRepository, status string, reasons []string)
- func (a *MavenConfigSnapshot) Partial(reason string)
- func (a *MavenConfigSnapshot) Project(dir, tool string, files []string) MavenProjectLeads
- func (a *MavenConfigSnapshot) Unlisted(dir, manager, reason string)
- func (a *MavenConfigSnapshot) Verification(dir, path string, v GradleVerification, status string, reasons []string)
- type MavenProjectLeads
- type MavenRepository
- type MavenRepositoryPolicy
- type NPMRCDetector
- type NuGetConfigDetector
- type NuGetConfigScope
- type NuGetConfigSnapshot
- func (a *NuGetConfigSnapshot) Ambient(dir string, leading ...*model.NuGetConfigFile) NuGetPaths
- func (a *NuGetConfigSnapshot) Finish() model.NuGetConfigAudit
- func (a *NuGetConfigSnapshot) ProjectFile(path, status string, reasons []string, props map[string]string, ...) *model.NuGetConfigFile
- func (a *NuGetConfigSnapshot) Restore(assets, project string, paths []string)
- type NuGetPaths
- type PipConfigDetector
- type PipUserConfigDiscovery
- type PnpmDetector
- type RubyConfigDetector
- type RubyConfigScope
- type RubyConfigSnapshot
- func (a *RubyConfigSnapshot) ContentGuard(path string) string
- func (a *RubyConfigSnapshot) Env(key string) string
- func (a *RubyConfigSnapshot) Finish() model.RubyConfigAudit
- func (a *RubyConfigSnapshot) Prefixes(prefixes, incomplete []string)
- func (a *RubyConfigSnapshot) Project(p RubyProject) RubyProjectLeads
- type RubyManifest
- type RubyManifestSource
- type RubyProject
- type RubyProjectLeads
- type SwiftConfigDetector
- type SwiftConfigScope
- type SwiftConfigSnapshot
- func (a *SwiftConfigSnapshot) ContentGuard(path string) string
- func (a *SwiftConfigSnapshot) Finish() model.SwiftConfigAudit
- func (a *SwiftConfigSnapshot) LibraryGuard(path string) string
- func (a *SwiftConfigSnapshot) Partial(reason string)
- func (a *SwiftConfigSnapshot) Project(dir string, files SwiftProjectFiles)
- func (a *SwiftConfigSnapshot) Unlisted(dir, reason string)
- type SwiftProjectFiles
- type YarnDetector
Constants ¶
This section is empty.
Variables ¶
var MavenProjectFiles = []string{".mvn/maven.config", ".mvn/jvm.config", ".mvn/wrapper/maven-wrapper.properties", "gradle.properties", "gradle/wrapper/gradle-wrapper.properties"}
MavenProjectFiles are the project-relative configuration files Project reads.
Functions ¶
func CargoReadReason ¶ added in v1.18.0
CargoReadReason maps a guarded-read failure to a Cargo reason code, separating a skipped network volume from a protected directory.
func CondaChannelDisplay ¶ added in v1.19.0
CondaChannelDisplay keeps a safe channel label, a sanitized URL or a local repository path; anything else is redacted.
func CondaConfigKind ¶ added in v1.19.0
CondaConfigKind is the source-ID kind for a Conda configuration scope.
func CondaSanitizeURL ¶ added in v1.19.0
CondaSanitizeURL removes Anaconda token path components before the shared URL sanitizer strips userinfo, query and fragment. Every `/t/<token>` component goes whole (the loader stops at non-token characters, which would leak a malformed token's tail), and a token that survives percent-decoding redacts the URL.
func GoPathKey ¶ added in v1.18.0
GoPathKey is p as the target's filesystem compares names: Windows and macOS fold case by default, Linux does not. Module paths never go through it. ponytail: conflates names on a case-sensitive APFS volume; probe the volume if that matters.
func GoProtection ¶ added in v1.18.0
func GoProtection(home string, includeNetworkVolumes *bool) (protected func(string) string, volume func(string) bool)
GoProtection builds the Go collector's guards. Protected directories stay excluded whatever another scanner's include_tcc_protected says, and match case-insensitively because tcc compares bytes while APFS folds case by default. volume matches only the skipped network volumes, which even the exact default-file exception may not enter.
func GoReadReason ¶ added in v1.18.0
GoReadReason maps a guarded-read failure to a Go reason code. A guard's own refusal already speaks that vocabulary.
func GoSourceID ¶ added in v1.18.0
GoSourceID is the stable source identity shared by both Go sections: sha256 of the canonical JSON tuple [identity, kind, clean path].
func GoWithinRoots ¶ added in v1.18.0
GoWithinRoots reports whether path is one of roots or below one, compared as goos's filesystem compares names.
func MavenConfigKind ¶ added in v1.19.0
MavenConfigKind is the source-ID kind for a Maven or Gradle configuration scope.
func MavenLabel ¶ added in v1.19.0
MavenLabel reports whether s is a safe Maven ID or profile label.
func MavenXML ¶ added in v1.19.0
MavenXML returns a strict decoder for bounded Maven and Gradle XML. A DOCTYPE is rejected outright, so no entity or external resolution ever happens. Older POMs and settings declare ISO-8859-1, which is decoded.
func MavenXMLEnd ¶ added in v1.19.0
MavenXMLEnd reads the rest of a document after its root element, which may hold only comments, processing instructions and whitespace.
func RubyGemName ¶ added in v1.18.0
RubyGemName is the bounded package-name grammar, with at least one letter.
func SanitizeCargoURL ¶ added in v1.18.0
SanitizeCargoURL strips userinfo, query and fragment from a URL; anything that still carries an '@' is redacted whole.
func SanitizeComposerURL ¶ added in v1.18.0
SanitizeComposerURL parses the entire URL, never whitespace-split fragments. Local Windows paths are checked before URL parsing so drives are not schemes.
func SanitizeRubyURL ¶ added in v1.18.0
SanitizeRubyURL is the shared whole-URL redactor, except that SCP-like Git remotes are never rewritten to an inequivalent ssh:// URI.
func SwiftAbsPath ¶ added in v1.19.0
SwiftAbsPath accepts POSIX, drive and UNC absolute paths, so a file recorded on Windows reads the same on every scanner platform.
func SwiftJSON ¶ added in v1.19.0
SwiftJSON decodes one JSON object and rejects trailing data. Unknown fields are allowed: SwiftPM adds optional fields within a schema version.
func SwiftLibraryGuard ¶ added in v1.19.0
func SwiftLibraryGuard(protected func(string) string, volume func(string) bool, roots []string) func(string) string
SwiftLibraryGuard admits SwiftPM's macOS state roots under ~/Library, which protected refuses wholesale for walks: each root, everything below it, and its ancestors so a reader rooted there can reach it. Every other path, including a link target elsewhere in ~/Library, stays with protected, and a network volume is refused first. It is only for readers rooted at roots; it grants no OS permission.
func SwiftRegistryName ¶ added in v1.19.0
func SwiftRegistryScope ¶ added in v1.19.0
SwiftRegistryScope and SwiftRegistryName follow SwiftPM's registry identity rules, restricted to ASCII.
func SwiftURL ¶ added in v1.19.0
SwiftURL sanitizes one recorded SwiftPM location for display. Local paths and file URLs keep their spelling. Network URLs keep transport, port and path case, lowercase scheme and host, drop an HTTP(S) trailing slash and drop userinfo, except an SSH username without a password, which is kept like an SCP-like location's user. literalAuth reports a credential found before sanitizing; ok is false for a query, fragment, encoded "@", unknown scheme or malformed value, which must not be used.
Types ¶
type BunDetector ¶ added in v1.12.0
type BunDetector struct {
// contains filtered or unexported fields
}
BunDetector audits bun: the one global .bunfig.toml bun selects, project bunfig.toml files, plus any .npmrc bun would read as an auth side-channel.
func NewBunDetector ¶ added in v1.12.0
func NewBunDetector(exec executor.Executor) *BunDetector
NewBunDetector returns a detector with platform-specific hooks wired in.
func (*BunDetector) Detect ¶ added in v1.12.0
func (d *BunDetector) Detect(ctx context.Context, searchDirs []string, loggedInUser *user.User) model.BunAudit
Detect runs the full bun audit.
func (*BunDetector) WithLogger ¶ added in v1.14.0
func (d *BunDetector) WithLogger(log *progress.Logger) *BunDetector
WithLogger injects a logger (used to surface exec fallbacks when metadata version resolution misses). Chainable, like WithSkipper.
func (*BunDetector) WithSkipper ¶ added in v1.12.0
func (d *BunDetector) WithSkipper(s *tcc.Skipper) *BunDetector
WithSkipper attaches a TCC skipper so discovery skips macOS-protected dirs.
type CargoConfigDetector ¶ added in v1.18.0
type CargoConfigDetector struct {
// contains filtered or unexported fields
}
CargoConfigDetector audits Cargo's configuration sources without running Cargo. It must be built with the raw executor: UserAwareExecutor.Getenv sources a login shell for some keys.
func NewCargoConfigDetector ¶ added in v1.18.0
func NewCargoConfigDetector(exec executor.Executor) *CargoConfigDetector
func (*CargoConfigDetector) Detect ¶ added in v1.18.0
func (d *CargoConfigDetector) Detect(ctx context.Context, scope CargoConfigScope) (model.CargoConfigAudit, CargoConfigSnapshot)
Detect returns the audit and the snapshot inventory uses.
type CargoConfigScope ¶ added in v1.18.0
type CargoConfigScope struct {
Username string // resolved developer identity, part of every source ID
Home string // from the OS user record
Roots []string // approved scope for ancestor .cargo probes
// Protected returns a reason code for a path that must not be touched.
Protected func(path string) string
// Volume reports a skipped network volume.
Volume func(path string) bool
// ProcessVerified means this process runs as the developer, so its own
// environment is an observed context for that developer.
ProcessVerified bool
// CargoHome is the effective Cargo home; empty when it is unresolved.
CargoHome string
// Contexts are the directories Cargo would be invoked in.
Contexts []CargoContextDir
// RegistryNames are registry aliases named by manifests, whose process
// environment keys are probed.
RegistryNames []string
}
CargoConfigScope is what the Cargo config audit may read, decided by the caller from the resolved developer identity.
type CargoConfigSnapshot ¶ added in v1.18.0
type CargoConfigSnapshot struct {
// contains filtered or unexported fields
}
CargoConfigSnapshot is the sanitized view inventory uses: per-context registry and lockfile values plus configured roots. Token values are never held.
func (CargoConfigSnapshot) DirectorySources ¶ added in v1.18.0
func (s CargoConfigSnapshot) DirectorySources() []string
DirectorySources are the resolved source.<name>.directory roots.
func (CargoConfigSnapshot) InstallRoots ¶ added in v1.18.0
func (s CargoConfigSnapshot) InstallRoots() []string
InstallRoots are the resolved install.root values and an absolute CARGO_INSTALL_ROOT.
func (CargoConfigSnapshot) LocalPaths ¶ added in v1.18.0
func (s CargoConfigSnapshot) LocalPaths() []string
LocalPaths are package directories named by config paths and patch entries.
func (CargoConfigSnapshot) LocalRegistries ¶ added in v1.18.0
func (s CargoConfigSnapshot) LocalRegistries() []string
LocalRegistries are the resolved source.<name>.local-registry roots.
func (CargoConfigSnapshot) LockfilePath ¶ added in v1.18.0
func (s CargoConfigSnapshot) LockfilePath(contextDir string) (path string, unresolved bool)
LockfilePath is the resolver.lockfile-path selected in contextDir. path is empty for the default location; unresolved means a value or a source could not be established, so the returned path is not known to be the one Cargo uses.
func (CargoConfigSnapshot) RegistryIndex ¶ added in v1.18.0
func (s CargoConfigSnapshot) RegistryIndex(contextDir, alias string) (string, bool)
RegistryIndex returns the index URL a context maps alias to; ok is false when no readable source defines it, or when a config file of the context was not read and so may redefine it.
type CargoContextDir ¶ added in v1.18.0
type CargoContextDir struct{ Project, Workspace string }
CargoContextDir is one invocation directory and the workspace root it belongs to, if any.
type ComposerConfigDetector ¶ added in v1.18.0
type ComposerConfigDetector struct {
// contains filtered or unexported fields
}
func NewComposerConfigDetector ¶ added in v1.18.0
func NewComposerConfigDetector(exec executor.Executor) *ComposerConfigDetector
func (*ComposerConfigDetector) Detect ¶ added in v1.18.0
func (d *ComposerConfigDetector) Detect(ctx context.Context, scope ComposerConfigScope) *ComposerConfigSnapshot
type ComposerConfigScope ¶ added in v1.18.0
type ComposerConfigScope struct {
Username, Home string
Protected func(string) string
Volume func(string) bool
ProcessVerified bool
}
ComposerConfigScope comes from the resolved developer, never a login shell.
type ComposerConfigSnapshot ¶ added in v1.18.0
type ComposerConfigSnapshot struct {
Homes []string
Caches []string
Home, AlternateManifest string
SelectionPartial bool
// contains filtered or unexported fields
}
ComposerConfigSnapshot accumulates observed config as manifests are discovered. This permits vendor pruning before descent without a second config-file walk.
func (*ComposerConfigSnapshot) Finish ¶ added in v1.18.0
func (a *ComposerConfigSnapshot) Finish() model.ComposerConfigAudit
func (*ComposerConfigSnapshot) KeepProjects ¶ added in v1.18.0
func (a *ComposerConfigSnapshot) KeepProjects(paths map[string]bool)
KeepProjects drops candidates later recognized as installed vendor packages. Discovery order must not turn a dependency's config into a root audit.
func (*ComposerConfigSnapshot) Project ¶ added in v1.18.0
func (a *ComposerConfigSnapshot) Project(manifest string, data []byte, status string, reasons []string, globalHome string) ComposerPaths
Project uses the manifest bytes already read by inventory. Inactive homes get their own global config, never another home's settings.
type ComposerPaths ¶ added in v1.18.0
ComposerPaths contains only locations needed for inventory discovery.
type CondaConfigDetector ¶ added in v1.19.0
type CondaConfigDetector struct {
// contains filtered or unexported fields
}
func NewCondaConfigDetector ¶ added in v1.19.0
func NewCondaConfigDetector(exec executor.Executor) *CondaConfigDetector
func (*CondaConfigDetector) Detect ¶ added in v1.19.0
func (d *CondaConfigDetector) Detect(ctx context.Context, scope CondaConfigScope) *CondaConfigSnapshot
type CondaConfigScope ¶ added in v1.19.0
type CondaConfigScope struct {
Username, Home string
Protected func(string) string
Volume func(string) bool
ProcessVerified bool
}
CondaConfigScope comes from the resolved developer, never a login shell.
type CondaConfigSnapshot ¶ added in v1.19.0
type CondaConfigSnapshot struct {
EnvsDirs, PkgsDirs, Prefixes []string
// contains filtered or unexported fields
}
CondaConfigSnapshot accumulates .condarc-family observations as inventory discovers installation roots and prefixes. Leads are absolute paths from verified process variables and present files; they are not effective config.
func (*CondaConfigSnapshot) ContentGuard ¶ added in v1.19.0
func (a *CondaConfigSnapshot) ContentGuard(path string) string
ContentGuard keeps credential files existence-only, including a token directory's contents and redirected reads.
func (*CondaConfigSnapshot) Env ¶ added in v1.19.0
func (a *CondaConfigSnapshot) Env(key string) string
Env returns a verified developer-process selector as a safe absolute path.
func (*CondaConfigSnapshot) Environment ¶ added in v1.19.0
func (a *CondaConfigSnapshot) Environment(prefix string, partial bool)
Environment observes one prefix's own files and saved state variables; its context is emitted by Finish once every root is known. A root prefix's files are already its system-scope root files.
func (*CondaConfigSnapshot) Finish ¶ added in v1.19.0
func (a *CondaConfigSnapshot) Finish() model.CondaConfigAudit
func (*CondaConfigSnapshot) Manifest ¶ added in v1.19.0
func (a *CondaConfigSnapshot) Manifest(path string, channels []string, status string, reasons []string) bool
Manifest records a recognized environment manifest's declared channels as a project-scope source with its own context. It reports whether that context is partial.
func (*CondaConfigSnapshot) Root ¶ added in v1.19.0
func (a *CondaConfigSnapshot) Root(path string, partial bool)
Root observes an installation root's own search-path files as system scope. Which root a past invocation used is unknowable, so more than one root with a present file leaves the ambient context partial.
type GoEnvDetector ¶ added in v1.18.0
type GoEnvDetector struct {
// contains filtered or unexported fields
}
GoEnvDetector audits Go's configuration sources without running Go. It must be built with the raw executor: UserAwareExecutor.Getenv sources a login shell for some keys.
func NewGoEnvDetector ¶ added in v1.18.0
func NewGoEnvDetector(exec executor.Executor) *GoEnvDetector
func (*GoEnvDetector) Detect ¶ added in v1.18.0
func (d *GoEnvDetector) Detect(ctx context.Context, scope GoEnvScope) (model.GoConfigAudit, GoEnvSnapshot)
Detect returns the audit and the snapshot inventory uses to resolve roots.
type GoEnvScope ¶ added in v1.18.0
type GoEnvScope struct {
Username string // resolved developer identity, part of every source ID
Home string // from the OS user record
Roots []string // approved filesystem scope: home plus configured search roots
// Protected returns a reason code for a path that must not be touched, "" to
// allow it. It must stay on regardless of other scanners' TCC opt-ins.
Protected func(path string) string
// Volume reports a skipped network volume, which even the exact default-file
// exception may not enter.
Volume func(path string) bool
// ProcessVerified means this process runs as the developer, so its own
// environment is an observed context for that developer.
ProcessVerified bool
}
GoEnvScope is what the Go config audit may read, all decided by the caller from the resolved developer identity rather than from the process.
type GoEnvSnapshot ¶ added in v1.18.0
type GoEnvSnapshot struct {
// RedirectUnknown is set when the user env file could not be established,
// so a default root may not be the one Go uses.
RedirectUnknown bool
// contains filtered or unexported fields
}
GoEnvSnapshot carries effective raw values, by Go precedence, from the sources the audit could read. It stays in memory: values may hold secrets.
func (GoEnvSnapshot) BinRoot ¶ added in v1.18.0
func (s GoEnvSnapshot) BinRoot(home string) (string, bool)
BinRoot is GOBIN, else the first GOPATH entry's bin.
func (GoEnvSnapshot) DefaultModCacheRoot ¶ added in v1.18.0
func (s GoEnvSnapshot) DefaultModCacheRoot(home string) (string, bool)
DefaultModCacheRoot is gopath0/pkg/mod, which a project walk skips even when GOMODCACHE points elsewhere.
func (GoEnvSnapshot) ModCacheRoot ¶ added in v1.18.0
func (s GoEnvSnapshot) ModCacheRoot(home string) (string, bool)
ModCacheRoot is GOMODCACHE, else the first GOPATH entry's pkg/mod. ok is false for a relative value, which Go itself rejects.
func (GoEnvSnapshot) Modfile ¶ added in v1.18.0
func (s GoEnvSnapshot) Modfile() (modfile string, ok bool)
Modfile is the last -modfile in the effective GOFLAGS, as written; ok is false when GOFLAGS cannot be split as Go would.
type GradleVerification ¶ added in v1.19.0
type GradleVerification struct {
VerifyMetadata, VerifySignatures *bool
TrustedArtifacts, TrustedKeys bool
Invalid bool // a policy value could not be read
}
GradleVerification is the policy part of gradle/verification-metadata.xml.
type JavaProperty ¶ added in v1.19.0
type JavaProperty struct{ Key, Value string }
JavaProperty is one key/value pair from a Java Properties file.
func ParseJavaProperties ¶ added in v1.19.0
func ParseJavaProperties(data []byte) (props []JavaProperty, complete bool)
ParseJavaProperties follows java.util.Properties#load: `#`/`!` comments, `=`, `:` or whitespace separators, backslash escapes and continuation lines. Text that is not UTF-8 is read as ISO-8859-1, the byte-stream encoding. complete is false for a malformed escape or the entry cap.
type MavenConfigDetector ¶ added in v1.19.0
type MavenConfigDetector struct {
// contains filtered or unexported fields
}
func NewMavenConfigDetector ¶ added in v1.19.0
func NewMavenConfigDetector(exec executor.Executor) *MavenConfigDetector
func (*MavenConfigDetector) Detect ¶ added in v1.19.0
func (d *MavenConfigDetector) Detect(ctx context.Context, scope MavenConfigScope) *MavenConfigSnapshot
type MavenConfigScope ¶ added in v1.19.0
type MavenConfigScope struct {
Username, Home string
Protected func(string) string
Volume func(string) bool
ProcessVerified bool
}
MavenConfigScope comes from the resolved developer, never a login shell.
type MavenConfigSnapshot ¶ added in v1.19.0
type MavenConfigSnapshot struct {
RepositoryLeads, GradleHomes []string
// Split reports a verified process option requesting a split repository.
Split bool
// contains filtered or unexported fields
}
MavenConfigSnapshot accumulates Maven and Gradle configuration observations as inventory discovers projects. Leads are absolute paths from verified process variables and present files, not effective selection.
func (*MavenConfigSnapshot) ContentGuard ¶ added in v1.19.0
func (a *MavenConfigSnapshot) ContentGuard(path string) string
ContentGuard keeps Maven security settings existence-only, including redirected reads.
func (*MavenConfigSnapshot) Finish ¶ added in v1.19.0
func (a *MavenConfigSnapshot) Finish() (model.MavenConfigAudit, model.GradleConfigAudit)
func (*MavenConfigSnapshot) Manifest ¶ added in v1.19.0
func (a *MavenConfigSnapshot) Manifest(dir, path string, repos []MavenRepository, status string, reasons []string)
Manifest records a POM's declared repositories as a project-scope source. Status and reasons describe the read, never inventory coverage.
func (*MavenConfigSnapshot) Partial ¶ added in v1.19.0
func (a *MavenConfigSnapshot) Partial(reason string)
Partial marks both audits incomplete, as when project discovery was cut short.
func (*MavenConfigSnapshot) Project ¶ added in v1.19.0
func (a *MavenConfigSnapshot) Project(dir, tool string, files []string) MavenProjectLeads
Project observes one project's configuration files, given as the absolute paths its directory listings found, and returns its .mvn discovery leads.
func (*MavenConfigSnapshot) Unlisted ¶ added in v1.19.0
func (a *MavenConfigSnapshot) Unlisted(dir, manager, reason string)
Unlisted marks one manager's project context partial when a project configuration file or folder could not be fully observed.
func (*MavenConfigSnapshot) Verification ¶ added in v1.19.0
func (a *MavenConfigSnapshot) Verification(dir, path string, v GradleVerification, status string, reasons []string)
Verification records gradle/verification-metadata.xml policy booleans and trust-container presence; keys, selectors and reasons are never kept.
type MavenProjectLeads ¶ added in v1.19.0
MavenProjectLeads are a project's .mvn discovery leads: absolute local repositories and whether repository splitting was requested.
type MavenRepository ¶ added in v1.19.0
type MavenRepository struct {
ID *string `xml:"id"`
URL *string `xml:"url"`
Releases *MavenRepositoryPolicy `xml:"releases"`
Snapshots *MavenRepositoryPolicy `xml:"snapshots"`
Kind string `xml:"-"` // dependency | plugin
ProfileID *string `xml:"-"`
}
MavenRepository is one declared repository or pluginRepository, from settings or a POM. Kind and ProfileID are set by the reader.
func MavenKinds ¶ added in v1.19.0
func MavenKinds(deps, plugins []MavenRepository, profile *string) []MavenRepository
MavenKinds labels declared repositories and pluginRepositories, in that order, with their kind and the profile that declares them.
type MavenRepositoryPolicy ¶ added in v1.19.0
type MavenRepositoryPolicy struct {
Enabled *string `xml:"enabled"`
ChecksumPolicy *string `xml:"checksumPolicy"`
UpdatePolicy *string `xml:"updatePolicy"`
}
MavenRepositoryPolicy is a repository's releases or snapshots element.
type NPMRCDetector ¶
type NPMRCDetector struct {
// contains filtered or unexported fields
}
NPMRCDetector audits npm configuration: discovers all .npmrc files, parses them, captures the merged effective view, and surfaces relevant env vars.
The detector intentionally keeps file metadata collection (owner, mode, hashes) and git-tracking checks pluggable so unit tests don't need real syscalls or a git binary.
func NewNPMRCDetector ¶
func NewNPMRCDetector(exec executor.Executor) *NPMRCDetector
NewNPMRCDetector returns a detector with default platform-specific metadata helpers wired in.
func (*NPMRCDetector) Detect ¶
func (d *NPMRCDetector) Detect(ctx context.Context, searchDirs []string, loggedInUser *user.User) model.NPMRCAudit
Detect runs the full audit. searchDirs are the dirs to walk for project- level .npmrc files (typically the user's $HOME plus any extra dirs configured by the operator). loggedInUser is the username whose ~/.npmrc we resolve for the user-scope file.
func (*NPMRCDetector) WithSkipper ¶ added in v1.11.4
func (d *NPMRCDetector) WithSkipper(s *tcc.Skipper) *NPMRCDetector
WithSkipper attaches a TCC skipper so .npmrc discovery skips macOS-protected directories. A nil skipper is a no-op. Returns the detector for chaining.
type NuGetConfigDetector ¶ added in v1.18.0
type NuGetConfigDetector struct {
// contains filtered or unexported fields
}
func NewNuGetConfigDetector ¶ added in v1.18.0
func NewNuGetConfigDetector(exec executor.Executor) *NuGetConfigDetector
func (*NuGetConfigDetector) Detect ¶ added in v1.18.0
func (d *NuGetConfigDetector) Detect(ctx context.Context, scope NuGetConfigScope) *NuGetConfigSnapshot
type NuGetConfigScope ¶ added in v1.18.0
type NuGetConfigScope struct {
Username, Home string
Roots []string // approved scope for ancestor NuGet.Config probes
Protected func(string) string
Volume func(string) bool
ProcessVerified bool
}
NuGetConfigScope comes from the resolved developer, never a login shell.
type NuGetConfigSnapshot ¶ added in v1.18.0
type NuGetConfigSnapshot struct {
GlobalPackages string // effective expanded-package root for the user context
CLIHome string // profile root for tools and templates
PackageRoots []string // every configured fallback, custom and legacy root
// contains filtered or unexported fields
}
NuGetConfigSnapshot accumulates observed NuGet configuration as the inventory discovers projects and restore graphs.
func (*NuGetConfigSnapshot) Ambient ¶ added in v1.18.0
func (a *NuGetConfigSnapshot) Ambient(dir string, leading ...*model.NuGetConfigFile) NuGetPaths
Ambient records the config sources NuGet would load for a project in dir: the leading records (process, project files), the directory chain inside approved roots, then user and machine configuration.
func (*NuGetConfigSnapshot) Finish ¶ added in v1.18.0
func (a *NuGetConfigSnapshot) Finish() model.NuGetConfigAudit
func (*NuGetConfigSnapshot) ProjectFile ¶ added in v1.18.0
func (a *NuGetConfigSnapshot) ProjectFile(path, status string, reasons []string, props map[string]string, projectDir string) *model.NuGetConfigFile
ProjectFile records the allowlisted literal properties of an MSBuild file already read by inventory. Property values that need evaluation are skipped. projectDir is the consuming project; a shared Directory.*.props/targets passes "" and leaves project-relative paths to each consumer's record.
func (*NuGetConfigSnapshot) Restore ¶ added in v1.18.0
func (a *NuGetConfigSnapshot) Restore(assets, project string, paths []string)
Restore records the ordered config input one assets file recorded. Paths outside approved roots get a targeted read only.
type NuGetPaths ¶ added in v1.18.0
NuGetPaths are the locations an ambient context selects for inventory.
type PipConfigDetector ¶
type PipConfigDetector struct {
// contains filtered or unexported fields
}
PipConfigDetector performs the read-only pip config audit.
func NewPipConfigDetector ¶
func NewPipConfigDetector(exec executor.Executor) *PipConfigDetector
NewPipConfigDetector wires platform-specific hooks; tests override.
type PipUserConfigDiscovery ¶ added in v1.17.0
type PipUserConfigDiscovery struct {
AllowedUserPaths []string
ExistingUserPaths []string
Invocations [][]string
}
PipUserConfigDiscovery is the trusted user-tier path and invocation set used by package policy enforcement. Paths are resolved beneath the interactive user's home; pip output can only confirm entries already in that allowlist.
func DiscoverPipUserConfig ¶ added in v1.17.0
func DiscoverPipUserConfig(ctx context.Context, exec executor.Executor) (PipUserConfigDiscovery, error)
DiscoverPipUserConfig discovers every supported pip invocation and only documented user-tier configuration paths for the resolved interactive user.
type PnpmDetector ¶ added in v1.12.0
type PnpmDetector struct {
// contains filtered or unexported fields
}
PnpmDetector audits pnpm configuration: .npmrc-syntax files (native rc, auth.ini, user and project .npmrc) and, from pnpm 11, YAML settings in the native config.yaml and pnpm-workspace.yaml.
func NewPnpmDetector ¶ added in v1.12.0
func NewPnpmDetector(exec executor.Executor) *PnpmDetector
NewPnpmDetector returns a detector with platform-specific hooks wired in.
func (*PnpmDetector) Detect ¶ added in v1.12.0
func (d *PnpmDetector) Detect(ctx context.Context, searchDirs []string, loggedInUser *user.User) model.PnpmAudit
Detect runs the full pnpm audit.
func (*PnpmDetector) WithSkipper ¶ added in v1.12.0
func (d *PnpmDetector) WithSkipper(s *tcc.Skipper) *PnpmDetector
WithSkipper attaches a TCC skipper so .npmrc discovery skips macOS-protected directories. nil is a no-op. Returns the detector for chaining.
type RubyConfigDetector ¶ added in v1.18.0
type RubyConfigDetector struct {
// contains filtered or unexported fields
}
func NewRubyConfigDetector ¶ added in v1.18.0
func NewRubyConfigDetector(exec executor.Executor) *RubyConfigDetector
func (*RubyConfigDetector) Detect ¶ added in v1.18.0
func (d *RubyConfigDetector) Detect(ctx context.Context, scope RubyConfigScope) *RubyConfigSnapshot
type RubyConfigScope ¶ added in v1.18.0
type RubyConfigScope struct {
Username, Home string
Protected func(string) string
Volume func(string) bool
ProcessVerified bool
}
RubyConfigScope comes from the resolved developer, never a login shell.
type RubyConfigSnapshot ¶ added in v1.18.0
type RubyConfigSnapshot struct {
GemHomes []string
UserCache, UserPlugin string
Gemfile string
// contains filtered or unexported fields
}
RubyConfigSnapshot accumulates RubyGems and Bundler observations as inventory discovers interpreter prefixes and projects.
func (*RubyConfigSnapshot) ContentGuard ¶ added in v1.18.0
func (a *RubyConfigSnapshot) ContentGuard(path string) string
ContentGuard keeps credential files existence-only, including redirected reads.
func (*RubyConfigSnapshot) Env ¶ added in v1.18.0
func (a *RubyConfigSnapshot) Env(key string) string
Env returns a verified developer-process root selector as a safe absolute path, or "" when unset, unverified or unsafe.
func (*RubyConfigSnapshot) Finish ¶ added in v1.18.0
func (a *RubyConfigSnapshot) Finish() model.RubyConfigAudit
func (*RubyConfigSnapshot) Prefixes ¶ added in v1.18.0
func (a *RubyConfigSnapshot) Prefixes(prefixes, incomplete []string)
Prefixes observes each discovered interpreter's compiled sysconfdir gemrc. These are bounded candidates, not a claim that every runtime uses each one. An incomplete prefix search may have omitted a file, so the audit and the RubyGems context are partial; files that were read keep their settings.
func (*RubyConfigSnapshot) Project ¶ added in v1.18.0
func (a *RubyConfigSnapshot) Project(p RubyProject) RubyProjectLeads
Project observes one Bundler project's manifests and local config and selects installation leads with Bundler's Settings#path rule: the first level (local, process, global) holding path, path.system or disable_shared_gems decides; deployment applies only when none does.
type RubyManifest ¶ added in v1.18.0
type RubyManifest struct {
Path, Status string
Reasons []string
Sources []RubyManifestSource
Lockfile string
NoLockfile bool
}
RubyManifest is a manifest already read by inventory, so this package never parses Ruby. Status uses the file-status vocabulary.
type RubyManifestSource ¶ added in v1.18.0
type RubyManifestSource struct{ Type, URL, Cooldown string }
RubyManifestSource is one literal Gemfile source. URL is raw and stays in memory; only its sanitized display is serialized.
type RubyProject ¶ added in v1.18.0
type RubyProject struct {
Dir string
Manifests []RubyManifest
}
RubyProject is one Bundler project: its root manifest first, then manifests it evaluates.
type RubyProjectLeads ¶ added in v1.18.0
RubyProjectLeads are discovery locations, not a claimed effective config. An empty Path means Bundler uses shared gem homes found independently.
type SwiftConfigDetector ¶ added in v1.19.0
type SwiftConfigDetector struct {
// contains filtered or unexported fields
}
func NewSwiftConfigDetector ¶ added in v1.19.0
func NewSwiftConfigDetector(exec executor.Executor) *SwiftConfigDetector
func (*SwiftConfigDetector) Detect ¶ added in v1.19.0
func (d *SwiftConfigDetector) Detect(ctx context.Context, scope SwiftConfigScope) *SwiftConfigSnapshot
type SwiftConfigScope ¶ added in v1.19.0
type SwiftConfigScope struct {
Username, Home string
Roots []string // approved filesystem scope: home plus configured search roots
Protected func(string) string
// Library guards readers rooted at LibraryRoots (macOS only).
Library func(string) string
LibraryRoots []string
Volume func(string) bool
ProcessVerified bool
}
SwiftConfigScope comes from the resolved developer, never a login shell.
type SwiftConfigSnapshot ¶ added in v1.19.0
type SwiftConfigSnapshot struct {
// ScratchLeads come from SWIFTPM_BUILD_DIR; CacheLeads from Linux
// XDG_CACHE_HOME. DotSwiftPM are the bases whose cache alias may exist.
ScratchLeads, CacheLeads, DotSwiftPM []string
// InventoryReasons are lead failures that also limit inventory coverage.
InventoryReasons []string
// contains filtered or unexported fields
}
SwiftConfigSnapshot accumulates SwiftPM configuration observations as inventory discovers projects. Leads are verified absolute environment paths, not proof that any invocation used them.
func (*SwiftConfigSnapshot) ContentGuard ¶ added in v1.19.0
func (a *SwiftConfigSnapshot) ContentGuard(path string) string
ContentGuard keeps credential files existence-only, including redirected reads.
func (*SwiftConfigSnapshot) Finish ¶ added in v1.19.0
func (a *SwiftConfigSnapshot) Finish() model.SwiftConfigAudit
func (*SwiftConfigSnapshot) LibraryGuard ¶ added in v1.19.0
func (a *SwiftConfigSnapshot) LibraryGuard(path string) string
LibraryGuard is the guard for readers rooted at the ~/Library roots: credential paths stay existence-only before the roots are admitted.
func (*SwiftConfigSnapshot) Partial ¶ added in v1.19.0
func (a *SwiftConfigSnapshot) Partial(reason string)
Partial marks every context incomplete, as when project discovery was cut short.
func (*SwiftConfigSnapshot) Project ¶ added in v1.19.0
func (a *SwiftConfigSnapshot) Project(dir string, files SwiftProjectFiles)
Project observes one project's configuration files, given as the absolute paths its directory listings found.
func (*SwiftConfigSnapshot) Unlisted ¶ added in v1.19.0
func (a *SwiftConfigSnapshot) Unlisted(dir, reason string)
Unlisted marks a project's context partial when one of its configuration folders could not be fully listed.
type SwiftProjectFiles ¶ added in v1.19.0
type SwiftProjectFiles struct{ Mirrors, Registries, Legacy string }
SwiftProjectFiles are a project's configuration files that its directory listings found; an empty path was not listed.
type YarnDetector ¶ added in v1.12.0
type YarnDetector struct {
// contains filtered or unexported fields
}
YarnDetector audits both yarn flavors. Both file shapes are always discovered — a v1 binary with a berry file (or vice versa) is itself a signal the renderer surfaces.
func NewYarnDetector ¶ added in v1.12.0
func NewYarnDetector(exec executor.Executor) *YarnDetector
NewYarnDetector returns a detector with platform-specific hooks wired in.
func (*YarnDetector) Detect ¶ added in v1.12.0
func (d *YarnDetector) Detect(ctx context.Context, searchDirs []string, loggedInUser *user.User) model.YarnAudit
Detect runs the full yarn audit.
func (*YarnDetector) WithLogger ¶ added in v1.14.0
func (d *YarnDetector) WithLogger(log *progress.Logger) *YarnDetector
WithLogger injects a logger (used to surface exec fallbacks when metadata version resolution misses). Chainable, like WithSkipper.
func (*YarnDetector) WithSkipper ¶ added in v1.12.0
func (d *YarnDetector) WithSkipper(s *tcc.Skipper) *YarnDetector
WithSkipper attaches a TCC skipper so discovery skips macOS-protected dirs.