s3

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package s3 provides an AWS S3 bucket scan source.

Package s3 provides an AWS S3 bucket scan source.

S3Source implements the source.Source interface, listing and downloading objects from an S3 bucket and emitting them as chunks for secret scanning.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*S3Source)

Option configures an S3Source.

func WithBufferSize

func WithBufferSize(size int) Option

WithBufferSize sets the channel buffer size for the chunk channel.

func WithExcludePaths

func WithExcludePaths(patterns []string) Option

WithExcludePaths sets glob patterns for object keys to exclude from scanning. Patterns are matched against each object's key (the object's path within the bucket), mirroring filesystem.WithExcludePaths semantics.

func WithMaxFileSize

func WithMaxFileSize(size int64) Option

WithMaxFileSize sets the maximum object size to download and scan. Objects larger than this value are skipped. Values less than or equal to zero are ignored, preserving the default.

func WithPrefix

func WithPrefix(prefix string) Option

WithPrefix limits the scan to objects matching the given key prefix.

func WithRegion

func WithRegion(region string) Option

WithRegion sets the AWS region for the S3 client.

type S3Source

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

S3Source scans objects in an AWS S3 bucket for leaked secrets.

func New

func New(bucket string, opts ...Option) *S3Source

New creates a new S3Source for the given bucket. Use functional options to configure prefix filtering, max file size, etc.

func (*S3Source) Chunks

func (s *S3Source) Chunks(ctx context.Context) <-chan source.Chunk

Chunks lists objects in the S3 bucket and sends their contents over a channel. The channel is closed when all objects have been processed or the context is cancelled.

func (*S3Source) Err added in v1.7.0

func (s *S3Source) Err() error

Err returns the first terminal error that aborted S3 listing, or nil if it completed normally. It must only be called after the channel returned by Chunks has been fully drained (closed).

func (*S3Source) Type

func (s *S3Source) Type() string

Type returns the source type identifier.

func (*S3Source) Validate

func (s *S3Source) Validate() error

Validate checks that the S3 bucket is accessible. It initializes the AWS client if not already set and performs a HeadBucket call.

Jump to

Keyboard shortcuts

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