The two identities#
When a builder asks for company data, the request is called a data grant, and every grant says which identity the app uses. There are two.
An app that acts as itself uses its own identity. For Slack that is the app's bot in your workspace. For Google it is a single user in your Workspace that Harebell uses as a robot, and the app can see only the files that someone has shared with that user. For a database it is a role that the gateway signs in as. Everyone who opens the app sees what the app sees, which is why Harebell checks that those people could already read the data, as the next section explains.
An app that acts as the viewer uses the identity of whoever is looking at it. In Slack the app uses that person's own linked Slack account, so a viewer sees only channels they could open in Slack themselves. In Google, Harebell uses domain-wide delegation, which lets the robot act as the viewer for Google's own permission check. This is the safer choice when an app shows different data to different people, because Slack or Google, not Harebell, decides what each person may read.
Only Slack and Google can be used this way today. Database grants always act as the app, and so do the grants of jobs and agents, because a job that runs at six in the morning has no person looking at it. An app's list of data cannot name a Microsoft file yet, so connecting Microsoft is for approvals and agents in Teams for now.
When an app acts as itself, who may open it#
Here is the problem this solves. Sally Chen at Initech builds a sales board that is open to the whole Sales group, forty people, and it reads #finance-reports, a channel that only twelve people can see. Nothing in the app is wrong, but unless somebody checks, twenty-eight people would see finance numbers that Slack itself would never show them.
So Harebell compares two sets of people when the app is released. The audience is everyone who may open the app. The readers are the people who can already read the data. The gateway works out the readers inside your account, by asking Slack or Google who can see the source, because only the gateway holds the credentials to ask. What comes back is a list of email addresses and a count, never messages.
Each grant then ends up in one of three states.
- Covered. Everyone in the audience can already read the data, so nobody is asked.
- Wider. Some people in the audience could not read it. The data owner is sent a card asking whether they approve. For Slack the owner is the person who created the channel, or else the administrator named on the connection. Until they decide, the app opens for the people who are covered and refuses everyone else, so the app goes live without waiting.
- Waiting for an invitation, or unknown. The app is not in the channel yet, or the gateway could not answer, so the grant cannot go live.
Ben Okafor created #finance-reports, so he gets the card. If he approves, all forty people may open the sales board. If he declines, the twelve people who could already read the channel are the only ones who can open it. The card shows him exactly who would gain access through the app.
An app with several grants that act as the app admits a person only if they are covered by every one of them. That is deliberate: an app can show any of its data to anyone it lets in, so the strictest grant sets the bar.
The check does not stop at release. People leave channels and lose access to files, so the gateway rereads who can read each source on a regular cycle, every 15 minutes, and sooner for Slack when it hears that someone joined or left a channel. When the readers shrink, the front door refuses anyone who is no longer among them unless the owner approved them. If the reread keeps failing, the front door trusts the last answer for an hour and then admits only people the owner approved by name. Data owners and data access covers deciding, and taking access back.
When an app acts as the viewer#
The front door puts a signed header on every request that it lets into an app, naming the person. An app that wants to read as the viewer passes that header on to the gateway together with its own placeholder. The gateway checks the placeholder first, as for any call, and then checks that the header was signed by your front door, was issued for this very app, has not expired, and still belongs to a request that is open right now.
That last check is the important one. It means an app can act as a viewer only while that viewer's request is open. A header that a job saved and replayed an hour later acts as nobody.
Why an app never acts as its builder#
Builders are people, and people have access that their apps should not inherit. If a released app borrowed its builder's identity, then the app would be able to read everything Sally can read, it would keep working or stop working depending on whether she left the company, and the people using it would see her view of the data and not their own. None of those outcomes is something an administrator could reason about.
So a released app only acts as itself or as the person using it. There is one deliberate exception, and it is not a released app. The private copy that a builder runs while they are still working on something is open only to that builder. For Slack and Google files it acts as the builder, using their linked account, for at most twelve hours at a time, and only for the data listed in that app's own harebell.yaml. Nobody else can open it, so nobody else sees anything through it.
What this means for you#
When you review a request for company data, you are reading a sentence that says what is wanted, which identity it uses and who would gain access. Approving a grant that acts as the app widens what the app's audience can see, and Harebell asks the data owner, because the owner knows who should see the data. Approving one that acts as the viewer widens nothing, because each viewer sees only what they could already see.
Administrators and the Security role can revoke a grant at any time, but never widen one. A revoked grant stays revoked in later releases of the same app. If an app has to stop at once, Stop an app right now shows how.