Role-Based Access Control (RBAC) in Flagsmith

Role-Based Access Control (RBAC) in Flagsmith

A complete, plain-English guide to deciding who may see, change, approve and delete feature flags: organisations, projects, environments, groups, roles, permissions, API keys and single sign-on, with the design patterns, audit habits and mistakes that keep a growing team safe.

Picture a busy restaurant kitchen. The head chef can change the menu. The cooks can prepare dishes. The waiters can take orders but cannot open the safe. The cleaner can enter the storeroom but cannot touch the stove. Nobody designed this because they distrust each other. It exists because a kitchen where everyone can do everything is a kitchen where one tired mistake can close the restaurant for the night.

Feature flags are exactly such a kitchen. A feature flag is a switch, stored outside your code, that decides whether some behaviour is active for your users. In a service such as Flagsmith, one click on the right switch in the right place can turn off a payment method for every customer, or expose an unfinished feature to the whole world. A tool with that much power over a live product needs rules about who may click what, and where.

Those rules are called access control, and the most common way to organise them is Role-Based Access Control, or RBAC. Instead of deciding person by person, you define roles, give each role a set of permissions, and then give people the roles that match their jobs. This guide starts from zero and builds up. You will learn what RBAC is, how Flagsmith arranges its levels, what each permission means, how groups and roles save effort, how machine access with API keys differs from human access, how single sign-on fits in, and how to design, test, audit and repair a permission setup. No prior knowledge is assumed and no code is needed. Exact permission names, plan limits and menu labels change between Flagsmith versions, and some features such as custom roles belong to paid plans, so treat the screens described here as signposts and confirm details in your own dashboard and the official documentation.

1Why Access Control Matters for Feature Flags

A flag looks small, but it can change what every customer sees. Power that large needs deliberate limits.

One click, many customers

Changing code normally takes a chain of steps: write it, review it, test it, build it, deploy it. Each step is a chance for someone to notice a problem. A flag change skips most of that chain on purpose. That is the whole point of flags: they let you change behaviour quickly, without a deployment. But speed cuts both ways. The same quickness that lets you switch off a broken feature in seconds also lets a mistaken click break a working one in seconds.

The three things that go wrong

Without clear access rules, three kinds of trouble appear again and again. The first is accident: a new team member opens the Production environment, sees a flag that looks unused and switches it off. The second is overreach: a contractor who needed to read flag values for one week still holds full control months later. The third is confusion: after an incident nobody can say who was allowed to do what, so the lessons are vague and the same mistake returns.

What good access control gives you

Safety

Fewer accidents

People can only touch what their job needs, so a slip stays small.

Trust

Confident delegation

Managers can let more people help because the risky doors are locked.

Evidence

Clear accountability

When the rules are written down, an audit shows who could and did act.

Scale

Growth without chaos

A hundred engineers can share one tool without a hundred separate arrangements.

Everyday analogy

A hotel gives each guest a key card that opens their own room and the front door, not every room. The cleaning staff get cards for the rooms on their floor. The manager gets a card that opens nearly everything. Nobody carries a bunch of loose keys, and when someone leaves, one card is cancelled. Access control for flags is that key-card system, applied to switches instead of doors.

Real-world example: configuration changes and outages

Many large technology companies have publicly described outages that began with a configuration change applied by someone who was allowed to apply it but should not have been able to apply it so widely or so quickly. The common lesson in their reviews is that who can change live behaviour, and how far, is a design decision, not an afterthought.

i
Tip

Start by asking “what is the worst thing one person could do with this tool in one minute?” Then design permissions so that the answer is small for most people and large only for a few trusted ones.

2The Vocabulary: Twelve Words You Need

A short list of terms describes the whole subject. Learn them once and every later chapter reads easily.

The person

User

A human with an account who signs in to the Flagsmith dashboard.

The crowd

Group

A named collection of users, such as “Payments team”, so permissions can be given once to many people.

The job

Role

A named bundle of permissions that matches a job, such as “Release manager”. Custom roles are a paid-plan feature in many setups.

The right

Permission

One specific thing that may be done, such as viewing a flag or changing its state.

The top

Organisation

The top-level container for a company: its users, groups, projects and billing.

The product

Project

A container for one application or service, holding its flags, segments and environments.

The stage

Environment

A separate copy of flag states inside a project, such as Development, Staging or Production.

The master

Administrator

Someone with every permission at a level. An organisation administrator holds every permission below it too.

The robot

API key or token

A secret string that lets a program, not a person, talk to Flagsmith.

The door

Single sign-on (SSO)

Signing in to many tools through one company identity system instead of separate passwords.

The review

Change request

A proposed flag change that someone else must approve before it takes effect.

The diary

Audit log

A time-ordered record of who changed what and when.

flowchart LR
    U["User"] --> G["Group"]
    U --> R["Role"]
    G --> R
    R --> P["Permissions"]
    P --> S["Scope: organisation, project or environment"]
    S --> A["Allowed or refused action"]
FIG 1 · From a person to an allowed action: users join groups, roles bundle permissions, and permissions apply at a scope

Read the figure from the left. A user may belong to groups and may hold roles directly. Groups can hold roles too, so everyone in the group inherits them. A role is a bundle of permissions. Each permission is attached to a scope, which is the level where it applies: the whole organisation, one project or one environment. When someone tries to do something, Flagsmith checks whether any of their permissions, at the right scope, allow that action. If so the action succeeds. If not, it is refused.

Everyday analogy

A school has teachers, students and caretakers. A teacher belongs to the staff group, which is allowed into the staff room. A role such as “exam invigilator” adds the right to enter the exam hall on exam days. The permission is the right to enter. The scope is which room. The key card checks all of this at the door.

i
Note

Different Flagsmith versions and plans expose these ideas slightly differently. The vocabulary above is stable, but screen labels vary. When this guide gives a name, confirm it in your own dashboard.

3What RBAC Is, and What It Is Not

RBAC is one of several ways to decide who may do what. Knowing its shape tells you what it solves well and where it stops.

The core idea

In Role-Based Access Control, you do not give permissions to people directly. You give permissions to roles, and you give roles to people. The benefit appears when staff change. When Meera moves from the checkout team to the search team, you change her role, and all the right permissions follow. Nobody has to remember the twenty small grants she held a year ago and then forgot.

Three common models

ModelHow it decidesGood forWeakness
Access control list (ACL)Each object keeps a list of who may use itSmall systems, a few special exceptionsGrows unmanageable with many objects and people
Role-based (RBAC)People hold roles, roles hold permissionsTeams with clear job functionsRigid when rules depend on context, such as time or data
Attribute-based (ABAC)Rules compare attributes of the person, the object and the situationFine, context-aware rulesHarder to design, explain and audit

Flagsmith’s permission system is mainly role-based, with groups and with scopes that make it feel a little like an access control list at the project and environment levels. You choose who may do what, at which level, and you do it through people, groups and roles.

The principle of least privilege

Least privilege means giving each person the smallest set of permissions that lets them do their job, and no more. It is the most useful rule in access control. If a developer only needs to change flags in Development and Staging, they should not be able to change Production. If an analyst only needs to read, they should not be able to write. Least privilege does not mean mistrust. It means that when something goes wrong, which it will, the damage has a boundary.

What RBAC does not do

  • It does not decide which of your customers sees which feature. That is the job of segments and targeting, which control end users, not team members.
  • It does not stop a trusted person from making a bad decision. It limits who can make the decision, and approvals help review it.
  • It does not replace strong sign-in. A perfect permission design is useless if a password is shared.
  • It does not protect secrets stored carelessly in flag values.
Everyday analogy

Think of a library. Members may borrow books, librarians may add or remove books, and the head librarian may change the opening hours. That is RBAC. Which books a particular reader enjoys is a different question, answered by recommendations, not by the key card.

!
Watch out

Do not confuse two kinds of “who”. Access control decides which team members may use Flagsmith. Targeting decides which end users of your product receive a feature. They use different screens and answer different questions.

4The Levels of Flagsmith: Where Permissions Live

Flagsmith nests its things like boxes inside boxes. Permissions are attached to a box, and they apply to what is inside it.

The hierarchy

At the top sits the organisation. Inside it are projects. Inside each project are environments, and flags, segments and tags. Each level has its own permissions. The deeper the level, the narrower the power.

flowchart TD
    O["Organisation: company, users, groups, billing"] --> P1["Project: Web Shop"]
    O --> P2["Project: Mobile App"]
    P1 --> E1["Environment: Development"]
    P1 --> E2["Environment: Staging"]
    P1 --> E3["Environment: Production"]
    P1 --> F["Flags, segments and tags, shared across the project"]
    E3 --> S["Flag states, identities and segment overrides, per environment"]
