Run Harebell · Set the rules

Policies and approvals

Every time a builder releases an app, the app asks for things: a database, a Slack channel's messages, a bigger daily budget for AI models. Someone has to decide whether each ask is fine. Policies are how your company writes those decisions down once, so they are applied the same way every time, and approvals are how Harebell asks a person when a policy says a person must decide.

This page covers both. It explains what a policy can decide, how several policies combine, how to write or change one safely, and what the people who are asked to approve see and do.

How a request gets decided#

When a builder presses Release, Harebell builds the release plan, and for each thing the new version asks for it creates a request and runs it past every policy. The plan shows the answers before anything goes live, in plain sentences, so the builder knows whether the release will go or what is in the way. A change to a policy applies to each app at its next release, not to apps that are already running.

Policies are evaluated on Harebell's side while the plan is made. Nothing in your cloud account evaluates them while an app runs. The outcome reaches the front door and the gateway as ordinary rows in the access copy, the table in your account that they read.

There are five kinds of request, and a default policy covers each.

Kind of request What the default policy decides
Data an app reads or writes Allowed when everyone who can open the app can already read the data, or when the app reads as the person using it. Otherwise the data's owner approves.
An outside service an app calls An admin approves each host, because Harebell cannot see who may read what that service returns.
A resource from a template Allowed, except a large production size, which needs an admin because it costs several hundred dollars a month.
A daily AI model budget Allowed up to your default, above it an admin approves.
An AI model Allowed when it is on your allow-list, refused when it is not.

You will also see a policy titled "Messages to people who can't see the data" in the list. Held messages, the ones an agent tries to send to people who could not otherwise see the data they came from, always go to the data owners for approval, whatever that policy says today.

How answers combine#

Several policies can apply to one request, from two different teams. Harebell runs every rule of every policy and takes the strictest answer:

  1. If any rule says deny, the request is refused, and the release cannot go.
  2. Otherwise, if any rule says approve, a person must approve. Every approval must be satisfied, each by any one of the people it names.
  3. Otherwise, if any rule says allow, the request is allowed.
  4. If no rule applies at all, an admin has to decide. Silence is neither a yes nor a no.

Because the strictest answer wins, policies have no order and cannot override each other. Adding one can only make things stricter or leave them as they were, so your security team and your admins can each add policies without asking the other. A rule that fails to run, because of a mistake in it, never allows anything. It adds an approval from its own team instead, so a broken security rule needs security and a broken admin rule needs an admin. An admin can never approve their way past a security policy that did not run.

Two teams write policies#

On the Policies page, policies sit in two groups. Security's policies apply to the whole organization, and only people with the security role can change them. Admins' policies apply to this cloud account, and only admins can change them. Both teams can read both groups.

Security's policies can only tighten. Harebell refuses to save an allow rule there and ignores one that somehow exists, so an admin knows security cannot quietly allow something, and security knows no admin can loosen what it wrote. Only the admins' group can allow.

Until your admins write a policy of their own, Harebell's defaults decide. The first time an admin changes anything, all the defaults are copied into the admins' group as ordinary policies you can edit, so you start from a working set and never from a blank page.

Write or change a policy#

A policy is a short piece of YAML with a name, a list of rules, and tests. Each rule has a when, exactly one verdict (allow: true, approve: [who] or deny: true), and a because. The when is written in CEL, the Common Expression Language, a small language built for rules like this: it cannot loop forever or touch anything outside the request it reads. The because is shown to the person releasing, so write it for them.

Here is a policy Sally Chen could add for Initech's security team. It says that an app open to more than 100 people that reads a company database table must be reviewed by security first.

name: wide-database-apps
rules:
  - when: >
      request.kind == "grant" && request.grant.connection == "postgres" &&
      request.workload.audience > 100
    approve: [security]
    because: A database table read by more than 100 people needs a security review.
tests:
  - name: an app for 250 people reading a table needs security
    request: {kind: grant, environment: prod, workload: {audience: 250}, grant: {connection: postgres, access: [read], as: app}}
    expect: approve
    approve: [security]

