slack

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 slack provides a Slack workspace scan source.

SlackSource implements the source.Source interface, listing channels and reading message history from a Slack workspace, emitting messages as chunks for secret scanning.

Package slack provides a Slack workspace scan source.

Package slack provides a Slack workspace scan source.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*SlackSource)

Option configures a SlackSource.

func WithBufferSize

func WithBufferSize(size int) Option

WithBufferSize sets the channel buffer size for the chunk channel.

func WithChannels

func WithChannels(channels []string) Option

WithChannels limits the scan to the specified channel names (e.g. "engineering"), matching the names shown in Slack and accepted by the --channels CLI flag.

func WithExcludeChannels

func WithExcludeChannels(channels []string) Option

WithExcludeChannels excludes the specified channel names from scanning, matching the names shown in Slack and accepted by the --exclude-channels CLI flag.

func WithIncludeDMs

func WithIncludeDMs(include bool) Option

WithIncludeDMs enables or disables scanning of direct messages.

func WithIncludeFiles

func WithIncludeFiles(include bool) Option

WithIncludeFiles requests scanning of file content.

NOTE: Slack file scanning is not yet implemented. This option is currently a no-op for actual scanning behavior (only message text is scanned); enabling it causes a warning to be logged. See ROADMAP and the planned-feature note in slack.go.

func WithRateLimit

func WithRateLimit(rps float64) Option

WithRateLimit sets the Slack API rate limit in requests per second.

func WithSince

func WithSince(t time.Time) Option

WithSince limits the scan to messages after the given time.

type SlackSource

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

SlackSource scans messages in a Slack workspace for leaked secrets.

func New

func New(token string, opts ...Option) *SlackSource

New creates a new SlackSource for the given workspace token. Use functional options to configure channel filtering, rate limits, etc.

func (*SlackSource) Chunks

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

Chunks lists channels in the workspace and sends message contents over a channel. The channel is closed when all messages have been processed or the context is cancelled.

func (*SlackSource) Err added in v1.7.0

func (s *SlackSource) Err() error

Err returns the first terminal error that aborted the Slack scan, or nil if it completed normally. Any error stored here has the workspace token redacted, so it can never leak the credential. It must only be called after the channel returned by Chunks has been fully drained (closed).

func (*SlackSource) Type

func (s *SlackSource) Type() string

Type returns the source type identifier.

func (*SlackSource) Validate

func (s *SlackSource) Validate() error

Validate checks that the Slack token is valid by calling AuthTest.

Jump to

Keyboard shortcuts

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