Skip to main content

Monitoring Slack Enterprise Grid for exposed secrets

Project description

Slack Watchman for Enterprise Grid

Python 2.7 and 3 compatible PyPI version License: MIT

About Slack Watchman for Enterprise Grid

Slack Watchman for Enterprise Grid uses the Slack Enterprise Grid DLP API to look for potentially exposed secrets and sensitive data in Slack Enterprise Grid.

Note: Slack Watchman for Enterprise Grid is designed for Enterprise Grid subscribers of Slack only. If you use Slack without an Enterprise subscription, you can use the standard version of Slack Watchman

Features

Slack Watchman for Enterprise Grid looks for:

  • API Keys, Tokens & Service Accounts
    • AWS, Azure, GCP, Google API, Slack (keys & webhooks), Twitter, Facebook, GitHub
    • Generic Private keys
    • Access Tokens, Bearer Tokens, Client Secrets, Private Tokens
  • Files
    • Certificate files
    • Potentially interesting/malicious/sensitive files (.docm, .xlsm, .zip etc.)
    • Executable files
    • Keychain files
    • Config files for popular services (Terraform, Jenkins, OpenVPN and more)
  • Personal Data
    • Leaked passwords
    • Passport numbers, Dates of birth, Social security numbers, National insurance numbers, Drivers licence numbers (UK), Individual Taxpayer Identification Number
    • CVs, salary information
  • Financial data
    • PayPal Braintree tokens, Bank card details, IBAN numbers, CUSIP numbers
    • Budget files

It looks for this exposed data across all workspaces in the Enterprise, in the following locations:

  • Public channels
  • Private channels
  • Draft messages
  • Slack connect channels
  • Direct messages
  • Multi-person direct messages

Time based searching

Slack Watchman for Enterprise Grid can search through all messages sent in your Enterprise in the previous 24 hours. Limitations in the API, and data processing bottlenecks, don't allow for any further than 24 hours to be queried.

You can provide time periods to search for using the --hours and --minutes options at runtime. This means you can schedule running regularly, and in general little and often is the best approach.

Multiprocessing

Multiprocessing is used to search the potentially huge amount of data retrieved when getting all messages sent in an Enterprise. You can specify how many cores to use at runtime, and the more cores you use, the faster processing is generally done. That being said, you are still constrained by the API.

I have found the most efficient approach is to use between 8-12 cores.

You can specify cores using the optional flag --cores at runtime. If this flag is not set, Slack Watchman will automatically use all available cores up to a maximum of 8.

Signatures

Slack Watchman uses custom YAML signatures to detect matches in Slack. These signatures are pulled from the central Watchman Signatures repository. Slack Watchman for Enterprise Grid automatically updates its signature base at runtime to ensure its using the latest signatures to detect secrets.

Requirements

Slack API token

To run Slack Watchman for Enterprise Grid, you will need a Slack API access token that is authorised to use the Enterprise DLP API.

To do this, you need to create a Slack App and install it at the organisation level.

The app needs to have the following User Token Scopes added:

discovery:read
discovery:write
team:read
users:read

Note: discovery:read and discovery:write can only be added to an app by Slack themselves, you will need to contact your Slack CSM. They will also provide you with instructions on how to install the app at organisation level and retrieve the access token.

Providing token

Provide the token in the environment variable SLACK_WATCHMAN_EG_TOKEN

Installation

You can install the latest stable version via pip:

python3 -m pip install slack-watchman-eg

Or build from source yourself:

Download the release source files, then from the top level repository run:

