Sub topic 12
Governing and securing a share
This chapter assumes you know how a profile file and bearer token authenticate a recipient, and how a provider creates shares and recipients. Here you will learn how to limit what a recipient can see, how long access lasts, and how to find out who read what.
Where the risk sits
A recipient receives pre-signed URLs that point at data files in the provider's cloud storage. Anyone who holds a valid URL can download that file until the URL expires. Anyone who holds a valid bearer token can ask the sharing server for new URLs. So you protect two things: the token, and what the token can reach.
Least privilege
Share only what the recipient needs. A share is the unit of access, so build narrow shares instead of one large share for everyone.
- Add only the tables the partner needs. Create a separate share for each audience.
- Create one recipient per organisation. Do not reuse a token across partners, because you cannot revoke one partner without cutting off the others.
- Share a view or a filtered table if some columns or rows are sensitive. On Databricks you can add partitions or views to a share to limit rows. Check your platform's documentation for which features it supports.
- Enable history sharing and change data feed only if the recipient needs incremental reads. Sharing history exposes older versions of the data.
CREATE SHARE retail_share_partner_a;
ALTER SHARE retail_share_partner_a ADD TABLE main.sales.orders;
CREATE RECIPIENT partner_a;
GRANT SELECT ON SHARE retail_share_partner_a TO RECIPIENT partner_a;Token lifetime and rotation
The profile file has an expirationTime field. After that time the token stops working, and the recipient needs a new profile file. Short lifetimes limit the damage from a leaked token, but they mean more rotation work.
{
"shareCredentialsVersion": 1,
"endpoint": "https://sharing.example.com/delta-sharing/",
"bearerToken": "<token>",
"expirationTime": "2030-01-01T00:00:00.0Z"
}Pre-signed URLs expire much sooner than tokens, often within minutes to an hour. A recipient who caches URLs must request them again when they expire.
Revocation
To end access, revoke the recipient's grant or delete the recipient. The server then refuses new requests. URLs the recipient already holds keep working until they expire, so short URL lifetimes matter for sensitive data. Revoking removes the ability to read new data, but it cannot recall files already downloaded.
REVOKE SELECT ON SHARE retail_share_partner_a FROM RECIPIENT partner_a;Protecting the profile file
The profile file is a credential. Treat it like a password.
- Send it over a secure channel, not plain email or chat.
- Store it in a secrets manager, not in source control.
- Restrict file permissions on any machine that holds it.
- Rotate it on a schedule and after any suspected leak.
If you run the open-source reference server, serve it only over HTTPS. A bearer token sent over plain HTTP can be read by anyone on the network path.
Auditing
Know who accessed which table and when. Log requests at the sharing server. On Databricks, audit logs record sharing events such as recipient creation, grants and table queries. Review them for unusual patterns, such as a recipient reading far more data than usual or reading from an unexpected network location.
Some platforms also let you restrict recipients by IP address. If your platform supports it, allow only the networks you expect.
Common mistakes
| Mistake | Consequence | Fix |
|---|---|---|
| One token shared by several partners | Revoking one partner affects all | One recipient per organisation |
| No expiration on tokens | A leaked token works indefinitely | Set an expiry and rotate |
| Sharing a whole schema by default | Recipients see more than needed | Share named tables |
| Token in a Git repository | Credential exposed | Use a secrets manager |
| Assuming revocation is instant | Issued URLs keep working briefly | Keep URL lifetimes short |
Exercise
A partner's profile file leaks. You revoke the recipient immediately. Why might the attacker still download a file for a short time, and what setting limits this window?
Show answer
The attacker may hold pre-signed URLs that were already issued. They work until they expire, because the storage service checks the URL signature and not the sharing server. Short pre-signed URL lifetimes limit the window. Rotating the token and keeping one recipient per partner also limit the damage.