FIG 2 · The nesting of Flagsmith: permissions are given at the organisation, project or environment level

Which level holds what

LevelWhat lives hereTypical permissions at this level
OrganisationUsers, groups, roles, projects, billing, sign-on settingsAdministrator, create project, manage users and groups
ProjectThe flag definitions, segments, tags, environmentsView project, create feature, delete feature, manage segments, create environment
EnvironmentThe state of each flag in one stage, identities, overrides, change requestsView environment, update feature state, manage identities, approve change requests

Why this split is clever

A flag’s definition, its name and kind, is shared across the project. Its state, on or off and the value, is held separately in each environment. That means you can allow a developer to create a flag in the project and change its state in Development, while keeping Production out of reach. The levels give you a way to say “trusted to experiment, not trusted to release”.

Inheritance: higher powers flow down

Permissions at a higher level generally cover what lies below. An organisation administrator can do everything in every project. A project administrator can do everything in that project’s environments. Someone with a permission only at one environment has it only there. Think of it as water running downhill: it flows to everything beneath, never upwards.

Everyday analogy

A shopping centre has a general manager, shop owners and shop assistants. The general manager can enter every shop. A shop owner can enter their own shop and its stockroom. An assistant can enter the shop floor and nothing else. Flagsmith’s levels are the centre, the shop and the room.

i
Tip

Whenever you grant a permission, ask at which level it is needed. A powerful permission given too high up covers far more than you meant. Prefer the lowest level that does the job.

5The Organisation Level: Administrators and Members

The organisation is the top box. The decisions made here set the outer walls for everything else.

Two basic kinds of member

Every person in an organisation is, at the simplest level, either an administrator or an ordinary user. An organisation administrator can manage the organisation itself: invite and remove people, create and edit groups, create projects, manage billing and sign-on, and see everything. An ordinary user can only do what they are explicitly given in projects and environments, which at first is nothing at all.

How people join

People usually join by invitation. An administrator enters an email address, optionally chooses a starting group or role, and Flagsmith sends a link. In organisations that use single sign-on, people may be created automatically the first time they sign in with the company identity system, according to settings an administrator chooses. Whichever route you use, check afterwards what the new person can actually see.

Keep the administrator list short

The administrator role is the master key. A good rule is that very few people should hold it: a small, named set who understand the consequences, plus a way for a second person to cover when someone is away. The more administrators there are, the more places a stolen password can lead to everything, and the harder it becomes to know who changed a setting. For daily work, administrators should often use ordinary accounts and keep the administrator account for administrative tasks.

QuestionGood answer
How many organisation administrators?Few: enough for cover, not for convenience
Who invites new people?Administrators, following a written request
What access does a new person start with?Nothing beyond their group’s, then add what is needed
What happens when someone leaves?Remove their access on their last day, as part of the leaving checklist
Who reviews the list?A named person, on a fixed schedule
Everyday analogy

A company has one master key kept in the office safe, and a signed log of who borrowed it. Nobody carries a copy on a keyring “just in case”. When the master key is easy to get, it is no longer special, and the building is only as safe as the least careful holder.

Real-world example: shared administrator accounts

Security reviews at many companies repeatedly find the same pattern: an administrator account shared by a whole team because it was easier than fixing permissions. When something then goes wrong, nobody can say who did it. Individual accounts with the right roles give the same convenience without losing the trail.

!
Watch out

Never share one login between several people, administrator or otherwise. A shared login breaks the audit log, because every action looks like it came from the same person, and it makes leaving staff impossible to cut off cleanly.

6Groups: Giving Permissions to Many at Once

Groups are the first tool for taming growth. They turn a hundred separate decisions into a handful.

What a group is

A group is a named list of users, such as “Checkout engineers”, “QA”, “Support” or “Release managers”. You give permissions to the group at the organisation, project or environment level, and every member receives them. When a member joins the group they gain the rights, and when they leave the group they lose them. Nobody has to edit twenty permission screens when a team changes.

Group admins

Many setups allow a group to have its own administrators, who can add and remove members of that group without being organisation administrators. This lets a team lead manage their own team while an organisation administrator manages the rules. Whether and how this works depends on your plan and version, so check it in your dashboard.

Designing good groups

By team

Mirror your org chart

One group per team makes membership obvious and easy to keep current.

By function

Cross-team jobs

Groups such as “Release managers” or “Auditors” cut across teams for special duties.

By environment

Access to Production

A small “Production editors” group keeps the riskiest rights visible in one list.

By project

Per-product ownership

“Web shop owners” and “Mobile app owners” avoid giving one team the other’s flags.

Why groups beat direct grants

With groups

  • One change updates everyone in the team
  • Joiners and leavers need one action
  • The rules read like the organisation chart
  • Audits check a few groups, not many people

With direct grants only

  • Every person has a unique, forgotten history
  • Leavers keep stray permissions
  • Two people in the same job end up with different rights
  • Audits become a long, tedious search
Everyday analogy

An airline gives pilots, cabin crew and ground staff different passes. It does not negotiate each person’s access separately. When a new pilot joins, they are told “you are a pilot”, and the pass works. Groups are that single sentence.

i
Tip

Name groups for the job, not the person. “Payments team” will still make sense in three years. “Rahul’s helpers” will not.

7Project Permissions in Detail

A project holds the definitions that every environment shares. Its permissions decide who shapes the catalogue of flags.

The usual project permissions

Flagsmith’s project-level permissions are listed in the dashboard. Names and details differ between versions, but they generally cover the following ideas.

Permission ideaWhat it allowsWho usually needs it
AdministratorEverything in the project, including its permissionsThe project owner, and one cover
View projectSee the project, its flags, segments and environmentsAlmost everyone who works with the product
Create environmentAdd a new stage such as a test or demo environmentPlatform and release engineers
Create featureDefine a new flagDevelopers
Delete featureRemove a flag for ever, in every environmentA small senior group
Manage segmentsCreate and edit the audience rules that target end usersProduct and growth engineers
View audit logRead the project’s history of changesLeads, security and support

Why “delete feature” is special

Deleting a flag removes its definition from the project, which means every environment loses it at once. The code that still asks for that flag will fall back to its default. This is why deletion is usually given to fewer people than creation. Making a flag is easy to undo. Removing one can, if code still depends on it, change behaviour everywhere.

Why “manage segments” matters

A segment defines a group of end users by rules, such as “customers in India on the premium plan”. A change to a segment’s rules changes who receives every flag that uses it, in every environment where that segment is used. Editing a segment is therefore a kind of release, even though no flag was touched. Give this permission with the same care as changing a flag in Production.

Everyday analogy

A restaurant’s recipe book is shared by every branch. Writing a new recipe is a small event. Throwing a recipe away affects every branch at once, and changing the definition of the “family menu” changes what every family receives. Only the head office should do those last two.

i
Note

Because the same flag name exists in all environments of a project, a project-level action can reach Production even if the person has no Production environment rights. That is why project permissions must be handed out more carefully than they first appear.

8Environment Permissions in Detail

The environment is where the risk is sharpest. Production’s permission list is the one to read twice.

The usual environment permissions

Permission ideaWhat it allowsRisk level in Production
AdministratorEverything in this environment, including its permissions and keysVery high
View environmentSee flag states and values hereLow, but may reveal sensitive values
Update feature stateChange on or off and the value of a flag hereHigh: this is releasing
Manage identitiesCreate, edit and delete individual users and their traitsMedium to high: changes who gets what
Manage segment overridesChange how a segment is treated for a flag hereHigh: changes whole audiences
Create change requestPropose a change for approvalLow: proposes but cannot apply
Approve change requestAccept someone else’s proposal so it can go liveHigh: the gatekeeper
View identitiesRead the list of tracked users and their traitsMedium: personal data may be present

Separating proposing from approving

The pair “create change request” and “approve change request” is the most useful split on the list. A person with only the first can say “I would like this flag changed”, but cannot make it happen. A different person with the second decides. This gives a classic two-person rule: no single person can both prepare and release a change to Production. The approvers should not be the authors of the changes they approve, and your process should say so clearly.

Reading is not harmless

Viewing sounds safe, but flag values can hold real information: a partner’s URL, a limit, a message for customers, or an internal setting. Identities and traits can hold personal data about customers. So even “view” permissions deserve thought, particularly in Production, and particularly for outside contractors.

