Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// Default is the global default cooldown duration (e.g., "3d", "48h").
Default string `json:"default" yaml:"default"`
// Ecosystems overrides the default for specific ecosystems.
// Keys are ecosystem names (e.g., "npm", "pypi").
Ecosystems map[string]string `json:"ecosystems" yaml:"ecosystems"`
// Packages overrides the cooldown for specific packages.
// Keys are PURLs (e.g., "pkg:npm/lodash", "pkg:npm/@babel/core").
Packages map[string]string `json:"packages" yaml:"packages"`
// contains filtered or unexported fields
}
Config holds cooldown settings for version filtering. Cooldown hides package versions published too recently, giving the community time to spot malicious releases before they're pulled into projects.
func (*Config) Evaluate ¶ added in v0.2.0
func (c *Config) Evaluate(ecosystem, packagePURL string, publishedAt, evaluatedAt time.Time) Decision
Evaluate returns the cooldown decision for a version at evaluatedAt. AvailableAt is zero when the publication time is unknown. Otherwise, it is the publication time plus the selected cooldown, including when the cooldown is disabled.
type Reason ¶ added in v0.2.0
type Reason string
Reason explains why a package version is allowed or blocked.
const ( // ReasonDisabled means the selected cooldown duration is zero. ReasonDisabled Reason = "disabled" // ReasonElapsed means the package version has passed its cooldown period. ReasonElapsed Reason = "elapsed" // ReasonWaiting means the package version is still in its cooldown period. ReasonWaiting Reason = "waiting" // ReasonUnknownPublicationTime means the package version has no publication // time and is allowed by the default permissive policy. ReasonUnknownPublicationTime Reason = "unknown-publication-time" )
Click to show internal directories.
Click to hide internal directories.