secretsaccess

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2026 License: Apache-2.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package secretsaccess correlates observed Secrets Manager read and KMS decrypt runtime events with the static reachability edges Identrail already discovered (KMS key-policy / grant `can_decrypt` edges and Secrets Manager resource-policy grants). The output ties observed behavior back to identity, session, resource, and agent context so an operator can answer three distinct questions per (identity, resource) pair:

  • confirmed: the identity was statically allowed to reach the secret/key AND was observed doing so. This is the "proof" state — behavior matches policy.
  • observed_without_grant: the identity was observed reading the secret / decrypting the key but no static allow edge explains it. Either static reachability collection is incomplete (most secret reads are authorized by IAM identity policies, which this wave's static collectors do not enumerate) or the access drifted from the modeled grants. Treated as a caveat, never a silent success.
  • granted_unused: a static allow edge exists but no runtime access was observed in the window. Surfaces over-provisioned grants — but carries a mandatory missing-event caveat because Secrets Manager GetSecretValue and KMS Decrypt are CloudTrail *data* events; absence in a management-event lookup is not proof the access never happened.

Safety boundary: the engine is metadata-only. It never reads, logs, or persists secret values, decrypted plaintext, encryption-context values, or any other customer payload. It operates purely on the already-redacted runtime-event and reachability contracts produced upstream, and every emitted correlation re-stamps the redaction boundary so downstream consumers cannot mistake it for payload-bearing evidence.

Index

Constants

View Source
const (
	ResourceKindSecret = "secret"
	ResourceKindKMSKey = "kms_key"
)

Resource kinds the correlator understands. They mirror the runtime event `event_type` → resource mapping (secret-read → secret, kms-decrypt → kms_key).

View Source
const (
	StatusConfirmed            = "confirmed"
	StatusObservedWithoutGrant = "observed_without_grant"
	StatusGrantedUnused        = "granted_unused"
)

Correlation statuses. These are the operator-facing classification of a single (identity, resource) correlation.

View Source
const (
	SourceKeyPolicy      = "key_policy"
	SourceKMSGrant       = "kms_grant"
	SourceResourcePolicy = "resource_policy"
)

Static grant sources. Mirror the upstream reachability collectors so the correlation can attribute which static signal corroborated an observed access.

View Source
const (
	// CollectorName tags every diagnostic and result the correlator
	// emits so the API layer can scope diagnostics by collector.
	CollectorName = "aws_secrets_kms_runtime_access"

	// RedactionBoundary documents that the correlator only ever crossed
	// the metadata boundary — no secret values, no decrypted plaintext,
	// no encryption-context values.
	RedactionBoundary = "metadata_only_no_secret_values_no_plaintext"
)
View Source
const (
	CaveatDataEventCoverage   = "runtime_data_events_may_be_incomplete"
	CaveatNoStaticPath        = "no_static_reachability_edge"
	CaveatObservedDespiteDeny = "observed_despite_explicit_deny"
	CaveatConditionalGrant    = "static_grant_is_conditional"
	CaveatCrossAccountGrant   = "static_grant_is_cross_account"
	CaveatLineageUnresolved   = "session_lineage_unresolved"
	CaveatResourceUnresolved  = "runtime_resource_arn_unresolved"
)

Caveat codes attached to individual correlations or the result. They are stable tokens so the UI and downstream consumers can branch on them without string-matching prose.

Variables

This section is empty.

Functions

This section is empty.

Types

type CorrelateRequest

type CorrelateRequest struct {
	AccountID string
	Region    string
	Observed  []ObservedAccess
	Static    []StaticGrant
	// DataEventCoverageUnknown marks that the observed set comes from a
	// runtime source that does not guarantee Secrets Manager / KMS data
	// events are captured (e.g. CloudTrail LookupEvents only indexes
	// management events). When true, every granted_unused correlation
	// and the result envelope carry the missing-event caveat so an
	// operator never reads "unused" as "definitely never used".
	DataEventCoverageUnknown bool
}

CorrelateRequest configures one correlation pass.

type Correlation

type Correlation struct {
	CorrelationID     string
	IdentityNodeID    string
	PrincipalARN      string
	AccountID         string
	Region            string
	ResourceKind      string
	ResourceARN       string
	ResourceName      string
	Status            string
	Confidence        float64
	ObservedCount     int
	ObservedEventIDs  []string
	Actions           []string
	SessionIDs        []string
	AgentID           string
	AgentNodeID       string
	FirstObservedAt   time.Time
	LastObservedAt    time.Time
	StaticSources     []string
	StaticEffect      string
	Conditional       bool
	CrossAccount      bool
	Caveats           []string
	EvidenceRefs      []string
	RedactionBoundary string
}

Correlation is one (identity, resource) correlation record.

type ObservedAccess

type ObservedAccess struct {
	EventID         string
	IdentityNodeID  string
	PrincipalARN    string
	AccountID       string
	Region          string
	ResourceKind    string
	ResourceARN     string
	ResourceName    string
	Action          string
	SessionID       string
	SessionNodeID   string
	AgentID         string
	AgentNodeID     string
	SourceIPAddress string
	LineageStatus   string
	ObservedAt      time.Time
	EvidenceRef     string
}

ObservedAccess is one metadata-only runtime secret-read or kms-decrypt event projected from the runtime-event contract. Every field is payload-safe.

type Result

type Result struct {
	Correlations             []Correlation
	Caveats                  []string
	ConfirmedCount           int
	ObservedWithoutGrant     int
	GrantedUnusedCount       int
	SecretCorrelationCount   int
	KMSKeyCorrelationCount   int
	IdentityCount            int
	ResourceCount            int
	ObservedAccessConsidered int
	StaticGrantsConsidered   int
}

Result is the bounded outcome of one correlation pass.

func Correlate

func Correlate(request CorrelateRequest) Result

Correlate joins observed runtime accesses with static reachability grants and returns one correlation per (identity, resource) pair. It never returns an error: documented gaps (no static path, missing data events, unresolved resource ARNs) surface as per-correlation and result-level caveats so the API layer can return a stable response.

type StaticGrant

type StaticGrant struct {
	IdentityNodeID string
	PrincipalARN   string
	AccountID      string
	Region         string
	ResourceKind   string
	ResourceARN    string
	ResourceName   string
	Source         string // key_policy | kms_grant | resource_policy
	Effect         string // Allow | Deny
	Conditional    bool
	CrossAccount   bool
	Confidence     float64
	EvidenceRef    string
	// Actions contains the raw action strings observed on this static edge.
	// When present, static actions must match each observed action
	// before an access can be confirmed for resource kinds that require
	// action authorization (Secrets Manager and KMS key).
	Actions []string
}

StaticGrant is one static reachability edge from the KMS or Secrets Manager reachability collectors, projected into a single shape the correlator can join against runtime events.

Jump to

Keyboard shortcuts

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