flowchart TD
    D["Developer: create change request"] --> Q["Pending change request in Production"]
    Q --> A["Approver: approve change request"]
    A --> L["Change goes live"]
    D -. "cannot approve own change" .-> X["Blocked by process and, in many setups, by the product"]
FIG 3 · The two-person rule: the person who proposes is not the person who approves
Everyday analogy

In a bank, the clerk prepares a large transfer and a manager signs it. The clerk cannot sign their own work, and the manager does not prepare it. Neither is distrusted. The design simply makes sure two sets of eyes see anything important.

i
Tip

For Production, give most engineers “view” and “create change request”, give a small group “approve”, and keep “update feature state” for emergencies and release managers. Then review the arrangement after every incident.

9Roles: Reusable Bundles of Permissions

Groups say who. Roles say what. Together they let you write rules once and apply them many times.

What a role is

A role is a named set of permissions, defined once, and then given to users or groups. For example, a role called “Release manager” might contain: view project, view environment, update feature state in Staging and Production, and approve change requests in Production. Instead of ticking those boxes for every release manager in every project, you tick them once on the role and attach the role to a group.

Availability and the built-in alternative

Custom roles, with permissions you choose yourself, are usually part of higher paid plans. If you do not have them, the same effect can still be reached by granting permissions to groups directly, project by project and environment by environment. Roles save effort and reduce mistakes, but they are a convenience, not the only route. Confirm what your plan offers.

Example role catalogue

RoleWho it suitsTypical contents
ViewerSupport, managers, auditorsView project and environments, no changes
DeveloperEngineers on one productCreate features, update state in Development and Staging, create change requests for Production
Release managerLeads who shipUpdate state in Staging and Production, approve change requests, view audit log
Product ownerProduct and growth staffManage segments, update state in non-critical environments, create change requests
AuditorSecurity and complianceView everything including the audit log, change nothing
Platform adminPlatform and infrastructureCreate environments, manage keys, administer projects

Roles and groups together

The cleanest setup is: users belong to groups that mirror teams, and roles are attached to groups. When a person changes team, you move them between groups and the roles follow. You rarely attach roles directly to individuals, except in a deliberate one-off, and when you do, you record why.

Everyday analogy

A theatre has job descriptions: stage manager, lighting operator, usher. Each description lists what the person may do. The theatre does not rewrite the list for each new hire. It hands over the description that fits. A role is a job description for the flag tool.

i
Tip

Keep the number of roles small. Five to eight well-named roles usually cover a whole company. Fifty roles with tiny differences become impossible to explain, and people stop trusting them.

10Narrowing Further: Tags and Per-Flag Control

Sometimes an environment is too big a box. You may want a team to touch some flags and not others.

The problem of big projects

A busy project can hold hundreds of flags, owned by different teams. If the checkout team can change every flag in Production, they can also change the search team’s flags by accident. Environment-level permissions alone cannot express “only your own flags”.

Tags as labels

A tag is a coloured label attached to a flag, such as “checkout”, “search” or “experiment”. Tags help people find and filter flags. In some plans and versions, tags can also be used in permission rules, so that a role applies only to flags with certain tags. Where this exists, it is an elegant way to give each team control of its own corner of a shared project. Whether it is available, and exactly how it behaves, depends on your plan and version, so check your documentation.

If you do not have tag-based rules

Without such rules you have three sensible fallbacks. You can split teams into separate projects, so each team’s flags live in their own box. You can use naming conventions and review them through change requests. Or you can rely on approvals: anyone can propose, but the owning team must approve changes to their flags.

ApproachStrengthWeakness
Tag-based permissions (where offered)Fine control inside one projectNeeds discipline in tagging; plan limits
One project per teamHard walls, simple to explainShared flags and segments are harder to reuse
Naming rules plus approvalsWorks on any planRelies on people following the rules
Everyday analogy

In a shared office fridge, coloured stickers show whose food is whose. A sticker alone does not stop a hungry colleague, but if the building adds lockable drawers keyed to each colour, the stickers become real boundaries. Tags are the stickers, and tag-based permissions are the drawers.

!
Watch out

A label is only as reliable as the habit of applying it. If a flag is created without its tag, it may fall outside the rule. Check that new flags are tagged, and review the untagged ones regularly.

11How Permissions Combine: Effective Access

A person can receive rights from several places at once. The final result is what they can actually do, called their effective access.

Rights add up

In most RBAC systems, including Flagsmith’s, permissions are additive. If a person is allowed to do something through any route, they are allowed. Imagine Anil belongs to the “Developers” group, which can update Development. He also belongs to the “Release managers” group, which can approve Production changes. He also has one direct grant to view the audit log. His effective access is the sum of all three. Removing one group takes away only that group’s share.

Why this surprises people

Additive access means that taking away a permission in one place does not guarantee a person loses it. If the same permission also arrives through another group, they keep it. Many “I removed it but they can still do it” puzzles end here. The cure is to look at every route: direct grants, each group, each role and the administrator flags at higher levels.

flowchart LR
    G1["Group: Developers"] --> E["Effective access of Anil"]
    G2["Group: Release managers"] --> E
    D["Direct grant: view audit log"] --> E
    H["Higher-level administrator right, if any"] --> E
FIG 4 · Effective access is the sum of every route that reaches a person

A checking routine

1

Start with the person

List their groups, roles and direct grants.

2

Check the top

Are they an organisation, project or environment administrator? That overrides finer limits.

3

Walk the scopes

For each project and environment, note what each route grants.

4

Test as the person, where possible

A test account with the same groups shows reality better than reasoning does.

Everyday analogy

A visitor to an office may hold a day pass, a pass for the conference room and a key to the supply cupboard. Cancelling the day pass does not take away the cupboard key. To know what the visitor can reach, you must count every item in their pocket.

i
Tip

Design so that most people receive rights from exactly one route, their team group. Fewer routes make the effective access easy to read and easy to remove.

12Designing Your Role Model

Good access control is designed on paper first, from jobs and risks, not clicked together one request at a time.

Step 1: list the jobs, not the people

Write down what work happens around flags: developers create and change flags in test stages; testers check behaviour in Staging; release managers move changes into Production; product staff adjust audiences; support staff look up why one customer sees something; auditors review history; platform staff manage environments and keys. Each of these jobs becomes a candidate role.

Step 2: grade the environments by risk

EnvironmentRiskTypical stance
DevelopmentLow: no customersOpen to all developers for experiments
Staging / testMedium: shared testing, may mirror Production dataOpen to developers and testers
ProductionHigh: real customers and moneyNarrow, with approvals and auditing

Step 3: build a matrix

A permission matrix is a table with roles down the side and actions across the top. It is the single most useful document in access control. It can be read in a minute, reviewed by a manager and compared with what Flagsmith actually shows.

RoleDev: changeStaging: changeProd: viewProd: proposeProd: approveProd: change
ViewerNoNoYesNoNoNo
DeveloperYesYesYesYesNoNo
Release managerYesYesYesYesYesEmergency only
AuditorNoNoYesNoNoNo

Step 4: decide the exceptions in advance

Emergencies will happen. Decide beforehand who may bypass the normal rule, how they record the reason and how the bypass is reviewed afterwards. An exception planned in calm is safer than an exception improvised at three in the morning.

flowchart TD
    J["List the jobs"] --> R["Group jobs into a few roles"]
    R --> E["Grade environments by risk"]
    E --> M["Build the permission matrix"]
    M --> X["Plan emergency exceptions"]
    X --> I["Implement in Flagsmith"]
    I --> V["Review on a schedule"]
    V --> J
FIG 5 · A repeating cycle for designing and maintaining a role model
Everyday analogy

An architect draws the plan of a building, including which doors need locks, before any builder arrives. Fitting locks afterwards, one complaint at a time, produces a building with strange keys, gaps and doors nobody remembers. The matrix is the plan of your locks.

13Approvals and Change Requests as Part of Access Control

Permissions answer “may this person act?”. Approvals answer “has someone else agreed?”. The two work best together.

What a change request does

When an environment requires change requests, a person with only proposal rights cannot change a flag directly. They write down the change, including the new state, and submit it. The change waits as a pending request, visible to the approvers. An approver reviews it, perhaps discusses it, and approves or rejects it. Only after approval does it become the live state. Where your plan supports it, the number of approvers needed can be set, and the author may be barred from approving their own request.

Which environments should require them

Not every environment needs this. Development and personal test stages should usually be free, so people can move fast. Production nearly always benefits. Staging is a judgement call: if it feeds important tests or releases, a lighter rule may help.