Who may be named in approve is limited to these: admins, security, owner (the app's builder), data_owner (the owner of the data being asked for), an email address, or group: followed by the name of a group that your identity provider syncs to Harebell, such as group:Finance.

The editor will not let you save a policy by accident. Press New policy or Edit policy, write the text, and press Check it. Harebell then does three things before it offers to save:

  • It checks the text and runs every rule against a sample request of each kind, so a rule that errors cannot be saved.
  • It runs the policy's tests, and a failing test stops the save. Tests are requests with the answer you expect, kept with the policy, so they also protect the next person who edits it.
  • It replays up to 5,000 of the real requests your apps made in the last 30 days and tells you how many would now be decided differently, naming the apps. This is how you find out that a new rule would have held up the sales team's app before it does.

When the check is clean, the same button becomes Save the policy, or Add the policy for a new one. A policy can have at most 50 rules, 100 tests and 64 KB of text. If a saved policy stops working, its page says so, and every request needs security, or an admin, until it is fixed. Delete the policy removes one, and deleting the last of your admins' policies brings the defaults back.

A rule reads the request as a document. These are the fields it can use.

Part of the request Fields
Every request request.kind (resource, grant, budget, model or hold), request.environment (dev or prod), request.account.region
The app asking request.workload.name, .kind (app, job or agent), .owner (the builder's email), .open (the groups that may open it, or everyone), .audience (how many people that is)
A resource request.resource.template, .version, .inputs (every input, defaults filled in), .changes (each with type, action, replacement and loses_data)
Data request.grant.connection (such as slack, google, postgres or web), .channel, .access (read, write), .as (app or viewer), .owner, .uncovered (how many people who can open the app cannot read the data), .domain (a web API's host)
A budget request.budget.dollars_per_day, .default
A model request.model.id, .allow_list

When a person has to decide#

A policy that says approve names who is asked. What happens next depends on the kind of request, and the difference matters to the people waiting.

A request for data goes to the data owner, and a request for a bigger model budget goes to an admin. These two are asked after the app is live, so the release does not wait. The app runs meanwhile with what it is already entitled to: for data, only the people who can already read it, and for a budget, your default. Data owners and data access explains who the data owner is and what they decide.

Every other approval has to be in place before the release goes. There is no card for these. The person who presses Release must be one of the people the rule names, and until then the plan says "You can't release this yet" and names who can. In Initech's case, a builder cannot release a large production database. Ben Okafor, an admin, opens the plan and presses Release himself, and his press is the approval.

When a rule names security, the builder presses Ask security and can add a reason. The question waits on the Approvals page for anyone with the security role, who sees who could open the app and what it would read, and who can answer yes, yes only for what each person can already open, or no. The builder hears the answer in Slack, and a yes lets the release go. Someone on security cannot answer a review they asked for or one about their own app.

What the person asked sees#

An approval for a data owner or an admin arrives as a card in Slack, sent as a direct message from your organization's own Slack app, with the buttons "Approve" and "Decline", and for a Slack channel also "Approve for members only". Where Slack is not connected, the card arrives in Microsoft Teams. Someone who uses neither can decide on the approval page in the console, and an admin can decide any approval there.

Your credentials stay with you even here. Harebell's side holds no Slack token, so to send a card it asks your gateway to send it, and the gateway uses the token that lives in your account. A click comes back through your front door, which checks Slack's signature, and it counts only if the person who clicked is the person the card was sent to. A second click gets "already decided", and a card from an older release is marked out of date, because a newer release may be asking something different.

Home lists what waits for you and offers Decide beside each item.

When nobody answers#

People miss messages, so Harebell follows up. A waiting approval is reminded after 24 hours, an admin is asked as well after 48 hours, and it expires after 7 days. A person waiting can also nudge the approver by hand, at most once a day. When a data approval expires, the app keeps running for the people who can already read the data until a release asks again, and the builder is told.