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
- type Option
- func WithBufferSize(size int) Option
- func WithChannels(channels []string) Option
- func WithExcludeChannels(channels []string) Option
- func WithIncludeDMs(include bool) Option
- func WithIncludeFiles(include bool) Option
- func WithMaxFileSize(size int64) Option
- func WithRateLimit(rps float64) Option
- func WithSince(t time.Time) Option
- type SlackSource
Constants ¶
const ( // DefaultRateLimit matches Slack's lowest published conversations.history // contract for newly distributed non-Marketplace apps: one request/minute. // Marketplace and internal customer-built apps can raise it explicitly. DefaultRateLimit = 1.0 / 60.0 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*SlackSource)
Option configures a SlackSource.
func WithBufferSize ¶
WithBufferSize sets the channel buffer size for the chunk channel.
func WithChannels ¶
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 ¶
WithExcludeChannels excludes the specified channel names from scanning, matching the names shown in Slack and accepted by the --exclude-channels CLI flag.
func WithIncludeDMs ¶
WithIncludeDMs enables or disables scanning of direct messages.
func WithIncludeFiles ¶
WithIncludeFiles enables bounded scanning of text-like files attached to messages. The token needs Slack's files:read scope.
func WithMaxFileSize ¶ added in v1.8.0
WithMaxFileSize sets the maximum attachment size buffered for scanning.
func WithRateLimit ¶
WithRateLimit overrides each operation-scoped Slack limiter with the same requests-per-second ceiling. Defaults remain operation-specific.
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.