Help us shape the future of Go! Take the 2026 Go Developer Survey

ignore

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package ignore models a repo-committed, declarative finding-suppression policy: the accepted-risk decisions a team version-controls alongside its code – Synapse's take on Trivy's .trivyignore, made governance-first. A rule may carry a reason and an expiry; an expired rule never suppresses (accepted risk is revisited, not permanent); and – enforced by the caller – a suppressed finding is RETAINED and surfaced, never silently dropped. This package is pure (bytes in, decisions out): reading the file and applying the decisions live in the infrastructure + usecase layers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Rule

type Rule struct {
	ID      string
	Reason  string
	Expires time.Time // zero = never; the rule stops suppressing on this UTC date
	// Malformed marks a rule whose exp: token was present but unparseable. Such a rule NEVER suppresses
	// (fail-safe: a date typo must not silently become a permanent acceptance) and is surfaced so it's fixed.
	Malformed bool
}

Rule is one suppression: an advisory id (CVE/GHSA) or an exact finding dedup key to accept, with an optional human reason and an optional expiry (zero = never expires).

type Set

type Set []Rule

Set is a parsed suppression policy.

func Parse

func Parse(data []byte) Set

Parse reads the .synapseignore text format: one rule per line, '#' begins a comment. A rule line is

<id> [exp:YYYY-MM-DD] [# free-text reason]

Unparseable lines are skipped (lenient, like Trivy) so a single typo can neither hide a whole policy nor fail a scan. Parsing never errors.

func (Set) Expired

func (s Set) Expired(now time.Time) Set

Expired returns the rules that have lapsed as of now, so an operator can be told which accepted-risk decisions need refreshing (surfacing them is the caller's job – this never hides anything).

func (Set) Malformed

func (s Set) Malformed() Set

Malformed returns the rules with an unparseable expiry, so an operator can be told to fix them (they are treated as non-suppressing until fixed).

func (Set) Match

func (s Set) Match(ids []string, now time.Time) (Rule, bool)

Match returns the first ACTIVE rule whose id equals any of the given identifiers (case-insensitive), and true. An expired OR malformed rule never matches, so the finding re-surfaces. now is the comparison time.

Jump to

Keyboard shortcuts

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