# Four-eyes principle

The four-eyes principle is a control that requires a second person to approve what the first person did, so nobody can approve their own request, payment or change. It is a form of separation of duty, and in Meadowstack it is a rule of every approval flow: the person who filed a record never sees the approve button on it.

Checked 2 December 2026. By Bohuslav Poláček. https://meadowstack.com/glossary/four-eyes-principle/

*The Supabase example's guard: a decision by the requester, or by someone without the role, is refused.*

From `docs/recipes/examples/supabase/0001_requests.sql` in the Meadowstack repository:

```sql
elsif (old.status, new.status) in (('submitted', 'approved'), ('submitted', 'rejected')) then
  if old.requester_id = me or my_role not in ('approver', 'admin') then
    raise exception 'You don''t have permission to do that.' using errcode = '42501';
  end if;
  if new.status = 'rejected' and coalesce(length(btrim(new.decision_reason)), 0) = 0 then
    raise exception 'Write why the request is rejected.' using errcode = '22023';
  end if;
  new.decided_by_id := me;
  new.decided_by_name := public.app_name();
  if new.status = 'approved' then
    new.decision_reason := null;
  end if;
  return new;
```

## Why it matters in a business app

Most fraud and most expensive mistakes in purchasing need one person to both ask and approve. A second pair of eyes stops the obvious cases and makes the rest visible: two names on every decision, both in the history.

NIST's glossary describes the general idea, separation of duty, as no user holding enough privileges to misuse the system alone, and names the two-person rule as its dynamic form.

## How Meadowstack handles it

It is a rule in the root AGENTS.md, so people and coding tools meet it on every task: "Four-eyes: nobody approves their own record. Rejecting always needs a reason."

1. **The rule.** In the starter, `request.approve` and `request.reject` need the approver or admin role **and** a record the person did not write (`!mine` in `canFor`).
2. **The screen.** The decision card, [ApprovalPanel](https://meadowstack.com/components/approval-panel/), shows the requester a sentence instead of buttons; a rejection needs a reason before it can be sent.
3. **The simulated api** asks the same rule before it changes anything.
4. **The database**, in the Supabase example, refuses the move in a trigger (above), because a row policy cannot compare who decides with who asked across the change.

Steps 3 and 4 are yours to carry into a real backend in 2.1. See [the approval flow pattern](https://meadowstack.com/patterns/approval-flow/).

## Common mistakes

- **Admins exempt.** An admin who may approve their own purchase is the exact hole the rule closes. The starter applies it to admins too.
- **Only a hidden button.** The requester calls the api, and the request is approved.
- **Bulk approve skips the check.** The example's bulk function fails the whole call when one row is not the caller's to decide, rather than skipping it.
- **The second person is the same account.** Shared logins defeat the rule; it needs real, named sign-in.

## What each person sees

*A leave request as the director who may decide it sees it, and as the foreman who filed it.*

A live screen, rendered from the kit's components on the page: https://meadowstack.com/glossary/four-eyes-principle/

## Questions

### Is the four-eyes principle the same as segregation of duties?

It is one form of it. Segregation of duties splits incompatible tasks between people in general; four-eyes is the specific rule that a second person approves what the first one did.

### Can an admin override the four-eyes rule in Meadowstack?

Not in the starter: an admin may decide on other people's requests, never their own. Change the rule in domain/permissions.ts and in your database if your process truly needs an exception, and record why.

### What if a team has only one approver?

Their own requests then wait for someone else with the role, often an admin. That is the rule working; give a second person the approver role rather than removing it.

## Sources

- [NIST CSRC Glossary, separation of duty](https://csrc.nist.gov/glossary/term/separation_of_duty), checked 2 December 2026

## Related

- [A change order that shows its price before anyone approves it](https://meadowstack.com/screens/change-order-form/) (Screens)
- [A proof the customer approves in their own portal](https://meadowstack.com/screens/proof-approval/) (Screens)
- [A time-off request waiting for a decision](https://meadowstack.com/screens/time-off-approval/) (Screens)
- [Team and roles, with the rules in code](https://meadowstack.com/screens/roles-and-permissions/) (Screens)
- [ApprovalPanel: the decision card on a record](https://meadowstack.com/components/approval-panel/) (Components)
- [AssistantPanel: the assistant beside the page](https://meadowstack.com/components/assistant-panel/) (Components)