Choosing approvers

Who

Informed peers

People who understand the code and the customer effect, not only managers.

How many

Enough for cover

At least three, so holidays and illness do not block urgent changes.

Not

The author

An approver who also wrote the change is not a second pair of eyes.

Duty

Read, do not click

A rubber-stamp approver adds delay without adding safety.

The cost of approvals

Approvals add a little time and a little friction. During an incident, that friction can matter. A mature team plans for this: a fast route for emergencies, with a named person who can approve at any hour, and a review the next morning. Without that route, people will find ways around the rule, which is worse than no rule.

Everyday analogy

A hospital double-checks certain medicines: a nurse prepares the dose and a second nurse confirms it. For the rare emergency, there is a faster agreed path. The double check is not a sign of distrust. It is a recognised way to catch the slip that anyone can make.

i
Tip

Write the approval rule in one sentence that everyone can recite, such as “Production changes need one approval from the release-managers group, and you cannot approve your own”. Rules that fit in a sentence get followed.

14Machine Access: API Keys and Tokens

People are not the only ones who talk to Flagsmith. Applications and scripts do too, and they need their own carefully limited keys.

Three families of keys

KeyUsed byWhat it can doSecrecy
Client-side environment keyWebsites and mobile appsRead flags for one environment, for the current userPublic by nature: it ships inside the app
Server-side environment keyYour backend servicesRead the full set of flags and rules for one environment, enabling local evaluationSecret: never place in an app or a web page
Admin API tokenScripts, pipelines, automationManage flags and settings through the management API, with the rights of the person or role it belongs toVery secret: it acts like a user

Why the difference matters

A client-side key lives in code that anyone can download, so it must be safe to expose, and it only returns what a single user should see. A server-side key reveals your whole rule set, including segment rules, so keeping it on a server is essential. An Admin API token can change things, so it should be treated like a password with the same powers as its owner. Your permission design is not complete until it covers these too.

Limiting machine access

  • Use separate keys for each application and environment, so one leak has a boundary.
  • Where your plan offers organisation-level API keys with roles attached, give automation a role with only the permissions it needs, rather than a personal token tied to a person who may leave.
  • Store keys in a secrets manager, never in source code, chat or documents.
  • Rotate keys on a schedule and immediately after any suspicion.
  • Delete keys that no longer have a purpose.
flowchart LR
    M["Mobile or web app"] -->|"client-side key"| F["Flagsmith: flags for one user"]
    B["Backend service"] -->|"server-side key"| F
    C["CI pipeline or script"] -->|"Admin API token with a role"| F
    H["Human in the dashboard"] -->|"sign-in plus roles"| F
FIG 6 · Four ways to reach Flagsmith, each with a different kind of credential and a different level of power
Everyday analogy

A shop has a public front door, a staff door and a manager’s office key. Customers use the front door freely. Staff use the staff door, and the key stays on a lanyard. The office key opens the safe and is kept locked up. Client keys, server keys and admin tokens match those three levels of care.

!
Watch out

The most common leak is a server-side key or admin token committed to a code repository, even a private one. Add automated scanning for secrets, and treat any exposed key as already stolen: replace it, then investigate.

15Signing In Safely: SSO, Two-Factor and Provisioning

Permissions decide what a person may do. Sign-in decides whether the person is who they say they are. Both must be strong.

Single sign-on

Single sign-on lets people use their company identity, from systems such as Okta, Microsoft Entra ID or Google Workspace, to sign in to Flagsmith, instead of a separate password. The benefits are large. When someone leaves the company and their identity is disabled, they lose access everywhere at once. Password rules, lockouts and multi-factor checks are managed in one place. Availability of SSO methods such as SAML or OpenID Connect depends on your plan and whether you self-host, so confirm in the documentation.

Two-factor authentication

Two-factor authentication asks for something you know, a password, plus something you have, such as a code from a phone app. Even if a password leaks, an attacker cannot easily sign in. Where SSO is not used, two-factor sign-in on every account that can change Production is one of the best protections you can add. Where it is used, enforce it in the identity system.

Automatic provisioning

Provisioning means creating, updating and removing accounts automatically from the company directory. Some setups can map directory groups to Flagsmith groups, so when someone is added to the “Payments engineers” group in the directory, they receive the matching Flagsmith permissions with no extra step. Support for this varies, so check what your plan and version provide. The principle is worth adopting even where tools are limited: one source of truth for who belongs in which team.

1

Joiner

Added to the directory group for their team; Flagsmith access follows.

2

Mover

Moved to another group; old rights disappear, new ones arrive.

3

Leaver

Disabled in the directory; sign-in stops everywhere, then keys they owned are rotated.

Everyday analogy

A company badge works at the office door, the lift, the canteen and the printer. When the badge is cancelled, it stops working everywhere. Single sign-on is a badge for software, and it spares you from chasing a dozen separate keys when someone departs.

i
Tip

Add “remove access from Flagsmith and rotate shared keys” to the leaving checklist, even when SSO exists. Automatic removal covers people, but not tokens a person created and that scripts still use.

16The Audit Log: Proof and Learning

Access control prevents bad actions. The audit log records the actions that did happen, so you can learn from them.

What it records

The audit log is a time-ordered list of changes: who changed which flag, in which environment, to what, and when. It usually records flag state changes, segment edits, change request approvals and similar events. Exactly which events are recorded, and how long they are kept, depend on your plan and version. Who may read the log is itself a permission, because the log reveals what changed and may include values.

Four jobs for the log

Incident

Find the cause

After a problem, the first question is “what changed just before?”. The log answers it.

Review

Check the rules work

Reading a sample shows whether approvals are really happening.

Compliance

Show evidence

Auditors ask for proof that controls exist and are followed.

Learning

Improve the design

Patterns, such as repeated emergency bypasses, tell you where the model is wrong.

Making the log more useful

The log is only as clear as the habits around it. Ask people to write a short reason with each important change. Link change requests to tickets. If your plan supports sending the log to other systems, for example through webhooks to a central log store, do so, because a copy kept elsewhere cannot be quietly altered from within Flagsmith.

Limits of the log

The log shows that something changed, not always why. It cannot undo harm. And it only helps if somebody reads it. A log nobody reviews is a diary kept in a locked drawer.

Everyday analogy

A shop’s door has a visitor book. If the stockroom is found disordered, the book shows who came and went. But if nobody ever writes in it or reads it, the book is decoration. Reviewing the log on a schedule turns the book into a tool.

Real-world example: change records in regulated industries

Banks, insurers and healthcare companies are routinely asked by regulators to show who was able to change production systems and who actually did. Teams that keep a clear permission matrix and a reviewed audit trail can answer such questions in minutes, instead of reconstructing history from memory.

17Patterns by Company Size

The right amount of structure depends on how many people and how much risk you have. Too little invites accidents. Too much invites workarounds.

Pattern A: the small team (under about ten people)

Everyone knows everyone. Keep it simple: two or three administrators, one group for developers with rights in Development and Staging, and Production changes limited to a short list of senior people. Change requests may be optional for Staging but should apply to Production. A single page describing who can do what is enough.

Pattern B: the growing company (tens of people, several teams)

Here groups become essential. Create one group per team, a “Release managers” group and a viewers group for support and management. Use roles, where available, to bundle permissions. Require change requests in Production, with approvers outside the author’s own team where possible. Start a quarterly access review.

Pattern C: the large organisation (hundreds of people, many products)

Use one project per product, or per major service, so teams have their own walls. Connect sign-in to the company identity system and map directory groups to Flagsmith groups. Keep a central platform team that owns organisation settings, and delegate project administration to product owners. Add audit log export to a central store and formal reviews with security and compliance.

ConcernSmallGrowingLarge
Who administers2 to 3 peoplePlatform lead and coverCentral platform team plus project owners
How access is givenMostly direct and simpleGroups, with roles where availableDirectory-driven groups and roles
Production controlShort list of peopleChange requests requiredChange requests, separation of duties, export of logs
Review rhythmWhen someone joins or leavesQuarterlyQuarterly plus after every incident
DocumentationOne pageMatrix and runbookMatrix, runbook, owner list and evidence pack
flowchart LR
    S["Small: few admins, simple rules"] --> G["Growing: groups, roles, change requests"]
    G --> L["Large: per-product projects, SSO mapping, log export"]
FIG 7 · Access control grows in steps; add structure when the pain appears, not long before
Everyday analogy

A family home needs one key per person. A block of flats needs a doorman and a key register. A skyscraper needs a security office, badges and cameras. Building a skyscraper’s security for a family home wastes effort. Running a skyscraper with a family’s keys invites trouble.

