# Security and privacy

> The rules your URLs, secrets, embedded pages and stored data must follow, and what you owe a customer when your app is uninstalled.

Source: https://developers-staging.foodpilot.tech/launch/security-privacy

In this page you will find the requirements the platform enforces on an app, and the commitments you take as a publisher.

## Your URLs

- **HTTPS and public.** Every URL of the manifest is HTTPS, without credentials, on a host that resolves to a public address. Local and private names (`localhost`, `*.local`, `*.internal`, `*.test`, private IP ranges) are refused.
- **Redirect URLs match exactly.** The `redirect_uri` of an authorization request must be one of your `redirect_urls`, character for character. If you send a PKCE challenge, its method is `S256`.
- **Webhook URIs** are HTTPS on a public address. A delivery waits 5 seconds at most, and only a `2xx` answer counts as delivered.
- **Your own origin.** Serve your app from an origin of your own, not from a shared hosting domain, and not from a Positive domain.

## Your secrets

| Secret | Where it comes from | How to keep it |
|---|---|---|
| Client secret | The partner space, shown once | On your server only. At most two are active: when you create a new one, the previous one stops working 48 hours later. Revoke a leaked one at once |
| Refresh token | Each token response | Store the new one every time: the old one is revoked, and reusing it revokes every token of the installation |
| Webhook secret | The first token response of an installation | One per installation. During 48 hours after a rotation, deliveries also carry a signature made with the previous one |

A sensitive action in the partner space, such as creating a client secret, asks you to sign in again if your last sign-in is more than 10 minutes old.

## Embedded pages

- Answer with a `Content-Security-Policy` whose `frame-ancestors` names the platforms' web origins. `*` fails the review.
- Do not rely on third-party cookies: identify the user with the [session token](/build/authentication), which lives 60 seconds.
- Verify the session token on your server before you act on it, and accept each `jti` once for anything that changes data.

## Rate limits

| Limit | Value |
|---|---|
| App API, per installation | 600 requests per minute |
| Billing operations, per installation | 30 per minute, counted in addition |

Every response carries `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. Past the limit, the answer is `429` with `Retry-After`.

## Data and uninstall

- **Read only what you use**, within the scopes and organizations the administrator granted.
- **When the app is uninstalled**, its tokens stop working at once and you receive `app/uninstalled`. Delete the installation's data, unless the law requires you to keep it.
- **You act as a processor** of the customer's personal data, under the partner agreement: no sale of the data and no use of it to train models for other purposes.
