# Privado

## What is Privado?

Privado is an open source static code analysis tool to discover data flows in the code. It detects the personal data being processed, and further maps the journey of the data from the point of collection to going to interesting sinks such as third parties, databases, logs, and internal APIs.

## Who is it for?

1. Privacy Engineers
2. Data Protection Engineers
3. Data Governance Engineers
4. Security Engineers
5. Mobile App Developers
6. Developers

## How does it help?

Privado lets an engineer ask contextual questions on usage of sensitive data at scale

<figure><img src="/files/Sz2WPDjOZA3Oml3so501" alt=""><figcaption></figcaption></figure>

## Use cases

1. Generate and maintain Data map and Record of Processing Activity Reports ( Article-30 Reports )
2. Automate the generation of the data-flow diagrams
3. Identify and remove data leaks
4. Improve data storage security by identifying and fixing insecure practices
5. Finding and fixing unaccounted third-party sharing of data
6. Establish and enforce Data Protection and Governance policies
7. Generate Android Data Safety Report
8. Incorporate various GDPR, CCPA, SOC, ISO, HIPAA, PCI controls
9. Do continuous monitoring for privacy and data issues
10. Implement Privacy by Design

## How does Privado work?

Privado can be run locally on your computer or in your CI/CD pipeline. During the scanning process, Privado creates a knowledge graph of personal data flows. You never have to worry about your code leaving your machine since the scan is local. An output file is stored in JSON format. The results can be viewed on Privado Cloud Dashboard.

## What does the scan discover?

Upon scanning a repository, Privado will discover the following information in the code and presents it in a nice dashboard for your review.

* Data Elements
* Data Flow Diagrams
* Data Inventory
* Code Analysis
* Issues

![](/files/Q08LfkaSsFqb8boMpnbT)

## What can I do with Privado?

Apart from getting a comprehensive outlook of your data practices for Privacy Audits, you can also use the tool to generate various privacy reports to comply with privacy laws like GDPR and CCPA.

### Record of Processing Activity ( ROPA ) Report

Our free cloud platform can be used to generate RoPA reports for a single, as well as a combination of repositories added to the platform. Check out how to create a RoPA report for your repository.

### Data Safety Report

Data Safety Report is a privacy form that is needed to publish any Android app on the Play Store. Currently, to fill the data safety form developers have to ask around in the team to find what data they are collecting, spend hours reading the documentation of SDKs to find data shared, and navigate the complex Playstore form. With our scan, we pre-fill data types collected, shared, and guide you with our wizard to generate the data safety report.

## Supported languages

We support Java in GA and Python in alpha. Our Enterprise offering covers all programming languages, and we're working on adding support for more languages to OSS. Support for JS/TS is coming soon!

## Contribute

If you love this project and would like to contribute, please check out our [contribution page](/extra/contributing)


# Quick Start

Follow these 4 simple steps to get started with Privado

### Install and start Docker