18Organising Projects for Access Control

The shape of your projects decides how easy or hard your permissions will be. Choose it with access in mind.

Three layouts

Layout 1

One project per product

Web, mobile and API each get a project. Clear walls, simple permissions, some duplicated segments.

Layout 2

One shared project

All flags in one place. Easy sharing of segments, but everybody lives in one big box and needs tag rules or discipline.

Layout 3

Per team, per service

Each microservice owns a project. Strong ownership, more projects to administer.

Questions to decide

  • Do the same people own all the flags, or do different teams own different flags?
  • Do flags need to share segments across products?
  • Does one product have special sensitivity, such as payments, that should be walled off?
  • How many projects can your administrators realistically look after?

Environments inside projects

Keep the same environment names in every project: Development, Staging, Production. Consistent names make permission matrices readable and let one runbook serve every team. Add extra environments, such as demo or load-test stages, only with a clear owner and a clear purpose, because every environment is another place for permissions to drift.

Everyday analogy

A school can keep every pupil’s papers in one big cabinet, or give each class its own cabinet. One cabinet is handy for sharing, but a careless hand can reach everything. Separate cabinets cost more space, but a mistake stays inside one class.

i
Tip

If two teams keep asking for opposite permissions on the same flags, that is a sign they should have separate projects.

19Contractors, Interns and Temporary Access

Short-term people are the most common source of leftover access. Plan their exit on the day they arrive.

The rules for temporary people

1

Name a sponsor

Every outsider has an employee who requested the access and answers for it.

2

Set an end date

Write the date when access ends in the request, and put a reminder in a calendar.

3

Give the minimum

Development and Staging only, with view rights in Production if truly needed.

4

Use a dedicated group

A “Contractors” group is easy to list, review and clear.

5

Remove on time

On the end date, remove the person and rotate any shared secrets they saw.

Temporary elevation

Sometimes a normal person needs extra power for a short time, such as a developer helping with a Production release. Rather than adding the right permanently, add them to a special group for the duration and remove them afterwards. Record who, why and for how long. Some organisations automate this with a request tool, but even a manual note and a calendar reminder is far better than leaving the permission in place for ever.

Everyday analogy

A visitor badge at an office is printed with a date and returned at the desk when the visit ends. Nobody expects a visitor’s badge to work next month. Temporary access should behave the same way.

Real-world example: access that outlived the job

Security investigations in many industries have found accounts of former contractors still active months after contracts ended, because removal depended on someone remembering. Setting an end date at the start and checking the contractor group on a schedule are cheap ways to avoid this.

20Emergency Access: The Break-Glass Procedure

Strict rules must still allow a fast fix when something is burning. Plan the emergency door before you need it.

What “break glass” means

The phrase comes from fire alarms behind a pane of glass: you may break it, but only in a real emergency, and breaking it is noticed. In access control, a break-glass procedure is a pre-agreed way for a small number of people to bypass the normal rules quickly, with a clear record and a review afterwards.

Design points

  • Name who may use it, usually the on-call lead and a deputy.
  • Decide what it permits: usually changing a specific flag in Production, not unlimited power.
  • Require a written reason in the incident channel at the time.
  • Review every use the next working day: was it necessary, and was the action right?
  • Test it twice a year in a calm rehearsal, so that it works when needed.
sequenceDiagram
    participant O as On-call engineer
    participant L as Release lead
    participant F as Flagsmith
    participant T as Team channel
    O->>T: Declare incident and name the flag
    O->>L: Ask for emergency approval
    L->>F: Approve change or apply it directly
    F-->>T: Audit log entry appears
    O->>T: Confirm effect and write the reason
    L->>T: Next day: review the use
FIG 8 · A break-glass flow: fast action, visible record, review the next day
Everyday analogy

A building has an emergency exit that opens with a push bar and sounds an alarm. It is always available and always noticed. People do not use it for shortcuts, because the alarm makes everyone look. The goal of break-glass access is the same: easy when needed, loud when used.

!
Watch out

If emergency access is slow or confusing, people will keep a shared administrator login “just in case”. That habit defeats the entire design. Make the proper emergency route faster than the improper one.

21Managing Permissions as Code

Clicking permissions into a dashboard works for a while. Writing them down as reviewable, repeatable configuration works much longer.

Why not only click

Hand-made permissions drift. Someone adds a quick exception, someone else forgets to remove it, and after a year nobody knows what is intended. Infrastructure as code, a way of describing settings in files that tools apply automatically, fixes this by keeping the intended state in version control, where changes are reviewed like any other change.

What can be automated

Flagsmith offers a management API, and a community and vendor-supported Terraform provider exists for many Flagsmith resources. Whether a particular permission, role or group can be managed that way depends on the version of the provider and of Flagsmith, so check what is covered before relying on it. Common candidates are projects, environments, tags, groups and role assignments.

ApproachStrengthWeakness
Manual in the dashboardQuick, visible, no toolingDrifts, hard to review, easy to forget
Management API scriptsFlexible, can connect to HR or ticket systemsYou own the scripts and their errors
Terraform or similarReviewable, repeatable, drift is detectableNeeds learning; coverage varies

Safe habits for automation

  • Give the automation its own limited credential, never a person’s token.
  • Require code review for every permission change, just like Production code.
  • Run a “plan” or dry run first and read what will change.
  • Alert when someone changes permissions by hand outside the automation.
Everyday analogy

A restaurant can teach a new cook the recipe by shouting from the kitchen, or by handing over a written recipe card that everyone has agreed on. The card can be checked, improved and shared. Permissions as code are the recipe card for who may do what.

22Testing Your Permission Design

A permission model is a piece of design, and design can be wrong. Test it the way you test anything important.

Test both directions

Most people only test that the right person can do the right thing. Just as important is the opposite: that the wrong person cannot. A test suite for access has two columns of cases, “should succeed” and “should be refused”.

TestExpected result
Developer changes a flag in DevelopmentAllowed
Developer changes a flag directly in ProductionRefused
Developer creates a change request in ProductionAllowed
Developer approves their own change requestRefused or blocked by process
Release manager approves another person’s requestAllowed
Viewer attempts any changeRefused
Contractor opens ProductionRefused or view only, as designed
Auditor reads the audit logAllowed
Former employee signs inRefused

Use test accounts

Create a few dedicated test accounts that sit in each group, such as “test-developer” and “test-viewer”. Sign in as each and try the cases above. Do this when you first design the model, after any major change, and on a schedule. Keep test accounts clearly labelled, protect them like real ones, and remove them if they become unused.

Record the results

Write down each test, who ran it, the date and the result. A simple table in a shared page is enough. The record proves that controls were tested, helps the next person repeat the tests, and shows trends over time, such as the same gap appearing after every reorganisation. When an auditor asks how you know your permissions work, you can point to evidence instead of memory. Keep the record short, honest and easy to update, or it will not be kept at all.

Rehearse the dark days

Beyond routine cases, rehearse awkward ones. What happens when the only release manager is on holiday? What happens when the identity provider is down and nobody can sign in? Is there a local administrator who can still get in, safely protected, to repair things? Finding these gaps in a rehearsal is cheaper than finding them in an incident.

Everyday analogy

After fitting a new lock, a careful homeowner checks that the key opens the door, and also pushes on the door to confirm it stays shut without the key. Testing only the first half leaves the house open.

23Monitoring and Periodic Access Reviews

Access control decays. People change jobs, projects end and exceptions pile up. Regular reviews keep the model true.

What an access review is

An access review is a scheduled check where someone looks at who holds what and asks whether each right is still needed. It sounds dull, but it is one of the highest-value habits in security, because the commonest problem is not a clever attack. It is access that nobody remembered to remove.

A simple quarterly review

1

List administrators

Confirm each is still needed and still employed.

2

List Production editors

Check who can change or approve in Production, and why.

3

Walk the groups

Remove members who changed teams or left; confirm the contractors group.

4

Review keys and tokens

Delete the unused, rotate the old, and check each has an owner.

5

Sample the audit log

Pick some Production changes and confirm they followed the rules.

6

Record and fix

Write down what you found, correct it and set the next date.

Signals worth watching

Signal

Production changes at odd hours

Not always wrong, but worth a glance.

Signal

New administrators

Every new top-level right deserves a reason.

Signal

Frequent bypasses

If the emergency door is used often, the normal door is too narrow.

Signal

Unused keys that still work

Idle credentials are targets with no owner watching.

Everyday analogy