python3 -m pip build
python3 -m pip install --force-reinstall dist/*.whl

Docker Image

Slack Watchman for Enterprise Grid is also available from the Docker hub as a Docker image:

docker pull papermountain/slack-watchman-eg:latest

You can then run Slack Watchman for Enterprise Grid in a container, making sure you pass the required environment variables:

// help
docker run --rm papermountain/slack-watchman-eg -h

// scan all
docker run --rm -e SLACK_WATCHMAN_EG_TOKENN=xoxp... papermountain/slack-watchman-eg --hours 1 --cores 8
docker run --rm --env-file .env papermountain/slack-watchman-eg --hours 1 --cores 8

Usage

usage: slack-watchman-eg [-h] [--hours HOURS] [--minutes MINUTES] [--output {json,terminal}] [--cores CORES] [--version] [--users] [--workspaces] [--debug] [--verbose]

Monitoring your Slack Enterprise Grid for sensitive information

options:
  -h, --help            show this help message and exit
  --hours HOURS, -hr HOURS
                        How far back to search in whole hours between 1-24. Defaults to 1 if no acceptable value given
  --minutes MINUTES, -m MINUTES
                        How far back to search in whole minutes between 1-60
  --output {json,terminal}, -o {json,terminal}
                        What logging output to use - JSON formatted output, or textual outputfor reading via terminal. Default is terminal
  --cores CORES, -c CORES
                        Number of cores to use between 1-12
  --version, -v         show program's version number and exit
  --users, -u           Return all users
  --workspaces, -w      Return all workspaces
  --debug, -d           Turn on debug level logging
  --verbose, -V         Turn on more verbose output for JSON logging. This includes more fields, but is larger

Other Watchman apps

You may be interested in the other apps in the Watchman family:

License

The source code for this project is released under the GNU General Public Licence. This project is not associated with Slack Technologies or Salesforce.

[2.0.0] - 2023-04-14

This major version release brings multiple updates to Slack Watchman for Enterprise Grid, both in usability, functionality and behind the scenes improvements.

Added

  • Support for centralised signatures from the Watchman Signatures repository. This makes it much easier to keep the signature base for all Watchman applications up to date, and to add functionality to Slack Watchman with new signatures. New signatures are downloaded, and updates to existing signatures are applied, at runtime, meaning Slack Watchman for Enterprise Grid will always be using the most up to date signatures.
  • Option for terminal optimised logging instead of JSON formatting. This is now the default when running with no output option selected, and is a lot easier for humans to read. Also, colours!
  • Option choose between verbose or succinct logging when using JSON output. Default is succinct.
  • Debug logging option

Removed

  • Support for tombstoning posts that match signatures removed
  • Local signatures - Centralised signatures mean that user-created custom signatures can't be used with Slack Watchman for Enterprise Grid anymore. If you have made a signature you think would be good for sharing with the community, feel free to add it to the Watchman Signatures repository, so it can be used in all Watchman applications
  • For the reason above, the functionality to have sandbox signatures has been removed as well

Fixed

  • Draft searches were giving an error due to not being able to populate some workspace information. This has now been fixed

[1.1.1] - 2022-05-16

Added

  • Signature to find Atlassian tokens

[1.1.0] - 2022-04-02

Added

  • Docker image now available from the Docker hub, or by building from source.
  • Support for Python 3.7
  • New logo to play nicely with dark mode

Fixed

  • More errors when importing packages

[1.0.2] - 2021-12-30

Fixed

  • Error when importing packages
  • Signatures not being included in the distribution package

[1.0.1] - 2021-12-30

Added

  • Refactor and update distribution files

[1.0.0] - 2021-12-30

  • Initial release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

slack-watchman-eg-2.0.0.tar.gz (41.4 kB view details)

Uploaded Source

Built Distribution

slack_watchman_eg-2.0.0-py3-none-any.whl (41.4 kB view details)

Uploaded Python 3

File details

Details for the file slack-watchman-eg-2.0.0.tar.gz.

File metadata

  • Download URL: slack-watchman-eg-2.0.0.tar.gz
  • Upload date:
  • Size: 41.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for slack-watchman-eg-2.0.0.tar.gz
Algorithm Hash digest
SHA256 412f43e3383d0c27fa5f4d9a063108e09848aeb98744098b9d28107bbd25365f
MD5 1768e86d6ab0844a829be3d7c20cf52d
BLAKE2b-256 d1737842d6bdf47e3d69b1546b9d9a34825f947685d8a2ca406a01cdc84c83e7

See more details on using hashes here.

File details

Details for the file slack_watchman_eg-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for slack_watchman_eg-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 edc29452c18e309b825a119b47cc5134e131b786fd21301b4d2a265891822ff3
MD5 4f79fc82b0acc5941aec209a6bed44fd
BLAKE2b-256 f5201555f84a639422398e9f2af127110ff80474ddea0d2bf9544da780be1c32

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page