> For the complete documentation index, see [llms.txt](https://docs.docontrol.io/docontrol-user-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.docontrol.io/docontrol-user-guide/risk-management/threat-model-coverage/encryption-key-sharing/slack-playbooks-for-encryption-key-sharing.md).

# Slack playbooks for encryption key sharing

Before you customize any workflows to monitor and remediate encryption key uploads in Slack, we recommend you assess your [Slack inventory](/docontrol-user-guide/risk-management/threat-model-coverage/encryption-key-sharing.md#assets-with-encryption-keys) to see exactly which file types are currently exposed in your organization.

DoControl allows you to easily implement automated workflows that notify your security team when encryption keys are uploaded to Slack. You can also define workflows to delete specific Slack files that pose a security or data exposure risk to your organization.

You can define automated workflows for these Slack use cases involving sensitive file sharing, especially for encryption key file uploads:&#x20;

* [Delete Slack file on-demand](#delete-slack-file-on-demand)
* [Remediate encryption key sharing](#remediate-encryption-key-sharing)
* [Remediate encryption key sharing in Slack files](#remediate-encryption-key-sharing-in-slack-files)
* [Remediate uploading of sensitive files to public channels](#remediate-uploading-of-sensitive-files-to-public-channels)

## Delete Slack file on-demand

You can trigger an inventory action to delete a Slack file on-demand.

{% hint style="success" %}
You can customize [inventory actions](/docontrol-user-guide/workflows/inventory-actions-quick-actions.md) to meet your organization's requirements. When you trigger the inventory action, select the relevant workflow you created.
{% endhint %}

1. In Workflows, select **Playbooks**.
2. Filter the playbooks according to Encryption key sharing, and select the **Delete Slack file on-demand** playbook.<br>

   <figure><img src="https://3236294211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MesrnyDMZGYg1V-tOBo%2Fuploads%2F8gXFCPusHDngDN6UIrus%2Fencryption%20key%20delete%20Slack%20OD.png?alt=media&amp;token=e0fbb8e5-ed59-4e31-a928-f0d9e84b6cee" alt=""><figcaption></figcaption></figure>
3. Add any actions, such as **Notify by email** or **Notify in Slack**.
4. Save the workflow with a new name.
5. When you trigger the inventory action, select the relevant workflow you created.

## Remediate encryption key sharing

If encryption key files are uploaded in a Slack message, DoControl deletes the files, and both the SecOps team and user are notified by Slack.

{% hint style="warning" %}

* This playbook is aggregated, so it runs on multiple files uploaded in a single Slack message.
* These files are permanently deleted in in near real-time and cannot be recovered.
  {% endhint %}

1. Filter the playbooks according to Encryption key sharing, and select the **Remediate encryption key sharing** playbook.

2. Under the **File shared** trigger, the condition is already populated:\
   `Asset type is encryption key`<br>

   <figure><img src="https://3236294211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MesrnyDMZGYg1V-tOBo%2Fuploads%2FRZDKynOxBqAaKxI145CC%2Fprevent%20encryption%20key%20sharing.png?alt=media&amp;token=5125a72d-d30a-4574-93ce-09add952d761" alt=""><figcaption></figcaption></figure>

3. Add any relevant conditions.

4. The **Delete file** action automatically deletes any encryption key files.&#x20;

5. Customize the **Notify in Slack** step to send a message to the SecOps team that a user shared an encryption key file in a Slack channel, and that the file was deleted.

6. Customize the **Notify in Slack** step to send a message to the user that they shared an encryption key file in a Slack channel, and that the file was deleted.

## Remediate encryption key sharing in Slack files

When multiple files are uploaded in a Slack message, DoControl scans the content for encryption keys. If an encryption key is found, the file is deleted, and both the SecOps team and user are notified by Slack.

{% hint style="warning" %}

* This playbook is aggregated, so it runs on multiple files uploaded in a single Slack message.
* These files are permanently deleted in in near real-time and cannot be recovered.
  {% endhint %}

1. Filter the playbooks according to Encryption key sharing, and select the **Remediate encryption key sharing in Slack files** playbook.
2. Under the **File shared** trigger, the condition is already populated:\
   `Asset type supports scanning`<br>

   <figure><img src="https://3236294211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MesrnyDMZGYg1V-tOBo%2Fuploads%2FGRFOuEhkfN5QnzG7W98B%2Fprevent%20sharing%20keys%20Slack%20files.png?alt=media&amp;token=4fdb0d25-deb1-45c2-9e52-758d2fe8d935" alt=""><figcaption></figcaption></figure>
3. Add any relevant conditions.
4. The **Regex scan** action is pre-populated to scan file content for encryption keys:
   * **Asset ID** - Already populated
   * **Lexical list or patterns** - Scans for cryptographic private key
   * **Error handling** - Select how to continue in case of an error
5. The **Delete file** action automatically deletes any files containing regex patterns for cryptographic private keys.
6. Customize the **Notify in Slack** step to send a message to the SecOps team that a user shared an encryption key file in a Slack channel, and that the file was deleted.
7. Customize the **Notify in Slack** step to send a message to the user that they shared an encryption key file in a Slack channel, and that the file was deleted.

## Remediate uploading of sensitive files to public channels

When someone uploads a sensitive file containing code to Slack, the security team is notified by Slack and the file is deleted.

{% hint style="warning" %}
These files are permanently deleted in in near real-time and cannot be recovered.
{% endhint %}

1. In Workflows, select **Playbooks**.
2. Filter the playbooks according to the Slack app, and select the **Remediate uploading of sensitive files to public channels** playbook.
3. Give an action name.
4. Under the **File shared** event, customize the conditions as necessary:\
   `event.rawData.body.fileInfo.file.pretty_type` equals Python or Shell or Java or PowerShell or SQL or YAML.<br>

   <figure><img src="https://3236294211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MesrnyDMZGYg1V-tOBo%2Fuploads%2FUcOcf8zb2ayn1DJrMGg4%2FSlack%20prevent%20upload%20PB.png?alt=media&amp;token=6499f29c-bd52-48ee-b7f6-4fb9a330023f" alt=""><figcaption></figcaption></figure>
5. Add any relevant conditions.
6. Customize the Slack message to send to the Security team, notifying them that a sensitive code file was uploaded to a public Slack channel.\
   \
   The file is automatically deleted from the Slack channel.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.docontrol.io/docontrol-user-guide/risk-management/threat-model-coverage/encryption-key-sharing/slack-playbooks-for-encryption-key-sharing.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