Once a year, a careful household counts the keys: who has one, whether the old tenant returned theirs and whether any copies are missing. Nothing dramatic happened to make them check. They check because unnoticed drift is how doors end up open.

24Debugging Access Problems

Two complaints dominate: “I cannot do what I should” and “they can do what they should not”. Both have a method.

Problem 1: someone cannot do something

flowchart TD
    S["A person reports: I cannot do X"] --> A["Are they signed in with the right account?"]
    A --> B["Do they belong to the expected group?"]
    B --> C["Does the group or role hold the permission?"]
    C --> D["Is it granted at the right level and environment?"]
    D --> E["Does the environment require change requests?"]
    E --> F["Is the plan or version missing that feature?"]
FIG 9 · A path for diagnosing “I cannot do it”: check the account, group, permission, scope, approval rule and plan, in that order

Problem 2: someone can do something they should not

Remember that rights are additive. Look for other groups, direct grants and administrator flags that reach the person. Check whether the right is held at a higher level that flows down. Then look at API tokens they own, because a token may carry rights the person’s dashboard role does not seem to show.

Common causes and cures

SymptomLikely causeCure
Button missing or disabledPermission not held at this scopeGrant at the right level, via the group
Can edit in Staging, not in ProductionProduction rights were never grantedGrant, or use change requests as designed
Removed from a group but still has accessAnother route gives the same rightCheck all groups, roles, direct grants and admin flags
New joiner sees nothingNot in any group yet, or invite not acceptedAdd to the team group; confirm acceptance
SSO user lands without accessDirectory group not mapped, or provisioning delayedCheck the mapping and the user’s directory groups
Script fails with forbiddenToken owner lacks the right, or token revokedGive the automation a proper role and a fresh key
Cannot see a feature others seePlan or version differs, or tag rule hides itCheck the plan documentation and tag permissions
Everyday analogy

When a key card fails at a door, a security guard follows a short routine: is it the right card, is it active, does it have rights for this floor, is the door itself working? Going in order finds the cause quickly, instead of trying random fixes.

i
Tip

Keep a one-page “access troubleshooting” note next to your permission matrix. The same five causes explain most tickets.

25Security, Privacy and Compliance

RBAC is one layer of a larger defence. Seeing the whole picture shows where it helps and where other layers must carry the load.

Threats that RBAC addresses

ThreatHow RBAC helpsWhat else is needed
Honest mistake in ProductionFewer people can reach it; approvals add a second lookRollback habits, monitoring
Malicious insiderLimits what one person can do alone; audit log records itSeparation of duties, log review, offboarding
Stolen passwordLimits what the stolen account can reachTwo-factor sign-in, SSO, alerts
Leaked API tokenA limited role limits the damageSecret scanning, rotation, short lifetimes
Leaver keeps accessGroups make removal one actionDirectory-driven offboarding, token rotation
Excess privilege creepRoles make the right size visibleRegular access reviews

Sensitive data inside Flagsmith

Two places deserve special care. Flag values can hold text, numbers or structured settings, and people sometimes put sensitive things in them. A rule of thumb: never store passwords, private keys or personal data in flag values. Identities and traits describe individual end users and may contain personal data. Restrict who may view identities in Production, and store only what you truly need, in line with the privacy laws that apply to you, such as GDPR in Europe or India’s data-protection law. Laws differ and change, so consult your legal and privacy teams for requirements specific to you.

Separation of duties

Separation of duties means that no single person can complete a sensitive process from start to finish. In flag terms: the person who proposes a Production change is not the person who approves it, and the person who administers permissions is not the person who audits them. Auditors often look for this pattern explicitly.

Self-hosted and cloud differences

If you use Flagsmith’s hosted service, the vendor operates the platform and you control the permissions inside it. If you self-host, you also control the servers, databases, network, backups and upgrades. Then the surrounding security belongs to you too: who can reach the database, who holds server access, and how backups containing flag data and keys are protected. RBAC inside the tool cannot protect you from someone who can read the database directly.

Strong posture

  • Few administrators, each with two-factor sign-in
  • Production changes through reviewed change requests
  • Machine keys with narrow roles and a rotation habit
  • Audit log exported and reviewed

Weak posture

  • Shared administrator login
  • Personal tokens in scripts, owned by people who left
  • Secrets and personal data in flag values
  • Access reviews that never happen
Everyday analogy

A bank vault has a thick door, but also guards, cameras, a two-key rule, and a log of everyone who entered. The thick door alone would not be enough. RBAC is the door and its locks. The other layers are the guards, cameras and the log.

!
Watch out

Regulations about data, finance and health differ by country and industry and change over time. This chapter gives general good practice, not legal advice. Ask your compliance team which rules apply to you.

26Anti-patterns to Avoid

An anti-pattern is a habit that looks sensible and causes trouble later. These five are the most common in access control.

ANTI-PATTERN 01 · EVERYONE IS AN ADMINAvoid
What it looks like

To stop permission tickets, the team makes everyone an administrator.

Why it hurts

There is no boundary at all. Any account compromise or slip reaches everything, and the audit shows nothing useful.

Do this instead

Make good groups and roles quickly, so permissions are easy to get right, and the shortcut loses its appeal.

ANTI-PATTERN 02 · THE SHARED LOGINAvoid
What it looks like

One account, with a password in a team chat, used by many people.

Why it hurts

Nobody can be held accountable, a leaver cannot be cut off, and two-factor sign-in is impossible to use sensibly.

Do this instead

One account per person, with SSO where possible, and a proper break-glass route.

ANTI-PATTERN 03 · PERMISSION CREEPAvoid
What it looks like

Each request adds a right. Nothing is ever removed. After two years, a junior has more rights than the manager.

Why it hurts

The effective access of each person becomes unknowable, and a single compromise grants a lot.

Do this instead

Give rights through groups, review them every quarter and remove what is unused.

ANTI-PATTERN 04 · THE PERSONAL TOKEN IN THE PIPELINEAvoid
What it looks like

An engineer’s own Admin API token is placed in a build pipeline because it was handy.

Why it hurts

The pipeline carries the engineer’s full rights. When they leave, the pipeline breaks, or worse, the token is kept alive to avoid the breakage.

Do this instead

Create a dedicated automation credential with only the needed role, store it in a secrets manager and rotate it.

ANTI-PATTERN 05 · APPROVALS WITHOUT READINGAvoid
What it looks like

Change requests exist, but approvers click “approve” within seconds without looking.

Why it hurts

The team believes in a safety net that has holes. Delay is added, protection is not.

Do this instead

Make requests small and clear, include the reason and the rollback, and sample approvals during reviews.

Real-world example: over-broad access in public incidents

Many publicly reported security incidents trace back to access that was far wider than any job required, such as an account or token that could reach everything. The consistent advice from post-incident reports is to narrow credentials so that a single leak cannot become a full breach.

27Advantages, Disadvantages and Trade-offs

RBAC is powerful, and it is not free. Knowing the costs helps you spend on it wisely.

Advantages

  • Rules mirror jobs, so they are easy to explain
  • Joiners, movers and leavers need very little work
  • Smaller blast radius for mistakes and compromises
  • Clear evidence for auditors
  • Safe delegation to more people
  • Works well with approvals and single sign-on

Disadvantages

  • Needs upfront design and regular upkeep
  • Rigid when a rule depends on context
  • Too many roles become confusing
  • Approvals add friction to urgent work
  • Some features depend on paid plans
  • Does not protect against careless secrets or a weak sign-in

Choosing how strict to be

SettingSafetySpeedBest for
Open: most people can change most thingsLowHighTiny teams, no customers yet
Balanced: free in test stages, reviewed in ProductionGoodGoodMost product teams
Strict: narrow rights, multiple approvals, formal recordsHighestLowerPayments, health, regulated industries

Where to relax and where to tighten

Relax

Development

Experiments cost nothing. Let engineers move quickly.

Balance

Staging

Open to engineers and testers, with care for realistic data.

Tighten

Production

Narrow, reviewed, recorded.

Tighten

Keys and admin rights

The few things that can change everything deserve the most care.

Everyday analogy

A good home has an unlocked living room, bedroom doors that close and a locked cupboard for medicines. Locking every cupboard, including the biscuit tin, would make life miserable. Locking nothing would be unsafe. Good access control puts the locks where the risk is.

i
Tip

When people complain a rule slows them down, ask which risk the rule guards. If the risk is small, loosen the rule. If it is large, make the safe route faster instead.

28Best Practices and Common Mistakes

Experienced teams repeat a short list of habits. New teams repeat a short list of mistakes. Here are both.

