# Security and privacy

> What a table device sends to packeroo, what packeroo keeps of it and for how long, how tokens are protected, and how to report a vulnerability. For developers, IT and data protection.

This page describes what the public API does today. It adds to the [privacy policy of packeroo](https://packeroo.com/en/privacy/); it does not replace it.

## What a device sees

A paired device reads with `GET /device` only what it is paired with: its name, the table, the location with its time zone, the organization and its scopes. It sees no people, no matches and no ratings. Further operations come only once they are in the [changelog](https://developers.packeroo.com/en/changelog/).

## What packeroo keeps about a device

| What | From | How long |
| --- | --- | --- |
| Hash of the token (SHA-256) and its first characters | `POST /device-pairings` | while the device is paired, then 30 days |
| `model`, `serial`, `firmware`, if the device sends them | `POST /device-pairings` | as above |
| Name of the device | whoever enters the code in the app | as above |
| Time of the last request | every request with the token | as above |
| Who paired or unpaired the device, with the first characters of the token | the app, packeroo itself | in the audit log of the organization, 24 months |
| A code not entered yet | `POST /device-pairings` | valid for ten minutes, deleted by the next day at the latest |

In the sandbox packeroo names the device itself, and the audit log keeps a month there.

packeroo does not keep the token itself. It is in the answer to `POST /device-pairings` exactly once. If it is lost, the device asks for a new code.

The IP address of a request counts for the rate limit of `POST /device-pairings` and expires with it after a minute, for `POST /sandbox/device-pairings/confirm` after an hour, and as a hash for the test tables of a day after a day. An answer a device got with an `Idempotency-Key` is kept for 48 hours for a retry; an answer with a token never.

## When a device is unpaired

- Whoever looks after the location unpairs it in the app. The token stops working at once.
- Another device is paired at its table, or the table is archived.
- In the sandbox: when a new test table comes and there are 100 already, the oldest is unpaired with its device.
- The device does not report for 90 days. Nobody is surprised by it: when a device has not reported for 24 hours, everyone who looks after the location gets a notification, and the app shows at the device on which day it is unpaired if it stays silent.

When the organization switches table devices off, no device is unpaired: while they are off, every token gets `401`, and afterwards it signs in again. The 90 days do not run in that time.

## Protecting tokens

- Keep the token on the device only, in a file only the program may read. The [examples](https://developers.packeroo.com/en/guides/pair-a-table-device/) create it with the rights `0600`.
- Send it only over HTTPS to the addresses in the [concepts](https://developers.packeroo.com/en/concepts/#addresses). The examples check the certificate, the ESP32 sketch too.
- A token does not belong in a web page, a repository or a log. Its checksum at the end lets secret scanners recognize a leaked token.
- If a token got into the wrong hands, unpair the device in the app and pair it again.

## Reporting a vulnerability

Write to [info@packeroo.com](mailto:info@packeroo.com) with the subject "Security". Describe what you found and how to reproduce it, and give the `correlation_id` of an answer if you have one. Test only in the sandbox and only with your own devices.
