risk

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package risk computes a continuous score used ONLY to add friction, never to grant access on its own - the earlier design critique was explicit that an ML/heuristic risk score is a soft, adversarially-attackable signal, and must never be a standalone ALLOW condition for a mutating call. Concretely in this codebase, the score has exactly one effect: it decides how many distinct human approvers a step-up requires (one vs. four-eyes). It never bypasses, weakens, or substitutes for the taint check itself - that check is a hard rule in internal/handler, not scored.

This is a deterministic heuristic, not a real ML classifier - integrating one would mean pretending to call a model that isn't actually wired up. The interface exists specifically so a real classifier can be dropped in later without touching any caller.

Index

Constants

View Source
const FourEyesThreshold = 0.7

FourEyesThreshold: a request scoring at or above this requires two distinct, non-requester approvers instead of one. See internal/approval's RequiredApprovals.

Variables

This section is empty.

Functions

func RequiredApprovals

func RequiredApprovals(score float64) int

RequiredApprovals maps a score to how many distinct approvers a step-up needs - the score's only real effect anywhere in this system.

func TaintedArgs

func TaintedArgs(provenance map[string]proxytypes.Provenance) []string

TaintedArgs returns the sorted-by-insertion names of every argument explicitly marked tainted - the hard trigger for mandatory step-up, independent of whatever the risk score comes out to.

Types

type HeuristicScorer

type HeuristicScorer struct{}

HeuristicScorer: 0 with no tainted arguments (nothing for a score to add friction to - the taint check itself is what gates these calls, not this). Otherwise a base cost per tainted argument, with irreversible (Class C) calls weighted higher than compensable (Class A) ones - deliberately simple and auditable at a glance, not tunable machinery.

func (HeuristicScorer) Score

type Scorer

type Scorer interface {
	Score(tool string, class registry.ReversibilityClass, provenance map[string]proxytypes.Provenance) float64
}

Jump to

Keyboard shortcuts

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