Habits worth building

1

Least privilege by default

Start with nothing and add only what the job needs.

2

Groups, not people

Give rights to groups that mirror teams, and move people between groups.

3

Guard Production with two people

One proposes, another approves, never the same person.

4

Few administrators

A short, named list with two-factor sign-in and individual accounts.

5

Treat keys like passwords

Narrow roles, secrets managers, scheduled rotation.

6

Connect to company identity

Use SSO and directory groups where your plan allows.

7

Write the matrix down

One table of roles against actions, kept up to date and shared.

8

Review on a schedule

Quarterly checks of administrators, groups, keys and the audit log.

9

Plan the emergency door

A break-glass route that is fast, loud and reviewed.

Mistakes to catch early

Mistake

Granting at too high a level

A project-wide right where one environment would do.

Mistake

Forgetting additive rights

Removing one route while another still grants access.

Mistake

Ignoring read access

Allowing anyone to view Production values and identities.

Mistake

Forgetting the leavers’ tokens

The person is removed, but their scripts keep working.

Mistake

Never testing the refusals

Checking only that the right people can, not that the wrong people cannot.

Mistake

Making segment edits casual

Audience rules reach every flag that uses them.

i
Tip

Pin the habits beside your permission matrix. A short list in sight works better than a long document nobody reopens.

29A Complete Worked Scenario

To finish, here is one imaginary company taken from an open, messy setup to a clean RBAC design, using everything in this guide.

BrightCart, the imaginary online shop, has grown from eight to ninety engineers in three years. It uses one Flagsmith project for its web shop, a mobile app project and a payments project. Its early habits remain: twenty people are organisation administrators, a shared login named “release-bot” is used by anyone who needs to change Production, and a personal Admin API token of an engineer who left last year still runs the nightly deployment script. A recent incident, in which a flag for a payment method was switched off at midday by someone who thought it was unused, is the trigger for a clean-up.

1

Week 1: take stock

The platform lead lists everyone with access, every group, every key and every token, and who owns each. They find forty users, six unused tokens and three people who no longer work at the company.

2

Week 2: write the matrix

Together with team leads they define five roles: Viewer, Developer, Release manager, Auditor and Platform admin. They grade environments by risk and agree the rule that Production changes need one approval from a release manager other than the author.

3

Week 3: build groups and roles

They create one group per team, a Release managers group of six people, a Contractors group and a Viewers group. Roles are attached to groups, and no role is given directly to a person.

4

Week 4: shrink the administrators

The twenty administrators are reduced to three, each with two-factor sign-in and an ordinary daily account. The shared “release-bot” login is disabled after the break-glass procedure is written and rehearsed.

5

Week 5: fix the keys

The old personal token is replaced with a dedicated deployment credential, with a role that allows only what the script needs. It is stored in a secrets manager and given a rotation date. Unused tokens are deleted.

6

Week 6: turn on change requests

Production now requires change requests. Developers can propose but not apply. The team trains on writing clear requests: what changes, why, what could go wrong and how to roll back.

7

Week 7: test both directions

Test accounts for each role try the planned cases. Two surprises appear: Developers can still delete flags in the payments project because of an old direct grant, and Contractors can see identities. Both are fixed.

8

Week 8: connect to company identity

Sign-in moves to the company’s identity provider. Directory groups are mapped to Flagsmith groups, so joiners, movers and leavers follow the directory automatically, and the leaving checklist adds token rotation.

9

Ongoing: review and learn

A quarterly review is scheduled. After three months, the review notices that the emergency route is used twice a week, mostly at night, for the same flag. The team realises the flag should have an automated safeguard, and fixes the cause instead of the symptom.

i
Note

Notice that nothing here required a clever invention. The result came from ordinary steps done in order: stock-taking, a matrix, groups, fewer administrators, proper keys, approvals, tests, identity integration and reviews.

What would have gone wrong without the clean-up?

Without it, the next unused-looking flag would have been switched off by a well-meaning engineer, and no approval would have caught it. The leaver’s token could have been found by anyone with access to the old repository. A new contractor would have been given the shared login. And when the auditors asked who could change Production, the honest answer would have been “nearly everyone, and we cannot say who did”. Each of these is an ordinary risk, and each is closed by the habits in this guide.

30Access Across the Life of a Flag

A flag is born, grows, is released, and is finally retired. Different people should hold the pen at different stages.

Stage by stage

StageWhat happensWho should be able to do it
CreateA new flag is defined in the projectDevelopers on the owning team
Build and testState is changed in Development and StagingDevelopers and testers
ReleaseState is changed in Production, often graduallyRelease managers, or developers through reviewed requests
OperateThe flag is watched; audiences may be adjustedOwners, product staff, on-call
RetireThe flag is made permanent and then removedOwner proposes; a small senior group deletes

Ownership is a form of access

Every flag should have a named owner, a team or a person. Ownership tells everyone whom to ask before changing a flag and who must clean it up. Flagsmith lets you add descriptions and tags to flags, and these are good places to write the owner and the purpose. A flag without an owner is how “this looks unused, I will switch it off” accidents begin.

The danger of old flags

Old flags are a quiet risk. Nobody remembers them, yet code may still depend on them. A common safe pattern is to make removal a two-step act: first the owner marks the flag as ready to retire and removes it from code, and only after code is deployed and quiet does a senior person delete the flag. Keeping delete rights narrow protects the second step.

flowchart LR
    C["Create: developer"] --> T["Test: developer and tester"]
    T --> R["Release: reviewed change"]
    R --> O["Operate: owner"]
    O --> D["Retire: owner proposes, senior deletes"]
FIG 10 · Different people hold the pen at different stages of a flag’s life
Everyday analogy

A library book has a life too: ordered by the buyer, shelved by the librarian, borrowed by readers and finally removed by the head librarian after checking nobody needs it. Nobody expects the reader to remove books, and nobody expects the buyer to shelve them.

i
Tip

Add the owner’s team name and the intended removal date to every new flag’s description. It costs ten seconds and saves hours of detective work a year later.

31Identities, Traits and Customer Privacy

Some of what Flagsmith holds is about your customers, not your team. Access to it needs the strictest care.

What identities are

An identity is Flagsmith’s record of one end user of your product, identified by a unique string you provide. It can carry traits, which are small facts about the user, such as their plan or country. Segments use traits to decide who gets which feature. In many setups identities are created on the fly as users appear, so the list can grow large and contain personal information.

Why it matters for access

People with permission to view identities can see these records. People with permission to manage identities can edit them, and editing a trait can change which features a customer receives. A support agent might legitimately need to look up one customer. Almost nobody needs to browse them all. So separate “view and manage identities” from the general “view environment” permission, and give it narrowly, particularly in Production.

Reducing the risk at the source

Practice

Use opaque identifiers

Use an internal customer number, not an email address or name, as the identity string.

Practice

Keep traits minimal

Store only the facts needed for targeting, such as a plan tier, not personal details.

Practice

Review what is stored

Look at a sample of identities each quarter for things that should not be there.

Practice

Know the deletion path

Be able to remove a person’s record when privacy rules require it.

Everyday analogy

A doctor’s surgery has the appointment diary at the front desk, but the medical files in a locked room. The receptionist needs the first, not the second. Identities and traits are closer to the files than to the diary, and the key should be handed out accordingly.

!
Watch out

Privacy law depends on country and on what you store. If identities include anything that points to a real person, ask your privacy or legal team how long you may keep it and who may see it.

32Integrations, Webhooks and Who They Act As

Flagsmith can connect to other tools. Each connection is another place where access must be thought through.

Two directions

Connections go both ways. Inbound, other tools such as pipelines or ticket systems call Flagsmith’s management API, using a token. Outbound, Flagsmith tells other tools about events, for example by webhooks, which are messages sent to a web address when something changes, or by integrations with chat, monitoring and analytics services. Which integrations exist depends on your version and plan.

Questions for every connection

QuestionWhy it matters
Who created the connection?Its creator is often its owner; when they leave, it needs a new one
What rights does it act with?An inbound token may be as powerful as a person
Where does the data go?Outbound messages may contain flag names, values and user information
Is the destination trusted and secured?A webhook to an unprotected address leaks information
Who can create or change connections?An integration can be a way around other controls

Managing change in integrations

Treat integration settings like any other sensitive configuration. Keep a list of them with owners, restrict who may add or edit them, and review the list when you review keys. A webhook that sends flag changes to a chat channel is helpful. A webhook that sends them to a forgotten server is a leak.

