Code Monkey home page Code Monkey logo

safe-chat-slack-bot's Introduction

SafeChat Slack Bot codecov

Readme em Português - PTBR.

SafeChat Slack Bot is an open-source project designed to enhance data security within Slack workspaces. The bot's primary objective is to provide real-time alerts to users when sensitive information such as CPF (Brazilian taxpayer registry identification), email addresses, and other personally identifiable information (PII) are shared within Slack channels. SafeChat Slack Bot identifies and notifies users about potential data breaches, promoting a safer and more secure communication environment within Slack.

How SafeChat works

The SafeChat must be a member to receive messages from a channel or dm.

Portuguese version (pt-br)

Bot working pt-br

English version

Bot working en

Installing on workspace

Create a Slack App using manifest.json file

  1. Open https://api.slack.com/apps/new and choose "From an app manifest"
  2. Choose the workspace you want to install the application to
  3. Copy the contents of manifest.json into the text box that says Paste your manifest code here (within the JSON tab) and click Next
  4. Review the configuration and click Create
  5. Click Install to Workspace and Allow on the screen that follows. You'll then be redirected to the App Configuration dashboard.

SLACK_BOT_TOKEN and SLACK_APP_TOKEN variables

Before you can run the app, you'll need to store some environment variables.

  1. Open your apps configuration page from this list, click OAuth & Permissions in the left hand menu, then copy the Bot User OAuth Token. You will store this in your environment as SLACK_BOT_TOKEN.
  2. Click *Basic Information from the left hand menu and follow the steps in the App-Level Tokens section to create an app-level token with the connections:write scope. Copy this token. You will store this in your environment as SLACK_APP_TOKEN.

Technology and Resources

Please pay attention on pre-requisites resources that you must install/configure.

How to install, run and test

Environment variables

Variable Description Available Values Default Value Required
ENV The application enviroment dev / test / qa / prod dev Yes
PYTHONPATH Provides guidance to the Python interpreter about where to find libraries and applications ref . Yes
LANGUAGE The bot language en / pt_BR pt_BR Yes
SLACK_BOT_TOKEN The slack bot token a valid token - Yes
SLACK_APP_TOKEN The slack app token a valid token - Yes

Note: When you run the install command (using docker or locally), a .env file will be created automatically based on env.template

Command Docker Locally Description
install make docker/install make local/install to install
tests make docker/tests make local/tests to run the tests with coverage
lint make docker/lint make local/lint to run static code analysis using ruff
lint/fix make docker/lint/fix make local/lint/fix to fix files using ruff
run make docker/run make local/run to run the project
build image make docker/image/build - to build the docker image
push image make docker/image/push - to push the docker image

Helpful commands

Please, check all available commands in the Makefile for more information.

Multi Language

The Bot supports multiple languages using i18n pattern.

Locale file structure:

├─ src
│  ├─ locales
│  │  └─ en
│  │      └─ LC_MESSAGES
│  │          └─ base.po
│  │  └─ pt_BR
│  │      └─ LC_MESSAGES
│  │          └─ base.po

How to add a new language

  1. Create a new folder in src/locales with the new language;
  2. Create a new base.po file inside this folder (you just can copy from another language);
  3. Translate all the messages;
  4. Generate the mo files using the command make generate-mo-files;
  5. Include the command to generate po file on Dockerfile.

Logging

This project uses a simple way to configure the log with logging.conf to show the logs on the container output console.

Settings

This project uses a simple way to manage the settings with settings.conf and ConfigParser using a config class.

safe-chat-slack-bot's People

Contributors

dependabot[bot] avatar marcieltorres avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

safe-chat-slack-bot's Issues

Bug when edit a message and put some sensitive data

Describe the bug

When you send a message without sensitive data and right after edit this message putting some sensitive data, the bot do nothing about it.

image

To reproduce

You can send a message without sensitive data and right after edit this message putting some sensitive data

Expected behavior

The bot must be send the warning message about sensitive data.

Actual behavior

The bot do nothing about it.

A new name for this project: SafeChat

Describe the solution you would like.

slack-bot-no-cpf is a temporary name for this project, so we are searching for a new name for The Bot and SafeChat can be a good name as well. However, we should use this issue to discuss about this (or another) name. 🚀

The bot must recognize sensitive data sent within images

Describe the solution you would like.

Users often share images (such as screenshots) in public channels on Slack that may contain sensitive user data. Considering this scenario, the bot should be able to recognize sensitive data in images and also alert these users.

Describe alternatives you considered

We should use some python lib to do it, like https://github.com/tesseract-ocr/tesseract

Additional context

refs:

Sharing sensitive data

Describe the solution you would like.

The ideal of the bot is to educate people so that they do not share sensitive information through Slack. However, it may be that eventually, in a specific situation, sharing sensitive data becomes necessary. In this case, the bot could offer a safer way for sharing sensitive data in public channels.

Describe alternatives you considered

Something like @safebot /security-message sensitive data, perhaps with the possibility to share via DM as well. Anyway, there are possibilities to be explored for this feature. Perhaps exploring features similar to 1Password.

Bot multi language

Describe the solution you would like.

The Bot must be multi language to automatically adapt to other realities. We need to structure automatic translations to evolve into other languages ​​in a simple and scalable way.

Describe alternatives you considered

We must not consider to use chatGPT or similar because we don't to expose the sensitive data to external service.

  1. GNU gettext

Additional context

refs:
https://lokalise.com/blog/beginners-guide-to-python-i18n/
https://phrase.com/blog/posts/translate-python-gnu-gettext/
https://docs.python.org/pt-br/3/library/gettext.html

PTBR Docs: Readme

Describe the solution you would like.

PTBR Version:
Essa issue em especial terá uma descrição também em pt-br
Como esse bot foi concebido para atuar fortemente junto com a LGPD no Brasil, ;e uma boa estratégia criar um REAMDE resumido todo no idioma pt-br com as principais informações sobre o bot, talvez até o tópico https://github.com/marcieltorres/safe-chat-slack-bot?tab=readme-ov-file#installing-on-workspace, as demais informações são técnicas e podem continuar apenas no idioma en. Essa estratégia visa também facilitar a busca com palavras chave para o bot, ajudando quem está pesquisando em português a encontrar essa solução.

EN Version:
As this bot was designed to strongly align with LGPD in Brazil, it is a good strategy to create a summarized README entirely in Brazilian Portuguese with key information about the bot, perhaps even the topic https://github.com/marcieltorres/safe-chat-slack-bot?tab=readme-ov-file#installing-on-workspace, while keeping other information technical and in English only. This strategy also aims to facilitate keyword searches for the bot, helping those who are researching in Portuguese to find this solution.

Additional context

ref: #9

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.