Make sure you have docker installed and running. [Docker download page](https://docs.docker.com/get-docker/)

### Download Privado CLI

```
curl -o- https://raw.githubusercontent.com/Privado-Inc/privado-cli/main/install.sh | bash
```

### Scan your repository

```
privado scan <source directory>
```

{% hint style="info" %}
You can download and use this [sample application](https://github.com/saurabh-sudo/BankingSystem-Backend) to test Privado
{% endhint %}

### Get results

The results are generated at `<source directory>/.privado/privado.json`

## Visualize results

To visualize the results and generate reports, you can create a free account at the end of a successful scan. Once a scan is complete, it will ask your permission to synchronize the generated results with Privado Cloud Dashboard. Note that **no code is sent to the cloud**. Upon successful sync, you can view the results on our free platform.


# Running a Scan

{% hint style="info" %}
**Requirements:** Privado requires Docker and an Internet connection for fetching its scanning engine (provided as Docker images) for the first time. To install docker, you can follow the steps stated in the [official documentation](https://docs.docker.com/engine/install/). Linux users should also follow docker [post installation steps](https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user) in order to run Privado CLI without root (`sudo`) privileges.
{% endhint %}

The simplest way to run a Privado scan is by just doing,

```bash
privado scan <source directory>
```

This begins analyzing the app, fetching/updating the analysis engine and then performing the scan of target source directory locally.

<figure><img src="/files/8wuZgk4RiD1kLSfI2ujh" alt=""><figcaption></figcaption></figure>

Upon completion, results are generated locally under `<source directory>/.privado/privado.json` file. This file contains all the information such as discovered data elements, data inventory, data flows to 3rd party, logs, and other sensitive sinks etc. Optionally, when configured, the scan can also send its results to Privado dashboard for visualisation. To know more about how to view results on dashboard, click here.

## Advanced Scan Options

You can view all advanced options using `privado scan --help` and can be run using `privado scan <source directory> [OPTIONS]` A few of the options are summarized below

| `--config`                   | Specifies the config (with rules) directory to be passed to privado-core for scanning. These external rules and configurations are merged with the default set that Privado defines                                                                                                                                                | To know more about what Privado Rules are, click here.             |
| ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ |
| `--debug`                    | Shows debug information while running                                                                                                                                                                                                                                                                                              |                                                                    |
| `--upload`                   | If specified, will automatically attempt to upload the scan result to Privado Dashboard                                                                                                                                                                                                                                            |                                                                    |
| `--skip-upload`              | If specified, the result artifacts will not be uploaded to Privado Dashboard                                                                                                                                                                                                                                                       |                                                                    |
| `--disable-deduplication`    | When specified, the engine does not remove duplicate and subset dataflows. This option is useful if you wish to review all flows (including duplicates) manually. When specified, the engine does not remove duplicate and subset dataflows. This option is useful if you wish to review all flows (including duplicates) manually | To know more about how to view and understand results, click here. |
| `--ignore-default-rules`     | If specified, the default rules are ignored and only the specified rules via configuration are considered                                                                                                                                                                                                                          | To know more about what Privado Rules are, click here.             |
| `--overwrite`                | If specified, the warning prompt for existing scan results is disabled and any existing results are overwritten                                                                                                                                                                                                                    |                                                                    |
| `--skip-dependency-download` | Occasionally for Java projects, Privado would require dependencies to be downloaded for a more deeper analysis if local dependencies are not available. If an analysis takes unacceptable amount of time due to network latency, this option can be used to skip dependency downloads at the cost of incomplete results            |                                                                    |

## Troubleshooting

### Scan Time Out

While Privado scans rarely take more than 7 minutes even for very large java repositories, static analysis due to its nature can be a resource intensive process. If your scan is timing out, try the following approaches to manage resources used by Docker and JVM:

1. Limit the RAM consumed by docker. Reference: Runtime options with Memory, CPUs, and GPUs]\(<https://docs.docker.com/config/containers/resource\\_constraints/>)
2. Specific to Java, we can also set the env variables of docker according to host machine configuration, Reference: How To Configure Java Heap Size Inside a Docker Container | Baeldung]\(<https://www.baeldung.com/ops/docker-jvm-heap-size>)


# Understanding Results

When a scan is complete, by default a local result file (`<source directory>/.privado/privado.json`) is generated. This result file contains details of what all Privado found while scanning your code - this includes data elements, data flows, inventory of 3rd party sinks etc. To know more about what is inside `privado.json` head to [this section.](#privado.json)

## Privado Dashboard

When configured, results can also be directly shown o the Privado’s cloud dashboard for better analysis. Let’s see what all we can see in the dashboard.

## Data Elements

These are personal data elements that are being collected, processed, or shared in the code.

![Example data elements found in a repository scan](/files/V3r3SWwdnEexbCYKEhDD)

## Data Flow Diagrams

They show detailed usage of any particular data element, making it easier to understand data flows and identify privacy and security risks.

![](/files/rjQU5BGtmLdWDJmhwHBT)

## Data Inventory

These are either third parties where the data is being shared for processing or databases where it is being stored.

![Example data inventory found in a repository scan](/files/oLS5kdD75K55tSCgNTDo)

## Code Analysis

For developers, it also generates a line-by-line flow of the data element for easy identification of the detected flow.

![](/files/1YNIus9FvlxbTGB0rhvo)

## Issues

Privacy and data security threats, and compliance policy violations result into issues. Threat issues can be directly mitigated by applying the code fix. Example: Email and Date of Birth are logged as plain text in the log file. The guidance is provided to developers on how to fix the issues. The compliance issues are result of the governing policies such as no application can access credit card data except “payment” micro-service.

Check out some of our blogs on how these issues can sometimes lead to big problems. (links to case studies on data leaks)

![](/files/1DPv1M6PKQygwSIAi3v7)

## privado.json

With all the results neatly compiled in a JSON file, it enables developers to extract other useful information from the code scan to create their own analysis. The resulting privado.json file looks something like this,

<figure><img src="/files/dUTCeRJdqkc4316zsUKw" alt=""><figcaption></figcaption></figure>


# Command Reference

Use `privado --help` for a list of available commands

| Command   | Description                                                                              | Usage                                  | Supported flags                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| --------- | ---------------------------------------------------------------------------------------- | -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `scan`    | Scan a codebase or repository to identify privacy issues and generate compliance reports | `privado scan <repository> [flags]`    | <p><code>-c</code>, <code>--config</code> string: Specifies the config (with rules) directory to be passed to privado-core for scanning. These external rules and configurations are merged with the default set that Privado defines<br><br><code>--disable-deduplication</code> When specified, the engine does not remove duplicate and subset dataflows. This option is useful if you wish to review all flows (including duplicates) manually<br><br><code>-h</code>, <code>--help</code>: help for scan<br><br><code>-i</code>, <code>--ignore-default-rules</code>: If specified, the default rules are ignored and only the specified rules (-r) are considered<br><br><code>--overwrite</code>: If specified, the warning prompt for existing scan results is disabled and any existing results are overwritten<br><br><code>--skip-dependency-download</code>: When specified, the engine skips downloading all locally unavailable dependencies. Skipping dependency download can yield incomplete results<br><br><code>--upload</code> :<br>If specified, will automatically attempt to upload the scan result to Privado Dashboard<br><br><code>--skip-upload</code> :<br>If specified, the result artifacts will not be uploaded to Privado Dashboard<br><br><code>--debug</code>:<br>To enable process debug output for debugging purposes</p> |
| `config`  | List, enable, or disable telemetry for Privado CLI                                       | `privado config <List/enable/disable>` | `-h`, `--help`: Help for config                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `help`    | Help provides help for any command in the application.                                   | `privado help [command]`               | `-h`, `--help`: Help for help                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `update`  | Check for latest release and update to the latest version Privado CLI                    | `privado update [flags]`               | `-h`, `--help`: Help for update                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `version` | Print the current version of Privado CLI                                                 | `privado version [flags]`              | `-h, --help`: Help for version                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `upload`  | Sync the results of scan with Privado Dashboard                                          | `privado upload <repository> [flags]`  | `-h, --help`: Help for version                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |


# Understanding privado.json

Privado saves the scan results in a JSON file, `.privado/privado.json` in the repository directory where you ran the scan. The JSON contains all the information generated by the scan. the structure of the file can be interpreted as follows:

<figure><img src="/files/geagF941LZeG4pFH1HdN" alt=""><figcaption></figcaption></figure>

The `privado.json` structures the results into 5 sections excluding the metadata about the repository. This file can be imported into the Privado Dashboard for visualization or fed into any custom integrations like Slack, JIRA, or SIEM Tools To understand the structure of each section of the result, check out the following docs:

* [Sources](/getting-started-with-privado/understanding-privado-json/sources)
* [Processing](/getting-started-with-privado/understanding-privado-json/processing)
* [Data Flows](/getting-started-with-privado/understanding-privado-json/data-flow)
* [Collections](/getting-started-with-privado/understanding-privado-json/collections)
* [Violations](/getting-started-with-privado/understanding-privado-json/violations)


# Sources

Sources are the starting points of a data element in a data flow. This includes places like user inputs, database queries, or API collections.

A source result consists of the following structure:

```json
{
    "sources": {
        "sourceType": "string",
        "id": "string",
        "name": "string",
        "category": "string",
        "sensitivity": "string",
        "isSensitive": "boolean",
        "tags": [
            {
                "key": "value"
            }
        ]
    }
}
```

The parameters are explained below:

| **Field**     | **Description**                                         |
| ------------- | ------------------------------------------------------- |
| `sourceType`  | The type of source detected                             |
| `id`          | ID of the source                                        |
| `name`        | Name of the source                                      |
| `category`    | category of the source                                  |
| `sensitivity` | Sensitivity of the source                               |
| `isSensitive` | Boolean indicating if the field is sensitive            |
| `tags`        | Key value pairs to attach further context to the source |


# Processing

Processing results summarises all the occurrences of detected data elements that are found in the scan.

A processing result consists of the following structure:

```json
{
    "processing": {
        "sourceId": "string",
        "occurrences": [
            {
                "sample": "string",
                "lineNumber": "int",
                "columnNumber": "int",
                "fileName": "string",
                "excerpt": "string"
            }
        ]
    }
}
```

The parameters are explained below:

| **Field**      | **Description**                                           |
| -------------- | --------------------------------------------------------- |
| `sourceId`     | ID of the source                                          |
| `occurrences`  | List of occurrences of the data element in the code       |
| `sample`       | name of the entity in which the data element is processed |
| `lineNumber`   | Line number of the occurance                              |
| `columnNumber` | Column number of the occurance                            |
| `fileName`     | Name of the file where the occurrence is detected         |
| `excerpt`      | A dump of the code around the occurrence                  |


# Data Flow

Data flows are the journey of a data element within the codebase. It maps out the journey of a data element from a source to a sink detected via static code analysis.

A data flow result consists of the following structure:

```json
{
    "dataFlow": {
        "third_parties": <DataFlow>,
        "leakages": <DataFlow>,
        "storages": <DataFlow>,
        "internal_apis": <DataFlow>,
        "miscellaneous": <DataFlow>
    }
}
```

The structure of all data flow representations is similar. As an example, the following is the structure of a storage sink:

```json
{
    "storages": [
        "sourceId": "string",
        "sinks": [
            {
                "sinkType": "string",
                "id": "string",
                "name": "string",
                "isSensitive": "boolean",
                "paths": [
                    {
                        "pathId": "string",
                        "path": [
                            {
                                "sample": "string",
                                "lineNumber": "int",
                                "columnNumber": "int",
                                "fileName": "string",
                                "excerpt": "string"
                            }
                        ]
                    }
                ]
            }
        ]
    ]
}
```

The parameters of the results are explained below:

| **Field**       | **Description**                                |
| --------------- | ---------------------------------------------- |
| `third_parties` | Third parties that are consuming data elements |
| `leakages`      | Leakages that are consuming data elements      |
| `storages`      | Databases that are consuming data elements     |
| `internal_apis` | Internal APIs that are consuming data elements |
| `miscellaneous` | Miscellaneous data flows                       |

The parameters of a data flow results are explained below:

| **Field**      | **Description**                                                |
| -------------- | -------------------------------------------------------------- |
| `sourceId`     | ID of the source which is processed                            |
| `sinks`        | A list of sinks that are detected in a particular type of sink |
| `sinkType`     | The type of sink                                               |
| `sinks.Id`     | ID of the sink                                                 |
| `name`         | Name of the sink                                               |
| `isSensitive`  | Boolean value indicating if the data element is sensitive      |
| `paths`        | A list of paths defining the data flow of the element          |
| `pathId`       | Unique ID of the path                                          |
| `path`         | An occurrence of a data element                                |
| `sample`       | name of the entity in which the data element is processed      |
| `lineNumber`   | Line number of the occurance                                   |
| `columnNumber` | Column number of the occurance                                 |
| `fileName`     | Name of the file where the occurrence is detected              |
| `excerpt`      | A dump of the code around the occurrence                       |


# Collections

Collections indicate all the API data collections that are present in the codebase.

A collection result consists of the following structure:

```json
{
    "collections": [
        {
            "collectionId": "string",
            "name": "string",
            "isSensitive": "boolean",
            "collections": [
                {
                    "sourceId": "string",
                    "occurences": [
                        {
                            "endPoint": "string",
                            "sample": "string",
                            "lineNumber": "int",
                            "columnNumber": "int",
                            "fileName": "string",
                            "excerpt": "string"
                        }
                    ]
                }
            ]
        }
    ]
}
```

The parameters are explained below:

| **Field**      | **Description**                                           |
| -------------- | --------------------------------------------------------- |
| `collectionId` | ID of the collection which is detected                    |
| `name`         | Name of the collection                                    |
| `isSensitive`  | Boolean indicating if the field is sensitive              |
| `collections`  | List of collections of the data element found in the code |
| `sourceId`     | ID of the source which is collected                       |
| `occurences`   | List of occurrences of the data element in the code       |
| `endPoint`     | Endpoint of the API                                       |
| `sample`       | name of the entity which is processed in API              |
| `lineNumber`   | Line number of the occurance                              |
| `columnNumber` | Column number of the occurance                            |
| `fileName`     | Name of the file where the occurrence is detected         |
| `excerpt`      | A dump of the code around the occurrence                  |


# Violations

A Violation is a privacy risk identified within the code that could potentially cause a data leak. They are also detected based on certain custom rules declared during the scan. To know more about the rules, [click here](/understanding-rules/understanding-rules).

A violation result consists of the following structure:

```json
"violations": [
    {
        "policyId" : "string",
          "policyDetails" : {
            "name" : "string",
            "policyType" : "string",
            "description" : "string",
            "fix" : "string",
            "tags" : {
                "key": "value"
            }
        }
    }
]
```

The parameters are explained below:

<table data-header-hidden><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><strong>Field</strong></td><td><strong>Description</strong></td></tr><tr><td><code>policyId</code></td><td>ID of the policy which is violated</td></tr><tr><td><code>policyDetails</code></td><td>Object containing details about the violation</td></tr><tr><td><code>name</code></td><td>name of the violation which is detected</td></tr><tr><td><pre><code>policyType
</code></pre></td><td>Type of the policy which can be either threat or compliance</td></tr><tr><td><code>description</code></td><td>A brief description about the violation</td></tr><tr><td><code>fix</code></td><td>A detailed description of how to resolve the violation</td></tr><tr><td><code>tags</code></td><td>Key-value pairs to add more context to the violation</td></tr></tbody></table>


# What are Rules?

Privado has rules to answer contextual questions related to personal data. The journey of tracking data starts from "sources". Sources are where data dictionary is defined. Privado identifies the variables, classes and structures matching sources and tracks the flows to third parties, databases and leakages which are called as "sinks". Threats are code or configuration implementation which have direct impact on data security and privacy. Policies allow you to enforce compliance and data governance rules. The rules present a single *common language* which embed the knowledge of a privacy and data researcher about sources, sinks, data policies, threats to drive the code analysis engine

### Rule Structure

All Privado rules are defined in YAML format and generally have the following structure:

<figure><img src="/files/w8LDfHHnAtlWQNvLdrBO" alt=""><figcaption></figcaption></figure>

The structure of a *rule* varies a bit based on the types of rules that are defined. For example,

1. Source rules contains `isSensitive` as well as `sensitivity` keys so that, based on the values set, the source data is tagged appropriately
2. Policy rules contain `description` that is needed for the issue that gets created when policy is violated. They also contain `dataflow` as well as `repositories` on which the policy will be applied.

To learn more about rules, you can review the [rules](https://github.com/Privado-Inc/privado/tree/main/rules) directory on Github

### Organization

Rules are organized in the privado repository under [`privado/rules`](https://github.com/Privado-Inc/privado/tree/main/rules) directory. The structure provides a logical way of how rules can be arranged. If you come up with some cool rules, this is where you can drop them in. You may also consider [contributing](/extra/contributing) them upstream :handshake:

Rules directory structure:

```
|__rules
   |__sources
   |  |__contact_data.yaml
   |  |__account_data.yaml
   |  |__personal_identification.yaml
   |  |__ ...
   |__sinks
   |  |__storages
   |  |  |__mongodb
   |  |     |__java.yaml
   |  |     |__python.yaml
   |  |     |__cpp.yaml
   |  |     |__default.yaml
   |  |  |__mysql
   |  |     |__java.yaml
   |  |     |__python.yaml
   |  |     |__cpp.yaml
   |  |  |__ ...
   |  |__leakages
   |  |  |__logs
   |  |     |__java.yaml
   |  |     |__python.yaml
   |  |     |__cpp.yaml
   |  |__third_parties
   |  |  |__api
   |  |        |_java.yaml
   |  |        |__python.yaml
   |  |        |__cpp.yaml
   |  |        |__default.yaml
   |  |  |__sdk
   |  |     |__slack
   |  |        |__java.yaml
   |  |        |__python.yaml
   |  |        |__cpp.yaml 
   |  |     |__jira
   |  |        |__java.yaml
   |  |        |__python.yaml
   |  |        |__cpp.yaml
   |  |        |__default.yaml
   |__collections
   |  |__annotations
   |  |  |__java.yaml
   |  |  |__python.yaml
   |  |  |__default.yaml
   |__threats
   |  |__collection.yaml
   |  |__configuration.yaml
   |  |__leakage.yaml
   |  |__sharing.yaml
   |  |__storage.yaml
   |__policies
   |  |__restrict_data_elements.yaml
   |  |__allow_data_elements.yaml
   |  |__ai_governance.yaml
```


# Sources

The journey of tracking personal data starts from “sources”. They are variables, classes and structures in the code which represent personal data. Sources are divided into 22 categories. There is a separate file for each category. You can see them in the [rules/sources](https://github.com/Privado-Inc/privado/tree/main/rules/sources) folder. Each file in the folder contains the rules for data elements belonging to that category.

### Example

From the `account_data.yaml` [file](https://github.com/Privado-Inc/privado/blob/main/rules/sources/account_data.yaml)

```yaml
sources:
  
  - id: Data.Sensitive.FinancialData.BankAccountDetails
    name: Bank Account Details
    category: Financial Data
    isSensitive: False
    sensitivity: high
    patterns:
      - "(?i).*((?<!question)bank[^\\s/(;)#|,=!>]*(?:name|account|details|detail|address|country|(swift|bic)-code|(swift|bic)_code)|bank[^\\s/(;)#|,=!>]*account[^\\s/(;)#|,=!>]*details|(swift|bic)[-_]code|(swift|bic)code)"
    tags:
      law: GDPR
```

### Organization

Sources are present in [`rules/sources`](https://github.com/Privado-Inc/privado/tree/main/rules/sources) directory and are organized as follows,

```
|__rules
   |__sources
   |  |__account_data.yaml
   |  |__audio_visual_sensory_data.yaml
   |  |__background_check_data.yaml
   |  |__biometric_data.yaml
   |  |__contact_data.yaml
   |  |__education_background_data.yaml
   |  |__financial_data.yaml
   |  |__health_data.yaml
   |  |__location_data.yaml
   |  |__national_identification_numbers.yaml
   |  |__online_identifiers.yaml
   |  |__personal_characteristics.yaml
   |  |__personal_identification.yaml
   |  |__professional_employment_background_data.yaml
   |  |__purchase_data.yaml
   |  |__social_media_data.yaml
   |  |__spouse_family_dependend_data.yaml
   |  |__technical_data.yaml
   |  |__usage_data.yaml
   |  |__user_content_data.yaml
   |  |__vehicle_data.yaml
   |  |__workplace_monitoring_data.yaml
```

### Execution

When the code is scanned, Privado first marks the “sources”, then tracks it’s journey to sinks such as third parties, databases, and logs.


# Sinks


# Understanding Sinks

Sinks are the destinations where personal data is being sent in the code. They are further categorized into storages, leakages, third parties, and internal apis. These top-level categories are aligned with the usages of the data. The top-level categories are further divided into sub-categories. For example, Storages are divided into MongoDB, MySQL, PSQL, etc. At the lowest level, rules are stored as per the programming languages. There will be a file for every language. The rules which are applicable to all the programming languages are stored in the `default.yaml` file.

### Example

```yaml
sinks:

  - id: Storages.AmazonS3.Read
    name: Amazon S3(Read)
    domains:
      - aws.amazon.com
    patterns: 
      - "(i?).*(?:AmazonS3ClientBuilder|S3Client[.]builder|AmazonS3EncryptionClient|software.amazon.awssdk.services.s3).*(?:get|list|head|select).*"
    tags:

  - id: Storages.AmazonS3.Write
    name: Amazon S3(Write)
    domains:
      - aws.amazon.com
    patterns: 
      - "(i?).*(?:AmazonS3ClientBuilder|S3Client[.]builder|AmazonS3EncryptionClient|software.amazon.awssdk.services.s3).*(?:abortMultipartUpload|completeMultipartUpload|copy|create|delete|put|uploadPart).*"
    tags:
```

### Organization

Sinks are present in [`rules/sinks`](https://github.com/Privado-Inc/privado/tree/main/rules/sinks) directory and are organized as follows,

```
   |__sinks
   |  |__storages
   |  |  |__mongodb
   |  |     |__java.yaml
   |  |     |__python.yaml
   |  |     |__cpp.yaml
   |  |     |__default.yaml
   |  |  |__mysql
   |  |     |__java.yaml
   |  |     |__python.yaml
   |  |     |__cpp.yaml
   |  |  |__ ...
   |  |__leakages
   |  |  |__logs
   |  |     |__java.yaml
   |  |     |__python.yaml
   |  |     |__cpp.yaml
   |  |__third_parties
   |  |  |__api
   |  |        |_java.yaml
   |  |        |__python.yaml
   |  |        |__cpp.yaml
   |  |        |__default.yaml
   |  |  |__sdk
   |  |     |__slack
   |  |        |__java.yaml
   |  |        |__python.yaml
   |  |        |__cpp.yaml 
   |  |     |__jira
   |  |        |__java.yaml
   |  |        |__python.yaml
   |  |        |__cpp.yaml
   |  |        |__default.yaml
```


# Storages

The database related rules are stored under this sub-category of a sink. There is a separate directory for each vendor such as MySQL, MongoDB, etc. At the lowest level, rules are stored as per the programming languages. There will be a file for every language. The rules which are applicable to all the programming languages are stored in the default.rule file.

Directory `rules/sinks/storages`:

```
 |__rules
   |__sinks
   |  |__storages
   |  |  |__mongodb
   |  |     |__java.yaml
   |  |     |__default.yaml
   |  |  |__mysql
   |  |     |__java.yaml
   |  |     |__default.yaml
   |  |  |__amazonS3
   |  |     |__java.yaml
   |  |     |__default.yaml
   |  |  |__arangodb
   |  |     |__java.yaml
   |  |     |__default.yaml
   |  |  |__...
   
```

Privado currently supports 23 popular databases and libraries. The full list is available [here](https://github.com/Privado-Inc/privado/tree/main/rules/sinks/storages).


# Third Parties

Modern day applications are assembled by using many third party libraries. Example: use SendGrid for sending automated emails to customer or Stripe for payments. Personal data may flow into the third parties which may not be accounted for. The third parties are integrated either via api-to-api mechanism or by using specific SDKs. Privado let’s you detect data flows to third parties.

The rules for third parties are under directory `rules/sinks/third_parties/`:

```
|__rules
   |  |__third_parties
   |  |  |__api
   |  |        |_java.yaml
   |  |        |__python.yaml
   |  |        |__cpp.yaml
   |  |        |__default.yaml
   |  |  |__sdk
   |  |     |__slack
   |  |        |__java.yaml
   |  |        |__python.yaml
   |  |        |__cpp.yaml
   |  |     |__jira
   |  |        |__java.yaml
   |  |        |__python.yaml
   |  |        |__cpp.yaml
   |  |        |__default.rule
   |  |     |...
```

Privado currently has coverage for the popular third parties including AWS, GCP, Azure, Stripe, Twilio, etc. The list is available [here](https://github.com/Privado-Inc/privado/tree/main/rules/sinks/third_parties).


# Leakages

Personal and sensitive data going to logs or console without masking or encryption can expose the data to unauthorised access. This is an important use-case for Security and Data Protection teams.

Privado helps you track such harmful data leakages.

Directory `rules/leakages/logs/`:

```
|__rules
   |  |__leakages
   |  |  |__logs
   |  |     |__java.yaml
   |  |     |__python.yaml
   |  |     |__default.yaml
```


# Internal APIs

A micro-service architecture based application is made of hundreds of internal APIs that talk to each other and exchange data including personal data. Tracking data flow within these internal APIs is important for data safety and ensuring data usage is compatible with your Data Processing Agreements (DPA) and Privacy policies. Privado tracks data flows to internal APIs giving you visibility to enforce data safety controls.

Directory `rules/internal_apis/api/`:

```
|__rules
   |__sinks
   |  |__internal_apis
   |  |  |__api
   |  |     |__java.yaml
   |  |     |__default.yaml
```


# Collections

These are the points in the code where personal data enters either via direct user input or via other API/service pushing it. It is important to secure data collection points to minimise the risk of data compromise. Data collection practices need to adhere to privacy laws like GDPR which requires to take user consent and put privacy notice.

Directory `rules/collections/annotations`:

```
|__rules
   |__collections
   |  |__annotations
   |  |  |__java.yaml
```


# Policies

Policies in Privado are used to govern the usage of personal data in the application and its integration points. Incompatible data usages are a major reason for various privacy fines. To protect data, data governance teams want to define and enforce controls at the time of collection and processing. This can be achieved using Policies.

### Examples

* Usage of Race, Ethnicity and Nationality in your Machine Learning and Artificial Intelligence model may create a bias in the results, towards certain individuals. You can have a policy that prohibits the use of Race, Ethnicity and Nationality in Artificial Intelligence and Machine Learning models.

```yaml
policies: 

    - id: Policy.Deny.Processing.EthicalUsageForAI
    name : "Ethical AI Usage Policy"
    type: Compliance
    description: "Don't use ethnicity, race and nationality for machine learning and AI"
    fix: "Talk to the Privacy Engineering team: privacy-engineering@org.com"
    action: Deny    
    dataFlow:      
      sources:
             - "Data.Sensitive.PersonalIdentification.Ethnicity"
             - "Data.Sensitive.PersonalIdentification.Race"
             - "Data.Sensitive.PersonalIdentification.Nationality"
    repositories: 
             - curate-offers-machine-learning
             - track-engagement-ai
    tags:
       laws: GDPR, CCPA2
```

* Business intelligence dashboards are popular among business analysts to run queries and get insights to help customers and grow the business. Exposing personal data as part of these dashboards can lead to unauthorized access and breaches. You can have a policy to deny access of personal data such as name, email, mobile, address to your business dashboard applications.

```yaml
policies:

    - id: Policy.Deny.Processing.NoPersonalDataInBIReports
    name : "Restrict usage of personal data in BI reports"
    type: Compliance
    description: "Personal data in BI reports may expose it to unathorized access."
    fix: "Talk to the Data Protection team: data-protection@org.com"
    action: Deny    
    dataFlow:      
      sources:
             - "Data.Sensitive.PersonalIdentification.*"
    repositories: 
             - business-intelligence-dashoboard
             - business-intelligence-advanced-reports
    tags:
       laws: GDPR, CCPA
```

### Organization

Policies are present in `rules/policies` and are organized as follows,

```
|__rules
   |__policies                   
   |  |__disallow_personal_data_in_business_dashboards.yaml
   |  |__ai_governance.yaml
```


# How to scan a repository using Privado

## Prerequisites <a href="#prerequisites" id="prerequisites"></a>

This tutorial assumes that you have the following setup ready:

* Git, to clone a repository. To install Git, [click here](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
* Docker (Make sure that the Docker engine is running). To install Docker, [click here](https://docs.docker.com/engine/install/)
* Privado OSS project. To install Privado, follow [these steps](https://docs.privado.ai/getting-started-with-privado/getting-started-with-privado)
* A code repository to scan. For this tutorial, we will use [BankingSystem-Backend](https://github.com/saurabh-sudo/BankingSystem-Backend)

### Clone the repository <a href="#clone-the-repository" id="clone-the-repository"></a>

To clone the repository, use the following command

```
git clone https://github.com/saurabh-sudo/BankingSystem-Backend
```

It should be something similar to the following result:

```
Cloning into 'BankingSystem-Backend'...
remote: Enumerating objects: 198, done.
remote: Counting objects: 100% (198/198), done.
remote: Compressing objects: 100% (115/115), done.
remote: Total 198 (delta 42), reused 186 (delta 37), pack-reused 0
Receiving objects: 100% (198/198), 99.97 KiB | 10.00 MiB/s, done.
Resolving deltas: 100% (42/42), done.1Cloning into 'BankingSystem-Backend'... 2remote: Enumerating objects: 198, done. 3remote: Counting objects: 100% (198/198), done. 4remote: Compressing objects: 100% (115/115), done. 5remote: Total 198 (delta 42), reused 186 (delta 37), pack-reused 0 6Receiving objects: 100% (198/198), 99.97 KiB | 10.00 MiB/s, done. 7Resolving deltas: 100% (42/42), done.
```

#### Not working? <a href="#not-working" id="not-working"></a>

If you do not get the above result, check out the [troubleshooting section](#troubleshooting) for help

### Running the scan <a href="#running-the-scan" id="running-the-scan"></a>

To start the scan, run the following command

```
privado scan BankingSystem-Backend
```

This will start the Privado scan and perform the static code analysis of the project and its dependencies. You will get the following result:

```
> Scanning directory: /Users/anujagrawal/Desktop/Projects/Privado/repos/BankingSystem-Backend

> Pulling the latest image: public.ecr.aws/privado/privado:latest
latest: Pulling from privado/privado
Digest: sha256:47f9bd5a32ff4dbea131d39ed355ada0e9190416ffb61b70a2ecd686fa6278ba
Status: Image is up to date for public.ecr.aws/privado/privado:latest

> Starting container with the latest image
> Container ID: 5108f009875a373ca940022dda554ab9bde86218f298de2dfcfd9fb9d9bae7a8

> Waiting for process to complete:
Privado CLI Version: v2.1.0
Privado Core Version: 1.1.0
Privado Main Version: 1.1.0

Configuration parsed...
Guessing source code language...
Detected language 'Java'
Processing source code using JAVASRC engine
Downloading dependencies and Parsing source code...
Tagging source code with rules...
Finding source to sink flow of data...
Deduplicating data flows...
Brewing result...

-----------------------------------------------------------
SUMMARY
-----------------------------------------------------------

Privado discovers data elements that are being collected, processed, or shared in the code.

DATA ELEMENTS  |  11 |
THIRD PARTY    |  1 |
STORAGES       |  3 |
ISSUES         |  0 |

---------------------------------------------------------
11 DATA ELEMENTS
Here is a list of data elements discovered in the code along with details on data flows to third parties, databases and leakages to logs.

1. PASSPORT
	Sharing         ->  fast2sms.com
	Storage         ->  AccountDao JBDC Connector, JPA Repository(Read), JPA Repository(Write)
	Leakage         ->  1
	Collections     ->  /accounts/add, /accounts/update/{id}
	Processing      ->  5

2. AGE
	Sharing         ->  fast2sms.com
	Storage         ->  AccountDao JBDC Connector, JPA Repository(Read), JPA Repository(Write)
	Leakage         ->  1
	Collections     ->  /accounts/add, /accounts/update/{id}
	Processing      ->  5

3. PHONE NUMBER
	Sharing         ->  fast2sms.com
	Storage         ->  AccountDao JBDC Connector, JPA Repository(Read), JPA Repository(Write)
	Leakage         ->  1
	Collections     ->  /accounts/add, /accounts/update/{id}, /transfer/betweenAccounts
	Processing      ->  6

4. DATE OF BIRTH
	Sharing         ->  fast2sms.com
	Storage         ->  AccountDao JBDC Connector, JPA Repository(Read), JPA Repository(Write)
	Leakage         ->  1
	Collections     ->  /accounts/add, /accounts/update/{id}
	Processing      ->  5

5. ACCOUNT PASSWORD
	Sharing         ->  fast2sms.com
	Storage         ->  AccountDao JBDC Connector, JPA Repository(Read), JPA Repository(Write)
	Leakage         ->  1
	Collections     ->  /accounts/add, /accounts/update/{id}
	Processing      ->  10

6. ACCOUNT NAME
	Sharing         ->  fast2sms.com
	Storage         ->  AccountDao JBDC Connector, JPA Repository(Read), JPA Repository(Write)
	Leakage         ->  3
	Collections     ->  /accounts/add, /accounts/update/{id}
	Processing      ->  13

7. LAST NAME
	Sharing         ->  fast2sms.com
	Storage         ->  AccountDao JBDC Connector, JPA Repository(Read), JPA Repository(Write)
	Leakage         ->  1
	Collections     ->  /accounts/add, /accounts/update/{id}
	Processing      ->  4

8. EMAIL ADDRESS
	Sharing         ->  fast2sms.com
	Storage         ->  AccountDao JBDC Connector, JPA Repository(Read), JPA Repository(Write)
	Leakage         ->  1
	Collections     ->  /accounts/add, /accounts/update/{id}
	Processing      ->  5

9. ACCOUNT ID
	Sharing         ->  fast2sms.com
	Storage         ->  AccountDao JBDC Connector, JPA Repository(Read), JPA Repository(Write)
	Leakage         ->  1
	Collections     ->  /accounts/add, /transfer/balanceAmountOnly/{accountId}, /transfer/balance/{accountId}, /accounts/update/{id}, /transfer/betweenAccounts, /transfer/transactionHistory/{accountId}
	Processing      ->  14

10. FIRST NAME
	Sharing         ->  fast2sms.com
	Storage         ->  AccountDao JBDC Connector, JPA Repository(Read), JPA Repository(Write)
	Leakage         ->  1
	Collections     ->  /accounts/add, /accounts/update/{id}
	Processing      ->  4

11. LANGUAGE PREFERENCES
	Sharing         ->  fast2sms.com
	Leakage         ->  1
	Processing      ->  1

Successfully exported output to '/Users/anujagrawal/Desktop/Projects/Privado/repos/BankingSystem-Backend/.privado' folder
```

On the console, you can see data elements and corresponding third parties, storages, leakages, collection points, and processing instances detected during the scan. A detailed report is also generated at `BankingSystem-Backend/.privado/privado.json`.

{% hint style="info" %}
Note that the actual result can be a bit different from the one shown above. It will depend on the version of Privado OSS installed and the repository that is being scanned
{% endhint %}

The scan usually runs for less than a minute, depending on the size of the repositories and dependencies.

#### Not working? <a href="#not-working-.1" id="not-working-.1"></a>

If you do not get the above result, check out the [troubleshooting section](#troubleshooting) for help

### Analyzing the result <a href="#analyzing-the-result" id="analyzing-the-result"></a>

After the scan is completed, the results will be stored in the `/.privado/privado.json` file inside the repository folder (`BankingSystem-Backend` in our case)

You can also look at the sample `privado.json` generated during a scan on 27th Sep 2022.

{% file src="/files/pxYBv4OyAR8RPISb2NSL" %}
Sample privado.json generated from the scan
{% endfile %}

## Troubleshooting <a href="#troubleshooting" id="troubleshooting"></a>

### Cloning the repository <a href="#cloning-the-repository" id="cloning-the-repository"></a>

If you are facing errors while cloning the repository, it can be due to the following reasons:

**Git not installed**

```
zsh: command not found: git
```

If you get the above message, it means that Git is not installed. Follow [these steps](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) to install Git

**Poor network connectivity**

```
Cloning into 'BankingSystem-Backend'...
fatal: unable to access 'https://github.com/saurabh-sudo/BankingSystem-Backend/': Could not resolve host: github.com
```

Make sure you have a stable internet connection and/or your firewall does not block GitHub repository cloning

### Running the scan <a href="#running-the-scan.1" id="running-the-scan.1"></a>

If the above command does not start the scan, it can be due to the following reasons:

**Docker engine not running**

```
> Scanning directory: /Users/anujagrawal/Desktop/Projects/Privado/repos/BankingSystem-Backend

> Pulling the latest image: public.ecr.aws/privado/cli:latest
Received error: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
```

Make sure that Docker is installed and running on your machine.

**Unsupported languages**

```
> Scanning directory: /Users/anujagrawal/Desktop/Projects/Privado/repos/python-example

> Pulling the latest image: public.ecr.aws/privado/cli:niagara-dev
niagara-dev: Pulling from privado/cli
Digest: sha256:5b41906451148f8f9c9676a545f157016d71dfb241eb5d17d9690c7f5d1d8531
Status: Image is up to date for public.ecr.aws/privado/cli:niagara-dev

> Starting container with the latest image
> Container ID: e8cf930370a0232300109c1b5271797265d0c9946a9950138b4071d8e343326c

> Waiting for process to complete:
Privado CLI Version: dev
Privado Core Version: 0.0.169
Privado Main Version: 0.0.109

Configuration parsed...
Guessing source code language...
As of now we only support privacy code scanning for 'Java' code base.
We detected this code base of 'PYTHONSRC'.
```

While scanning any repository, make sure that the language is supported by Privado. You can find the languages supported by Privado by [clicking here](https://docs.privado.ai/#supported-languages).


# Add a new Source

Source is a data element definition. To add a new data element, you first need to decide category. If you go to directory [`rules/sources`](https://github.com/Privado-Inc/privado/tree/main/rules/sources), you can see 22 files, each representing a category. The full list of Privado source categories can be found [here](https://github.com/Privado-Inc/privado/tree/main/rules/sources).

You can either use an existing category or create your own custom category. If you use an existing category, you can open the corresponding file and add entry for the data element.

**List of fields for defining a data element:**

| Field         | Description                                                                                                                                                                                                        |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `id`          | It is unique identifier for the data element. It has format “Data.Sensitive." + category name ( without spaces and special characters ) + data element name ( without spaces and special characters )              |
| `name`        | It is name of the data element                                                                                                                                                                                     |
| `category`    | It is category of the data element                                                                                                                                                                                 |
| `isSensitive` | It is a boolean flag to indicate if the data element is sensitive                                                                                                                                                  |
| `sensitivity` | It is a flag to indicate sensitivity level of the data element. It can have values “low”, “medium”, “high”                                                                                                         |
| `patterns`    | It is an array of regex patterns for the data element. This regex will be used to search variable names. Matching variables will be tagged as the source for this data element                                     |
| `tags`        | <p>It’s an object of key-value pairs. This is useful to group and filter data elements. Example: you can tag applicable laws for the data element.<br><br><code>tags:</code><br><code>laws: GDPR, HIPAA</code></p> |

High level key is `data_dictionary` which is an array of data elements. Once the data element object is defined, we can add it to the array of `data_dictionary`.

For a custom category, you can create a new file with the category name ( all small case, replace space with `_` ) in directory `rules/sources` and add the details to it.

Once the new data element is added, Privado will detect and track data flows for this new data element.


# Add a new Leakage Sink

Leakage sinks are the places where personal data should not go in the plain text format. Privado currently supports log sinks. There may be a use case for adding support for file types, sockets, IO streams, caches, etc. You can review existing leakage sinks under [`rules/sinks/leakages`](https://github.com/Privado-Inc/privado/tree/main/rules/sinks/leakages)

**List of fields for defining a leakage:**

| Field      | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `id`       | <p>It is unique identifier for the data leakage. It has format “Leakages“ + leakage type name ( without spaces and special characters )<br>Example: For file system, you will have “Leakages.FileSystem”</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `name`     | It is name of the data leakage. Example: File System                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `patterns` | <p>It is an array of regex patterns for the data leakage. This regex will be used to search method names and to further check if data elements are going to the identified methods. Matching methods with data flows will be tagged for this data leakage.<br><br>Example: Mark specific method from a known class<br>class name: <code>com.privado.MySinkClass</code><br>method name: <code>mySinkMethod()</code><br>pattern: <code>com.privado.MySinkClass.mySinkMethod</code><br><br>Example: Mark all methods from a known class<br>class name: <code>com.privado.MySinkClass</code><br>method one: <code>mySinkMethod1()</code><br>method two: <code>mySinkMethod2()</code><br>pattern: <code>com.privado.MySinkClass.\*</code><br><br>Example: Mark a specific method across the classes<br>class name: <code>com.privado.MySinkClass</code><br>method one: <code>mySinkMethod()</code><br>class name: <code>com.privado.MySinkClass2</code><br>method one: <code>mySinkMethod()</code><br>pattern: <code>.\*mySinkMethod</code></p> |
| `tags`     | <p>It’s an object of key-value pairs. This is useful to group and filter data leakages.<br>Example: you can tag applicable laws for the data leakages.<br><br><code>tags:</code><br><code>laws: GDPR, HIPAA</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |

High level key is `sinks` which is an array of leakages. Once the leakage object is defined, we can add it to the array of `sinks`.

For a new type of leakage, you can create a new file with the leakage name ( all small case, replace space with `_` ) in directory [`rules/sinks/leakages`](https://github.com/Privado-Inc/privado/tree/main/rules/sinks/leakages) and add the details to it.

Once the new leakage is added, Privado will detect and track data flows to this leakage sinks.


# Add a new Storage Sink

Storage sinks are the databases, file systems or cloud services where data is stored. Example: MySQL, MongoDB, AWS S3, etc. You can review existing storage sinks in [`rules/sinks/storages`](https://github.com/Privado-Inc/privado/tree/main/rules/sinks/storages)&#x20;

**List of fields for defining a storage sink**:

| Field      | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `id`       | <p>It is unique identifier for the storage sink. It has format “Storages“ + Vendor Name ( without spaces and special characters ) + “Read“ or “Write“<br>\</brExample:>Example: For MongoDB system, you can have “Storages.MongoDB.Read” or “Storages.MongoDB.Write”</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `name`     | It is name of the storage Example: MongoDB ( Read )                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `patterns` | <p>It is an array of regex patterns for the storage sink. This regex will be used to search method names and to further check if data elements are going to the identified methods. Matching methods with data flows will be tagged for this storage sink.<br><br>Example: Mark specific method from a known class<br>class name: <code>com.privado.MySinkClass</code><br>method name: <code>mySinkMethod()</code><br>pattern: <code>com.privado.MySinkClass.mySinkMethod</code><br><br>Example: Mark all methods from a known class<br>class name: <code>com.privado.MySinkClass</code><br>method one: <code>mySinkMethod1()</code><br>method two: <code>mySinkMethod2()</code><br>pattern: <code>com.privado.MySinkClass.\*</code><br><br>Example: Mark a specific method across the classes<br>class name: <code>com.privado.MySinkClass</code><br>method one: <code>mySinkMethod()</code><br>class name: <code>com.privado.MySinkClass2</code><br>method one: <code>mySinkMethod()</code><br>pattern: <code>.\*mySinkMethod</code></p> |
| `tags`     | <p>It's an object of key-value pairs. This is useful to group and filter data leakages.<br>Example: you can tag applicable laws for the data leakages.<br><br><code>tags:</code><br><code>laws: GDPR, HIPAA</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |

High level key is `sinks` which is an array of storages. Once the storage `sink` object is defined, we can add it to the array of sinks.

For a new vendor, you can create sub-directory with the vendor name under directory `rules/sinks/storages/`. You can create a language specific file - `java.yaml` and add the storage sink definition to it.

Once the new storage sink is added, Privado will detect and track data flows to this storage sink.


# Add a new Third Party Sink

Applications are built by assembling third party libraries. Privado helps you track data flows to third parties. You can review existing rules for third party sinks at [`rules/sinks/third_parties`](https://github.com/Privado-Inc/privado/tree/main/rules/sinks/third_parties)

**List of fields for defining a third party sink:**

| Field      | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`       | It is unique identifier for the third party sink. It has format `ThirdParties.SDK.` + Vendor Name ( without spaces and special characters )                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `name`     | It is name of the third party                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `patterns` | <p>It is an array of regex patterns for the third party sink. This regex will be used to search method names and to further check if data elements are going to the identified methods. Matching methods with data flows will be tagged for this third party sink.<br><br>Example: Mark specific method from a known class<br>class name: <code>com.privado.MySinkClass</code><br>method name: <code>mySinkMethod()</code><br>pattern: <code>com.privado.MySinkClass.mySinkMethod</code><br><br>Example: Mark all methods from a known class<br>class name: <code>com.privado.MySinkClass</code><br>method one: <code>mySinkMethod1()</code><br>method two: <code>mySinkMethod2()</code><br>pattern: <code>com.privado.MySinkClass.\*</code><br><br>Example: Mark a specific method across the classes<br>class name: <code>com.privado.MySinkClass</code><br>method one: <code>mySinkMethod()</code><br>class name: <code>com.privado.MySinkClass2</code><br>method one: <code>mySinkMethod()</code><br>pattern: <code>.\*mySinkMethod</code></p> |
| `tags`     | <p>It’s an object of key-value pairs. This is useful to group and filter third party sinks.<br>Example: you can tag applicable laws for the third party sinks.<br><br><code>tags:</code><br><code>laws: GDPR, HIPAA</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |

High level key is `sinks` which is an array of storages. Once the third party sink object is defined, we can add it to the array of sinks.

For a new vendor, you can create sub-directory with the vendor name under directory [`rules/sinks/third_parties/sdk`](https://github.com/Privado-Inc/privado/tree/main/rules/sinks/third_parties/sdk). You can create a language specific file - `java.yaml` and add the third party sink definition to it.

Once the new third party sink is added, Privado will detect and track data flows to this third party sink.


# Add a new Policy

Policies allows user to govern the usage of personal data. You can review existing policies in [`rules/policies`](https://github.com/Privado-Inc/privado/tree/main/rules/policies)

**List of fields for the definition of policy:**

| Field         | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`          | It is unique identifier for the policy. It has the format: “Policy“ + “Allow” or “Deny” + “Processing“ or “Sharing“ + unique action.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `description` | It is description of the policy                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `action`      | <p>There are two possible values.<br><br>1. “Deny”: It means that if the mentioned sources or data flows are detected for the repositories mentioned, it is a violation. The respective repositories are not supposed to process the data elements or have the data flows.<br><br>2. “Allow“: It means that if the mentioned sources or data flows are detected for the repositories other than mentioned, it is a violation. The mentioned data elements or data flows are only allowed for the repository mentioned.Developers use Slack for monitoring the applications. Logs, critical errors and events are sent. Often customer data is sent which results in an unauthorized access. You can have a policy to deny sharing any personal data on Slack. Policy: Restrict sharing of personal data on Slack</p> |
| `dataFlow`    | <p>It is mandatory object. It has two keys - “sources” and “sinks”.<br><br>If only “sources” are specified, it means the rule is to either allow or deny processing of data elements. If both “sources” and “sinks” are specified, it means the rule is to either allow or deny data flows.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| sources       | It is mandatory key. It is array of regular expression for the data elements ids.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| sinks         | It is optional key. It is array of regular expression for the sink ids.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| repositories  | It is mandatory key. It specifies the repositories for which to evaluate the policy. Use `.*` for specifying all repositories.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| tags          | <p>It’s an object of key-value pairs. This is useful to group and filter issues resulting from the policies.<br><br>Example: you can tag applicable laws for the policies.<br><br><code>tags:</code><br><code>laws: GDPR, HIPAA</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |

High level key is `policies` which is an array of policy definitions. Once the policy object is defined, we can add it to the array of `policies`.

You can either add policy definition to an existing a file or create a new yaml file. The policies are located at directory: `rules/policies`.

Once the new policy is added, Privado will evaluate the policy on the data elements and data flows after the code scan, and it will create the issues in case of policy violations.

### Sample policies

#### 1. Ethical AI use policy

Usage of Race, Ethnicity and Nationality in your Machine Learning and Artificial Intelligence model may make them bias towards certain individuals. You can have policy that prohibits the use of Race, Ethnicity and Nationality in Artificial Intelligence and Machine Learning models. Policy: Ethical AI usage policy

```
- id: Policy.Deny.Processing.EthicalUsageForAI
    name : "Ethical AI Usage Policy"
    type: Compliance
    description: "Don't use ethnicity, race and nationality for machine learning and AI"
    fix: "Talk to the Privacy Engineering team: privacy-engineering@org.com"
    action: Deny    
    dataFlow:      
      sources:
             - "Data.Sensitive.PersonalIdentification.Ethnicity"
             - "Data.Sensitive.PersonalIdentification.Race"
             - "Data.Sensitive.PersonalIdentification.Nationality"
    repositories: 
             - curate-offers-machine-learning
             - track-engagement-ai
    tags:
       laws: GDPR, CCPA2
```

#### 2. Restrict personal data use in BI reports

Business intelligence dashboards are popular among business analysts to run queries and get insights to help customers and grow the business. Exposing personal data as part of these dashboards can lead to unauthorized access and breaches. You can have a policy to deny access of personal data such as name, email, mobile, address to your business dashboard applications. Policy: Restrict usage of personal data for Business Intelligence dashboards

```
- id: Policy.Deny.Processing.NoPersonalDataInBIReports
    name : "Restrict usage of personal data in BI reports"
    type: Compliance
    description: "Personal data in BI reports may expose it to unathorized access."
    fix: "Talk to the Data Protection team: data-protection@org.com"
    action: Deny    
    dataFlow:      
      sources:
             - "Data.Sensitive.PersonalIdentification.*"
    repositories: 
             - business-intelligence-dashoboard
             - business-intelligence-advanced-reports
    tags:
       laws: GDPR, CCPA
	   
```

#### 3. Restrict customer data shared on Slack

This policy restricts Sensitive data (contact and PII phone number) of a customer whenever it is being shared to Slack. The detection is triggered whenever a dataflow between the marked sources and sinks is identified.&#x20;

```
- id: Policy.Deny.Sharing.DontShareContactDataToSlack
    name : "Restrict sharing customer contact data on Slack"
    type: Compliance
    description: "Customer contact shared on Slack can lead to data breaches and unathorized access"
    fix: "Talk to the Data Protection team: data-protection@org.com"
    action: Deny    
    dataFlow:      
      sources:
        - "Data.Sensitive.ContactData.*"
        - "Data.Sensitive.PersonalIdentification.PhoneNumber"
      
      sinks:
        - "Data.Sharing.Slack"
    repositories: 
              - "**"
    tags:
       laws: GDPR, CCPA
 
```


# Generating ROPA Report

{% hint style="info" %}
Before generating the ROPA report, ensure that you have scanned the repository on your machine using privado CLI and the results are available on the Privado Cloud dashboard. To learn how to scan your repository, [click here](/getting-started-with-privado/running-a-scan).
{% endhint %}

Privado’s cloud dashboard can be used to generate a Record of Processing Activity (ROPA) report using a self-serve wizard. Learn more about ROPA reports and their requirements here. Generating the ROPA report is an easy 6 step process. To access the report generator, navigate to the desired repository → Click on the **Create ROPA Report button** to start the process.

![](/files/6EpbgxDqgOsbcY9PLjSW)

**1. Repo Details**

Enter a brieF description of the repository including business goals it follow. Click Next. Optionally you can also Save if you want to resume report creation later

![](/files/CJFL9pIMzLP7OBaFEBdQ)

**2. Data Flows**

Review all the data flows in the app. Click View → Code Analysis to drill down each flow.

![](/files/YGVX6dUL1xs7qxF7Ticr)

If you feel certain flows are incorrect and should not be part of the repo, click the **False Positive** button in the Code Analysis View to remove them from the analysis as well as the report

![](/files/wVkF6ltbHGYgvSDoXK5x)

**3. Data Source**

Identify the category and source of the data you are processing in this repository

![](/files/pmaeJLQ5Av5Dmg3IJDEL)

**4. Data Usage**

Provide information about the purpose of this repository, the security measures in place for this repo and the duration for with data elements will be retained for.

![](/files/mLHJrl9400TcF6Inev9w)

**5. Legal**

Provide details related to specific legal questions about the repository’s use

![](/files/5hNFBk17o8QU614hgLg6)

**6. Review Summary and Download Report**

We are done! You can now Review the report and download it in CSV or PDF format from this page

![](/files/rajURjeTqQ8kD4KT2bVh)


# Generate Play Store Data Safety Report

{% hint style="info" %}
Before generating the Data Safety Report, ensure that you have scanned the repository on your machine using privado CLI and the results are available on the Privado Cloud dashboard. To learn how to scan your repository, [click here](/getting-started-with-privado/running-a-scan).
{% endhint %}

Once your application has been scanned and results have been synced to the Privado Cloud dashboard, you can now generate Data Safety Reports for your Android application. Generating a Data Safety report may be mandatory requirement to publish your apps on the Google Play Store. To learn more about Data Safety Reports and why they might be needed for your repo, click here. Generating this report is a easy 3 step process. To begin, select your target repository → **Click Create Data Safety Report** and follow the instructions

![](/files/THbp0RT46d9jqVTJsigm)

**1. Review Data**

Privado scans the source code of your application for over 200 data elements and looks at data collection like user forms, Android permissions, etc. to discover data elements your mobile app is collecting or sharing.

![](/files/dUgz2e25ego8NdmhAmL4)

To drill down, click **View**. On the **Code Analysis** tab, you can review individual data instances, their flows and mark them as **False Positive** to remove them from the results as well as the report if needed.

![](/files/WYz1BiNiniGHhQSrncKp)

**2. Review Data Usage**

Provide information about data collection and data security relevant to your application. Click Next to proceed.

![](/files/2vH5K3IJiATLZkWnLyu7)

**3. Review Summary and Download Report**

And we are done! Review the summary and download report in CSV or PDF format

![](/files/1F9DsTZ50wJq7po46jNZ)


# Uploading results to Play Store

Log in to your Play Store console, select the app, and click on App Content from the left nav.

![](/files/OutMCwieSDxHipHAjO0v)

Scroll down and open the data safety section\\

![](/files/KGMyXmTKjwaRP28uAjVQ)

Click on Import from CSV\\

![](/files/rbniiydZrlYo0VKr4DKU)

Upload the csv file generated by Privado and click Import.\\

![](/files/SPDFO1G2zahjI0aCyUDk)

![](/files/QpiorWypji28HzHuyQbD)

Your answers will be filled in, press next till you hit Submit the Data Safety Section.\\

![](/files/QiJwwQPusJJlU1dcTvMx)

Congratulations, you have successfully filled in the Play Store Data Safety Report.


# Configurations

## Configurations

Privado’s execution can be configured in multiple ways. All configurations are located under the config folder.

## Metrics Collection

Privado collects performance metrics about its own execution. These metrics do not identify you and are completely anonymous. If you still have concerns, you can turn this off by opening the file `$HOME/.privado.config.json` and setting the following values:

```
{
    "metrics": false,
    "syncToPrivadoCloud": true
}      
```

## Privado Cloud Sync

By default, Privado results are synced to the Privado Cloud so that users can use the Privado Dashboard for reviewing results, observing data flows and analyzing privacy issues. **No code is sent to the cloud.** Only the results summary is sent for visualization. If you do not wish to use Privado cloud, you can turn this off by opening the file `$HOME/.privado.config.json` and setting the following values:

```
{
    "metrics": true,
    "syncToPrivadoCloud": false
}    
```


# Contributing through GitHub

Fork our repository and make a pull request; we'll contact you about signing our Contributor License Agreement (CLA).


# LICENSING

Privado is distributed under the [GNU LESSER GENERAL PUBLIC LICENSE (LGPL) v3.0](https://www.gnu.org/licenses/lgpl+gpl-3.0.txt). This application may only be used in compliance with the License. Rules component of Privado,  provided under the `rules` directory, is distributed under the ["Common Clause" License Condition v1.0](https://commonsclause.com/). In lieu of applicable law or written agreement, software distributed under this License is distributed "AS IS", VOID OF ALL WARRANTIES OR CONDITIONS. For specific details regarding permissions and restrictions, see the License.

### GNU LESSER GENERAL PUBLIC LICENSE

Version 3, 29 June 2007

Copyright © 2007 Free Software Foundation, Inc. <<https://fsf.org/>>

Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below.

**0. Additional Definitions.**

As used herein, “this License” refers to version 3 of the GNU Lesser General Public License, and the “GNU GPL” refers to version 3 of the GNU General Public License.

“The Library” refers to a covered work governed by this License, other than an Application or a Combined Work as defined below.

An “Application” is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library.

A “Combined Work” is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the “Linked Version”.

The “Minimal Corresponding Source” for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version.

The “Corresponding Application Code” for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work.

**1. Exception to Section 3 of the GNU GPL.**

You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL.

**2. Conveying Modified Versions.**

If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version:

* a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or
* b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy.

**3. Object Code Incorporating Material from Library Header Files.**

The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following:

* a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License.
* b) Accompany the object code with a copy of the GNU GPL and this license document.

**4. Combined Works.**

You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following:

* a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License.
* b) Accompany the Combined Work with a copy of the GNU GPL and this license document.
* c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document.
* d) Do one of the following:
  * 0\) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.
  * 1\) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version.
* e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.)

**5. Combined Libraries.**

You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following:

* a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License.
* b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.

**6. Revised Versions of the GNU Lesser General Public License.**

The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.

Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation.

If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.


# Privacy Policy

We, Privado Inc (“Privado” or “we” or “us”) are the owners of the , Command Line Interface Tool ("CLI”) for Android developers. The CLI enables developers to scan the software code for gaps related to privacy implementation and suggests strategies to ensure privacy (the “Software”). Our website [www.privado.ai](http://www.privado.ai/) (the “Website”) showcases our services and product offerings (“Offerings”).

We take your privacy seriously and are committed to safeguarding your personal information collected via this Software. This privacy policy (“Privacy Policy”) sets forth how we collect, use and protect the personal information collected via this Software. This Privacy Policy is an integral part of the Software End User License Agreement ("EULA") and must be construed in conjunction with the EULA. The EULA is available at .

PLEASE READ THIS PRIVACY POLICY CAREFULLY. BY BY CONTINUING TO USE THE SOFTWARE, YOU AGREE TO THIS PRIVACY POLICY. IF YOU DO NOT AGREE TO THIS PRIVACY POLICY, YOU MAY NOT PROVIDE YOUR PERSONAL INFORMATION VIA THIS SOFTWARE.

IF YOU ARE USING THE SOFTWARE ON BEHALF OF A THIRD PARTY, YOU REPRESENT THAT YOU HAVE THE AUTHORITY TO BIND SUCH THIRD-PARTY TO THE TERMS AND CONDITIONS OF THIS PRIVACY POLICY AND, IN SUCH AN EVENT YOUR USE OF THE SOFTWARE SHALL REFER TO USE BY SUCH THIRD PARTY. IF YOU DO NOT HAVE SUCH AN AUTHORITY (TO PROVIDE ANY PERSONAL INFORMATION OF A THIRD PARTY) OR DO NOT AGREE TO THE TERMS OF THIS PRIVACY POLICY, THEN YOU SHOULD REFRAIN FROM USING THE SOFTWARE.

This Privacy Policy is an electronic record in the form of an electronic contract being compliant and construed in accordance with the data protection laws of various jurisdiction such as Indian Information Technology (Reasonable Security Practices and Procedures and Sensitive Personal Data or Information) Rules, 2011 under Information Technology Act, 2000 (“Privacy Rules”) that require publishing of privacy policy for collection, use, storage and transfer of sensitive personal data or information, The European Union (“EU”) General Data Protection Regulation(“the GDPR”), and applicable data protection laws of the United States of America.

If you have any questions or concerns about this Privacy Policy or your personal information, please contact us at <privacy@privado.ai>.

## 1. INTRODUCTION

The Software has been developed by Privado to help developers identify privacy gaps. The Software also generates a report and suggests the various strategies to increase privacy features of the software/application.

## 2. INFORMATION WE COLLECT ABOUT YOU

To get in touch with us through our Website or Software, for registration and account creation for using the Software, you are required to provide us with your e-mail address. For the sake of brevity, the aforementioned information shall be referred to as “Personal Information”. We also collect details related to your use of the Software such as product usage data and error logs. Additionally, we may also collect telemetric data which is anonymized and non-personal, to help improve our Software and other Offerings.

**Accuracy of information** Please make sure that any Personal Information you share with us is accurate and up to date information.

## 3. HOW WE USE YOUR PERSONAL INFORMATION

We use the Personal Information for the following purposes:

* to provide you with information about our Software/Offerings and/or our periodic newsletters;
* for marketing purposes and provide you with information related to our other Offerings;
* to respond to your requests;
* to manage our relationship with you;
* for internal record keeping;
* to provide you with authentication to login and use your user account;
* to verify your identity;
* to maintain correct and up-to-date information about you;
* to improve our Software, Website and other Offerings;
* to otherwise be able to provide the services to you and
* to comply with our legal or statutory obligations.

## 4. WHO DO WE DISCLOSE YOUR DATA TO?

We do not trade or otherwise transfer to outside parties any Personal Information. This does not include trusted third parties or subcontractors hired to provide services on our behalf. This includes those who act as data processors on our behalf, acting strictly under contract . With your confidentiality and protection in mind, we will always strive to protect your data when dealing with third-party vendors and other data processors. As permitted by law, we may share your Personal Information with third parties as follows:

* Service Providers: Your Personal Information may be shared with or collected by third party service providers who provide us with services, including but not limited to data hosting or processing, credit card processing or processing and fulfilling purchases. We may also avail services from Twilio for sending emails and Amazon Webservices for cloud infrastructure services. We require these providers to exercise reasonable care to protect your Personal Information and restrict the use of your Personal Information to the purposes for which it was provided to them.
* Merger or Acquisition: We may transfer your Personal Information if we are acquired by another entity, or if we merge with another company or transfer a part of our business, including the Software, to a third party. Any such third party or resultant entity that receives your Personal Information shall have the right to continue to use your Personal Information in line with the purposes set out herein. In the event of such a sale or transfer, we may notify you.
* Legal and Regulatory Authorities: We may disclose your Personal Information in order to comply with our legal obligations/ court orders/ requests by Govt. authorities.

## 5. HOW LONG DO WE STORE YOUR PERSONAL INFORMATION?

We will retain your Personal Information as long as it is required to be retained for the purpose of provision of the Software and to comply with our legal obligations. Subject to this section, we will delete your Personal Information upon reasonable written request for the same. Please note, however, that there might be latency in deleting Personal Information from our servers. For more information on where and how long your Personal Information is stored, please contact <privacy@privado.ai> . Where your Personal Information is processed by us on the basis of your consent we will delete or anonymise your data if you withdraw your consent.

## 6. OUR SECURITY MEASURES

Privado CLI tool was engineered with security in mind. Our tool runs the scan locally on your machine and your code never leaves your system. Your Personal Information is stored on servers located in the EU. We have implemented encryption mechanism and provide appropriate firewalls and protections.

## 7. INFORMATION FOR EU and UK VISITORS

Residents of the European Union (“EU”) and United Kingdom (“UK”) should note that this Privacy Policy has been updated in accordance with the requirements of the EU General Data Protection Regulation (the “GDPR”) and the UK GDPR, the United Kingdom Data Protection Act 2018, the Privacy and Electronic Communications Regulations, and any regulation superseding any of the foregoing (“UK Privacy Laws”). As per the provisions of the GDPR and UK Privacy Laws we shall be considered the Controllers of the Personal information collected as a result of your use / access of the Software.

**Legal Basis (for EU residents and UK residents)**: We will not process your Personal Information without a lawful basis to do so. We will process your Personal Information only on the legal bases of consent, contract, or on the basis of our legitimate interests, provided that such interests are not overridden by your privacy rights and interests.

**Transfer of Your Personal Information Across Borders**: There may be instances when the processing of your Personal Information will involve a transfer of Personal Information outside the EU and UK. Whenever we transfer your Personal Information across borders, we ensure a similar degree of protection is afforded to it by ensuring that any such international transfers are made subject to appropriate or suitable safeguards as required by GDPR and UK Privacy Laws. If you have questions, please contact us as at <privacy@privado.ai>.

**Your Rights (For EU and UK Residents)**:

* You have the right to request us to let you know what Personal Information belonging to you, we hold in our possession;
* Right to withdraw consent at any time where we are relying on consent to process your Personal Information;
* right to have us rectify or modify any such Personal Information;
* right to have us erase/delete your Personal Information;
* right to restrict us from processing such Personal Information;
* right to object to our use of your Personal Information;
* you have the right to lodge a complaint with a data protection authority.

UK residents have the right to make a complaint at any time to the Information Commissioner’s Office (“ICO”), the UK supervisory authority for data protection issues ([www.ico.org.uk](http://www.ico.org.uk/) ). We would, however, appreciate the chance to deal with your concerns before you approach the ICO so please contact us in the first instance. We may need to request specific information from you to help us confirm your identity or also contact you for further information in relation to your request. If you would like to exercise ANY of these rights, please contact <privacy@privado.ai> . Governing Laws: For any EU and UK residents, this Privacy Policy shall be governed respectively by the provisions of the GDPR and UK Privacy Laws.

## 8. CALIFORNIA RESIDENT RIGHTS

If you are a California resident, you have the rights as mentioned below;

* Access: You have the right to request certain information about our collection and use of your Personal Data over the past 12 months. If we have disclosed your Personal Information for a business purpose over the past 12 months, we will identify the categories of Personal Data shared with each category of third-party recipient. If we have sold your Personal Information over the past 12 months, we will identify the categories of Personal Information purchased by each category of third-party recipient.
* Deletion: You have the right to request that we delete the Personal Information that we have collected from you.
* Exercising Your Rights: To exercise the rights described above, you must send us a request that (1) provides sufficient information to allow us to verify that you are the person about whom we have collected Personal Information and (2) describes your request in sufficient detail to allow us to understand, evaluate, and respond to it. Each request that meets both of these criteria will be considered a “Valid Request.” We may not respond to requests that do not meet these criteria. We will only use Personal Information provided in a Valid Request to verify you and complete your request. You do not need an account to submit a Valid Request. We will respond to your Valid Request within 45 days of receipt. We will not charge you with any fees for making a Valid Request unless your Valid Request(s) is excessive, repetitive, or manifestly unfounded. If we determine that your Valid Request warrants any fees, we will notify you of the fees and explain that decision before completing your request. You may submit your Valid Request at \[insert email address]
* No Discrimination: We will not discriminate against you for exercising your rights under the California Consumer Privacy Act (the “CCPA”). We will not deny you use of our Software, charge you different prices or rates, or provide you a lower quality of our Software if you exercise your rights under the CCPA.

## 9. LINKS TO OTHER WEBSITES/APPLICATIONS

Our Software may contain links to other websites/applications of your interest. Please note that we do not have any control over such other websites/applications, and you will be accessing these websites/applications at your own risk. Therefore, we cannot be responsible for the protection and privacy of any information which you provide whilst visiting such websites/applications and those are not governed by this Privacy Policy. You should exercise caution and look at the privacy policy applicable to such websites/applications.

## 10. CHOICE AND OPT-OUT

We may send you communications including but not limited to (a) notices about your use of our Software, Website and Offerings, including those concerning violations of use, (b) updates, (c) promotional information regarding our Offerings, and (d) newsletters. You may opt out of receiving promotional emails and newsletters from us by following the unsubscribe instructions provided in those emails. Alternatively, you can opt out, at any time, by emailing <privacy@privado.ai> with your specific request.

## 11. LIMITATION OF LIABILITY

To the extent permissible under the law, we shall not be liable for any direct, indirect, incidental, special, consequential or exemplary damages, including but not limited to, damages for loss of profits, goodwill, data, information, or other intangible losses (even if we have been advised of the possibility of such damages), arising out of this Privacy Policy.

## 12. GOVERNING LAWS

This Privacy Policy shall be construed and governed by the laws of State of Delaware, USA and the courts of State of Delaware, USA shall have an exclusive jurisdiction to adjudicate any subject matter under this Privacy Policy.

## 13. CHANGES TO THIS PRIVACY POLICY

Please revisit this page periodically to stay aware of any changes to this Privacy Policy, which we may update from time to time. If we modify this Privacy Policy, we will make it available through the Software and indicate the date of the latest revision. In the event that the modifications materially alter your rights or obligations hereunder, we will make reasonable efforts to notify you of the change through our Website. This Privacy Policy was last modified on 16 Feb 2022

## 14. CONTACT US

If you have any questions or concerns or grievances regarding this Privacy Policy you can contact us at <privacy@privado.ai> .


# Security

At Privado, we consider the security of our systems a top priority. If you discover a vulnerability, we would like to know about it so we can take steps to address it as quickly as possible. We would like to ask you to help us better protect our users and systems.

**Please do the following:**

1. Notify us at security(at)privado.ai as soon as possible after you discover a real or potential security issue
2. Make every effort to avoid privacy violations, degradation of user experience, disruption to production systems, and destruction or manipulation of data
3. Only use exploits to the extent necessary to confirm a vulnerability’s presence. Do not use an exploit to compromise or exfiltrate data, establish persistent command line access, or use the exploit to pivot to other systems
4. Provide us a reasonable amount of time to resolve the issue before you disclose it publicly
5. Do not submit a high volume of low-quality reports

**What we promise:**

1. We will respond to your report within 5 business days with our evaluation of the report and an expected resolution date
2. We will handle your report with strict confidentiality, and not pass on your personal details to third parties without your permission
3. We will keep you informed of the progress towards resolving the problem
4. In the public information concerning the problem reported, we will give your name as the discoverer of the problem (unless you desire otherwise)


