scoperepair

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrStorageObjectNotFound = errors.New("storage object not found")

Functions

This section is empty.

Types

type ApplyResult

type ApplyResult struct {
	Report      Report `json:"report"`
	Mutated     int    `json:"mutated"`
	Skipped     int    `json:"skipped"`
	AutoFixable int    `json:"auto_fixable"`
}

type DuplicateCollapser

type DuplicateCollapser interface {
	Collapse(context.Context, string, string) (int, error)
}

type Finding

type Finding struct {
	Kind                 FindingKind `json:"kind"`
	Severity             Severity    `json:"severity"`
	ObjectID             string      `json:"object_id"`
	SHA256               string      `json:"sha256,omitempty"`
	Organization         string      `json:"organization,omitempty"`
	Project              string      `json:"project,omitempty"`
	CurrentAccessURLs    []string    `json:"current_access_urls,omitempty"`
	ProposedCanonicalURL string      `json:"proposed_canonical_url,omitempty"`
	AutoFixable          bool        `json:"auto_fixable"`
	Message              string      `json:"message,omitempty"`
}

type FindingKind

type FindingKind string
const (
	FindingLegacyAccessURLRemovable  FindingKind = "legacy_access_url_removable"
	FindingLegacyAccessURLRewritable FindingKind = "legacy_access_url_rewritable"
	FindingNonCanonicalAccessURL     FindingKind = "non_canonical_access_url"
	FindingMissingControlledAccess   FindingKind = "missing_controlled_access"
	FindingDuplicateSHA256Sibling    FindingKind = "duplicate_sha256_sibling"
	FindingStorageObjectMissing      FindingKind = "storage_object_missing"
	FindingStorageProbeError         FindingKind = "storage_probe_error"
)

type ObjectReport

type ObjectReport struct {
	ObjectID             string    `json:"object_id"`
	SHA256               string    `json:"sha256,omitempty"`
	Organization         string    `json:"organization,omitempty"`
	Project              string    `json:"project,omitempty"`
	CurrentAccessURLs    []string  `json:"current_access_urls,omitempty"`
	ProposedCanonicalURL string    `json:"proposed_canonical_url,omitempty"`
	AutoFixable          bool      `json:"auto_fixable"`
	Findings             []Finding `json:"findings,omitempty"`
}

type Options

type Options struct {
	Organization string
	Project      string
	CheckStorage bool
	Format       string
	Limit        int
	PageSize     int
}

type PreparedRecordQuery

type PreparedRecordQuery struct {
	Limit        int
	Start        string
	Organization string
	Project      string
}

type PreparedRecordReader

type PreparedRecordReader interface {
	ListPrepared(context.Context, PreparedRecordQuery) ([]objects.Record, error)
}

type ReferenceWriter

type ReferenceWriter interface {
	Update(context.Context, objects.RecordID, objects.Record) error
}

type Report

type Report struct {
	Organization string         `json:"organization,omitempty"`
	Project      string         `json:"project,omitempty"`
	Scanned      int            `json:"scanned"`
	Objects      []ObjectReport `json:"objects,omitempty"`
}

func (Report) FindingCount

func (r Report) FindingCount() int

type ScopeReader

type ScopeReader interface {
	ListCredentials(context.Context) ([]buckets.Credential, error)
	ListScopes(context.Context, string) ([]buckets.Scope, error)
}

ScopeReader returns only S3 credentials and the scopes attached to each credential. The adapter performs any credential-id/bucket alias resolution.

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(records PreparedRecordReader, writer ReferenceWriter, scopes ScopeReader, probe StorageProbe, collapser DuplicateCollapser) *Service

func (*Service) Apply

func (s *Service) Apply(ctx context.Context, options Options) (ApplyResult, error)

func (*Service) Audit

func (s *Service) Audit(ctx context.Context, options Options) (Report, error)

type Severity

type Severity string
const (
	SeverityInfo  Severity = "info"
	SeverityWarn  Severity = "warn"
	SeverityError Severity = "error"
)

type StorageInspectRequest

type StorageInspectRequest struct {
	Organization string
	Project      string
	ObjectURL    string
}

type StorageInspectResult

type StorageInspectResult struct {
	ObjectURL string
}

type StorageProbe

type StorageProbe interface {
	Inspect(context.Context, StorageInspectRequest) (StorageInspectResult, error)
}

Jump to

Keyboard shortcuts

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