Everyday analogy

A company’s mailroom sends and receives parcels. The company keeps a list of the approved couriers and checks who may sign for deliveries. A new courier who appears without paperwork would worry anyone. Integrations are your couriers, and the list is the paperwork.

i
Tip

Send audit-log events to a central place that most administrators cannot alter. A copy outside Flagsmith keeps its record even if someone later changes settings inside it.

33Migrating from Open Access to RBAC Safely

Most teams do not start with a perfect design. They start open, and tighten later. Doing that without breaking work needs a plan.

The risks of tightening

If you remove rights suddenly, scripts fail, releases stall and people look for workarounds. If you tighten too slowly, the risk stays. The goal is a steady, announced, reversible move.

A safe migration path

1

Observe first

Use the audit log to learn who actually changes what, and which keys really run.

2

Design the target

Write the matrix and roles from real usage, not from guesses.

3

Build alongside

Create groups and roles first, without removing anything.

4

Announce the date

Tell everyone what will change, when, and how to ask for help.

5

Cut over in layers

Start with Production, which matters most, then tighten Staging if needed.

6

Keep a fast fix route

For the first weeks, a named person answers permission requests within hours.

7

Review and adjust

Collect complaints, fix real gaps, and explain the reasons for the rest.

flowchart LR
    O["Open access"] --> L["Learn from the audit log"]
    L --> B["Build groups and roles alongside"]
    B --> A["Announce and cut over Production first"]
    A --> R["Review, adjust, repeat"]
FIG 11 · A gentle migration from open access to RBAC without breaking daily work
Everyday analogy

A town that decides to add traffic lights to a busy crossing first counts the cars, then builds the lights, then announces the date, then switches them on with a policeman standing by for the first week. Switching on lights with no notice invites chaos. A planned switch just feels like progress.

!
Watch out

Before removing any key or token, check whether anything still uses it. Cutting off a forgotten deployment script on a Friday evening is a classic way to turn a security clean-up into an outage.

34Governance: Owning the Rules

Rules without an owner decay. Someone must be responsible for the permission model, in writing and by name.

Who owns what

DutyOwnerCadence
The permission matrixPlatform leadUpdated whenever roles change
Group membership accuracyEach team leadChecked monthly
Administrator listHead of engineering or securityReviewed quarterly
Keys and tokensPlatform team with each key’s named ownerRotation schedule
Audit log reviewSecurity or a delegated leadSampled monthly
Break-glass rehearsalOn-call leadTwice a year

A short written policy

A policy does not need to be long. One page can state the principles (least privilege, two people for Production, individual accounts), the roles and what they mean, how to request access, how long contractors may keep it, how emergencies are handled and when reviews happen. People will read a page. They will not read a manual.

Training and onboarding

Rules that nobody understands are rules that people work around. When a new engineer joins, spend fifteen minutes explaining the levels, the roles, why Production needs a second person and how to ask for more access. Show them the permission matrix and the break-glass route. Repeat a short version once a year for everyone. People who understand the reason behind a rule follow it more willingly, and they notice quickly when a rule is not working as intended.

Keeping a decision log

Whenever you grant an unusual right or make an exception, write down who agreed, why, and when it should be reviewed. A simple shared page is enough. Months later, nobody will remember the reason, and the log turns a mysterious permission into an understood decision that can be safely kept or removed.

Handling requests

Make asking for access easy and visible. A simple form or ticket, with a named approver and a record of why, is enough. If asking is painful, people borrow someone else’s login. If asking is simple and quick, they follow the rules happily.

Everyday analogy

A block of flats has a caretaker who keeps the key register, hands out new keys and collects old ones. The register is simple, but the caretaker makes sure it is true. Without a caretaker, the register slowly fills with guesses.

35Measuring Whether Your Access Control Works

You cannot improve what you cannot see. A few simple measures show whether the model is healthy.

Useful measures

Measure

Number of administrators

Should be small and stable. A rising count is a warning.

Measure

Share of Production changes through requests

Should be close to all, except recorded emergencies.

Measure

Emergency uses per quarter

Few is good. Many means the normal route is too hard.

Measure

Time to grant a legitimate request

Should be hours, not weeks. Slow grants breed shortcuts.

Measure

Age of the oldest unused key

Idle credentials should be deleted quickly.

Measure

Leavers removed on time

The gap between the last day and the removal should be zero.

Reading the numbers

Numbers are prompts for questions, not verdicts. A rise in emergency uses may mean a real incident period, or a rule that needs changing. A slow grant time may mean too few approvers. The point is to notice drift early, discuss it calmly and adjust before it becomes an incident.

Healthy signs

  • Stable, short administrator list
  • Almost every Production change has a request and a reason
  • Access requests are answered the same day
  • Reviews find small, quick fixes

Warning signs

  • Administrator list grows quietly
  • Emergency route used weekly
  • Old keys nobody can explain
  • Reviews are skipped because “nothing changes”
Everyday analogy

A car dashboard does not drive the car. It shows speed, fuel and temperature, so the driver notices a problem before the engine fails. These measures are the dashboard of your access model.

36Frequently Asked Questions

Short, direct answers to the questions people ask most about RBAC in Flagsmith.

Q1What is RBAC in Flagsmith?
It is the way you control which team members can see and change flags, by giving permissions to roles and groups at the organisation, project and environment levels, instead of managing each person separately.
Q2Is RBAC the same as targeting users with segments?
No. RBAC controls your team members’ access to the Flagsmith tool. Segments and targeting control which of your product’s end users receive a feature.
Q3What are the levels where permissions apply?
Organisation, project and environment. Higher-level administrator rights flow down to what lies beneath. Some plans also allow narrowing by tag.
Q4Do I need custom roles?
Not necessarily. Without custom roles you can grant permissions to groups directly. Roles save effort and reduce mistakes in larger setups, and they are commonly part of higher plans, so check yours.
Q5Why can someone still act after I removed a permission?
Rights are additive. They may hold the same permission through another group, a role, a direct grant or an administrator right at a higher level. Check every route.
Q6Who should be an organisation administrator?
A very small, named group, for example two or three platform leads, each using two-factor sign-in and an individual account.
Q7How do change requests relate to permissions?
Change requests split proposing from approving. A person can be allowed to propose a Production change but not apply it, and another person approves. This gives a two-person rule.
Q8Can an application be given limited access?
Client-side and server-side environment keys read flags for one environment, and Admin API tokens manage settings. Where your plan supports organisation-level keys with roles, give automation only the role it needs.
Q9Is the client-side key a secret?
No, it is exposed by nature because it is shipped inside apps. Keep sensitive logic and values out of what it can reach. The server-side key and Admin API tokens are secrets and must never reach a browser or an app.
Q10Does Flagsmith support single sign-on?
Support for methods such as SAML and OpenID Connect exists in some editions and plans, and details differ between hosted and self-hosted. Confirm what applies to you in the documentation.
Q11How often should we review access?
At least quarterly for administrators, Production editors, groups and keys, and after every incident, reorganisation or major departure.
Q12What should we do during an emergency when approvals are slow?
Use a prepared break-glass route: a named person can approve or act at any hour, writes the reason in the incident channel, and the use is reviewed next day.
Q13Can permissions be managed with Terraform or the API?
A Terraform provider and a management API exist, but coverage of specific permission features varies by version. Check what is supported before relying on it, and keep any manual changes under review.
Q14Is it safe to put secrets in flag values?
No. Flag values can be read by anyone with view rights and, for client-side flags, by apps. Keep passwords, keys and personal data in proper secret stores.

37Summary and Key Takeaways

RBAC lets you give many people useful power over flags without giving anyone more than they need. A few ideas carry nearly all the value.

Key Takeaways

  • Roles and groups, not individuals. Give permissions to roles, attach roles to groups that mirror teams, and move people between groups as jobs change.
  • Know the levels. Organisation, project and environment each hold different powers, and higher rights flow down. Grant at the lowest level that does the job.
  • Protect Production most. Let engineers experiment freely in Development, and require reviewed change requests, with a different person approving, in Production.
  • Rights add up. Effective access is the sum of every route, so check groups, roles, direct grants and administrator flags before saying someone cannot do something.
  • Machines need limits too. Use separate, narrow credentials for each application and pipeline, keep secrets in a secrets manager and rotate them.
  • Tie sign-in to company identity. Use single sign-on, two-factor checks and directory-driven groups where your plan allows, and include token rotation in offboarding.
  • Design, test, review. Write the permission matrix, test both what should and should not be allowed, plan the emergency route and review access on a schedule.