Skip to content

Glossary

Least privilege

Least privilege is the security principle that people, and the processes acting for them, get only the access they need for their task and no more. In a business app it applies to roles, to api keys, to connections with other systems and to assistants, and Meadowstack 2.1 starts every setting page, key and connection from the smallest right.

By Bohuslav PoláčekChecked

templates/starter/src/workspace/permissions.ts
export function canWorkspace(person: Person, action: string, subject?: unknown): boolean {
  const admin = person.role === "admin";
  switch (action) {
    // The admin pages of the settings (Team and roles, Connected apps, MCP and AI) and the workspace's details.
    case "settings.read":
    case "settings.edit":
      return admin;
    case "team.invite":
      return admin;
    case "team.role": {
      const member = subject as Pick<Person, "id"> | undefined;
      return admin && (!member || member.id !== person.id);
    }
    default:
      return false;
The starter's workspace rules: settings, invitations and roles are admin-only, and nobody changes their own role.

Why it matters in a business app

Access grows by default: someone needs one export, gets the admin role, and keeps it for years. Each extra right is harmless until the account is phished or a key leaks, and then the damage is the sum of everything that account could do.

The principle is cheap to apply at the start and expensive later, because by then other things depend on the extra rights.

How Meadowstack handles it

In 2.1:

  • Deny unless named. canWorkspace ends in default: return false: an action nobody wrote a rule for is refused, and a module's action without its prefix is refused for everybody.
  • Admin pages are admin-only. Team and roles, Connected apps, and MCP and AI are behind settings.read, and everyone else sees NoAccess.
  • Connections and keys. The recipe docs/recipes/integrations-and-mcp.md makes reading the default and writing a separate choice, one token per connection, and a key that never has more rights than the person who made it.
  • Assistants. An assistant runs as the person who asked and never gets more rights than they have.

What stays yours: the database role the api uses (bound by row-level security, never a superuser), the scopes of your provider tokens, and the people you make admins.

Common mistakes

  • One token with every right for every connection. One leak becomes every system.
  • A service account behind the assistant. It then reads more than the person who asked.
  • Admin for convenience. Give the action, not the role, or add a narrower role.
  • Rights that never expire. Review admins and keys on a schedule; revoke what nobody used.

Sources

Questions

Is least privilege the same as zero trust?

No. Least privilege limits what each identity may do; zero trust is a wider approach that also stops trusting a request because of where it comes from. Least privilege is one of its parts.

How does least privilege apply to AI assistants?

The assistant acts as the person who asked, with their rights or fewer: it reads only what they may read, and anything it would change waits for their yes. A key made for it can be read only.

Why can admins in the starter not change their own role?

So the app always keeps an admin who can put a mistake right, and so nobody can raise or lower their own rights without a second person.

Two ways

Build it yourself, or have it built

  • Build it yourself

    Build your app on the framework

    Get the codebase these apps stand on and build yours with Claude Code, Cursor or Codex.

    One payment, lifetime updates

    Get the framework
  • Have it built

    Have us build your app

    Tell us how your team works. We plan the app with you and build it on the same framework at a fixed price.

    After launch, Care keeps it improving, from €99 a month.

    from €1,990

    Describe your app