Documentation
¶
Overview ¶
Package s3access correlates observed S3 runtime data access (read / write / list events) with the static reachability edges Identrail already discovered (S3 bucket-policy `can_access` grants) and the bucket's exposure / sensitivity classification. The output ties observed behavior back to identity, session, bucket, and agent context so an operator can answer, per (identity, bucket) pair:
- confirmed: the identity was statically allowed to reach the bucket AND was observed doing so. Behavior matches policy.
- observed_without_grant: the identity was observed accessing the bucket but no static allow edge explains it. Most S3 access is authorized by IAM identity policies, which this wave's static collector does not enumerate, or it 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 S3 GetObject/PutObject are CloudTrail *data* events; absence in a management-event lookup is not proof the access never happened.
On top of the reachability join, the correlation records the observed access *modes* (read / write / list) and flags when an observed mode exceeds what the static grant authorizes, and elevates a caveat when a sensitive or publicly/cross-account exposed bucket is involved.
Safety boundary: the engine is metadata-only and, specifically for S3, never sees object keys or object contents. The API adapter redacts object keys into bounded "safe prefixes" before they reach the engine, and every emitted correlation re-stamps the redaction boundary so downstream consumers cannot mistake it for payload-bearing evidence.
Index ¶
Constants ¶
const ( StatusConfirmed = "confirmed" StatusObservedWithoutGrant = "observed_without_grant" StatusGrantedUnused = "granted_unused" )
Correlation statuses — the operator-facing classification of a single (identity, bucket) correlation.
const ( ModeRead = "read" ModeWrite = "write" ModeList = "list" )
Access modes. Each observed S3 event and each static grant is reduced to the set of modes it represents.
const ( // CollectorName tags every diagnostic and result the correlator // emits so the API layer can scope diagnostics by collector. CollectorName = "aws_s3_runtime_access" // RedactionBoundary documents that the correlator only ever crossed // the metadata boundary — no object keys, no object contents. RedactionBoundary = "metadata_only_no_object_keys_no_object_contents" )
const ( CaveatDataEventCoverage = "runtime_data_events_may_be_incomplete" CaveatNoStaticPath = "no_static_reachability_edge" CaveatObservedDespiteDeny = "observed_despite_explicit_deny" CaveatModeExceedsGrant = "observed_mode_exceeds_grant" CaveatConditionalGrant = "static_grant_is_conditional" CaveatCrossAccountGrant = "static_grant_is_cross_account" CaveatLineageUnresolved = "session_lineage_unresolved" CaveatSensitiveExposed = "sensitive_bucket_publicly_or_cross_account_exposed" )
Caveat codes attached to individual correlations or the result. Stable tokens so the UI and downstream consumers can branch without string-matching prose.
const ResourceKind = "s3_bucket"
ResourceKind is fixed for this engine: every correlation is keyed to an S3 bucket (object keys are redacted into safe prefixes, never used as a join key).
const SourceBucketPolicy = "bucket_policy"
Static grant source.
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 S3 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
BucketARN string
BucketName string
Status string
Confidence float64
ObservedCount int
ObservedEventIDs []string
ObservedModes []string
GrantedModes []string
SafePrefixes []string
Actions []string
SessionIDs []string
AgentID string
AgentNodeID string
FirstObservedAt time.Time
LastObservedAt time.Time
StaticSources []string
StaticEffect string
Exposure string
Sensitivity string
Conditional bool
CrossAccount bool
Caveats []string
EvidenceRefs []string
RedactionBoundary string
}
Correlation is one (identity, bucket) correlation record.
type ObservedAccess ¶
type ObservedAccess struct {
EventID string
IdentityNodeID string
PrincipalARN string
AccountID string
Region string
BucketARN string
BucketName string
AccessMode string
SafePrefixes []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 S3 runtime access projected from the runtime-event contract. ResourceARN is always the bucket ARN; the object key has already been redacted into SafePrefixes by the caller.
type Result ¶
type Result struct {
Correlations []Correlation
Caveats []string
ConfirmedCount int
ObservedWithoutGrant int
GrantedUnusedCount int
ReadCount int
WriteCount int
ListCount int
SensitiveExposedCount int
ModeExceedsGrantCount int
IdentityCount int
BucketCount int
ObservedAccessConsidered int
StaticGrantsConsidered int
}
Result is the bounded outcome of one correlation pass.
func Correlate ¶
func Correlate(request CorrelateRequest) Result
Correlate joins observed S3 runtime accesses with static reachability grants and returns one correlation per (identity, bucket) pair. It never returns an error: documented gaps (no static path, missing data events) 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
BucketARN string
BucketName string
AllowedModes []string
Source string // bucket_policy
Effect string // Allow | Deny
Conditional bool
CrossAccount bool
Exposure string
Sensitivity string
Confidence float64
EvidenceRef string
}
StaticGrant is one static reachability edge from the S3 bucket reachability collector, projected for the join.