1) Target operating model (federated, centrally governed)
Goal: Let autonomous teams ship and operate feature flags independently, while a central platform enforces baseline controls (security, compliance, reliability) and provides shared tooling.
Roles
- Feature Flag Platform Team (central): owns flag service, SDKs, policy engine, audit pipeline, break-glass procedures, templates.
- Tenant Admin (per tenant/business unit): manages tenant-level RBAC, environments, integrations, retention settings within tenant bounds.
- Flag Owner (per product/team): accountable for a flag’s lifecycle, targeting rules, and cleanup.
- Release Manager / SRE: oversees progressive delivery, monitors rollouts, may request emergency override.
- Security/Compliance: defines mandatory controls, reviews audit evidence.
Core objects
- Org → Tenant → Project → Environment → Flag
- Policy Sets attached at any level and inherited downward (with constrained overrides).
- Change Requests (human + machine): create/update/archive flags; update targeting; override.
2) Policy inheritance model (guardrails with controlled flexibility)
Policy types
- Baseline (mandatory, non-overridable) – set by central governance (Org scope).
- Tenant policy (mandatory within tenant, overridable only by tenant admin) – set per tenant.
- Project policy (defaults + conventions) – set per product.
- Environment policy (runtime constraints) – e.g., production requires approvals, staging is freer.
Inheritance rules (recommended)
- Policies merge top-down:
Org ⟶ Tenant ⟶ Project ⟶ Environment.
- Each policy clause is one of:
- Hard deny (cannot be overridden)
- Hard require (must be satisfied)
- Default (can be overridden)
- Allowlist (permitted values/operators)
- Evaluation is “most restrictive wins” for security/compliance clauses.
Example policy clauses (practical defaults)
Flag creation
- Must specify:
owner, ticket/epic, service, data-classification, expected TTL.
- Enforce naming:
team.service.flag_name and tag taxonomy (e.g., kill-switch, experiment, ops, permission).
Lifecycle
- Require
sunset_date (e.g., 30–180 days depending on type).
- Require review cadence: e.g., monthly for kill-switches, per experiment end for experiments.
- Auto-notify and auto-disable/archive if expired (with grace window + approvals).
Production safety
- Production changes require:
- Two-person approval (or one-person + on-call) for high-risk flags.
- Change window enforcement (optional, per tenant).
- Targeting rule constraints (e.g., max % ramp per hour unless approved).
- Mandatory monitoring links (dashboard/alert IDs).
Targeting constraints
- Allowlist operators for sensitive attributes (e.g., no targeting by raw email; only by hashed IDs or coarse segments).
- Prohibit targeting by protected attributes unless explicitly allowed and audited.
SDK / client exposure
- Front-end/mobile flags must be marked public and limited to non-sensitive payloads.
- Enforce separation: “server-only” flags cannot be evaluated in client SDKs.
3) Tenant isolation (hard boundaries and safe multi-tenancy)
Isolation goals
- One tenant must not view, modify, or infer another tenant’s flags, segments, metrics, or audit logs.
- SDK credentials and evaluation contexts must be scoped so cross-tenant access is impossible by design.
Controls
Control plane (management UI/API)
- Tenant-scoped RBAC with explicit tenant ID on every request.
- Authorization enforced at the policy engine, not just UI.
- Separate projects/environments per tenant; deny cross-tenant imports by default.
Data plane (flag evaluation)
- Per-tenant SDK keys (and per environment within tenant).
- Tokens include tenant/env scope and are validated by gateway.
- Consider separate edge config bundles per tenant to prevent accidental leakage in CDN caches.
Storage & encryption
- Logically separate data with tenant partition keys.
- Encrypt at rest with per-tenant keys (KMS) when compliance requires.
- Optional: physically separate clusters for regulated tenants.
Observability isolation
- Metrics/experimentation events are tagged by tenant and stored in tenant-partitioned datasets.
- Dashboards default to tenant scope; cross-tenant views only for central platform/security with explicit approval.
4) Audit trails (tamper-resistant, queryable, compliance-ready)
What to audit (minimum)
- Flag lifecycle: create, update, archive, delete (if allowed).
- Targeting/rules changes (including % rollouts).
- Policy changes at any level.
- Permission/RBAC changes.
- Emergency overrides (who/why/when, before/after).
- Access events for sensitive tenants (optional): reads of flag configs, exports.
Audit event schema (recommended fields)
event_id, timestamp, tenant_id, project_id, environment
actor_id, actor_type (human/service), auth_method (SSO, break-glass)
action, resource_type, resource_id
diff_before, diff_after (or patch)
reason, ticket_id, approvers[]
client_ip, device, session_id
policy_decision (allowed/denied + which clause)
Storage and retention
- Append-only store (WORM-capable) for compliance tenants.
- Stream to SIEM (Splunk/ELK/Sentinel) with alerts:
- production flag changed without approval
- break-glass used
- large blast-radius ramp
- Retention tiers:
- Hot searchable (e.g., 30–90 days)
- Cold archive (e.g., 1–7 years depending on regulatory needs)
5) Emergency overrides (“break-glass”) with strict controls
Use cases
- Disable a failing feature immediately (kill switch).
- Stop an experiment causing harm.
- Mitigate security incident (turn off risky pathway).
- Roll back exposure during an outage.
Model
Two override layers
- Flag-level kill switch (preferred): pre-created, tested, and owned by team.
- Platform override (last resort): central SRE/security can force a flag state regardless of flag rules.
Break-glass design requirements
- Separate role:
BreakGlassOperator (no day-to-day use).
- Strong auth: hardware key/MFA + short session TTL.
- Justification required (incident ID), and post-incident review mandatory.
- Overrides are:
- time-bound (auto-expire)
- scoped (tenant/project/env)
- audited with high severity alerts
- Optional “four-eyes”: require a second approver for overrides affecting >X% of traffic or multiple tenants.
Operational playbook
- Predefined runbooks: “disable feature”, “freeze rollouts”, “lock changes”.
- On-call has a fast path: CLI command with incident ID, emits audit + Slack/Teams notification.
- Postmortem checklist includes: remove override, restore normal flag rules, verify cleanup.
6) Deployment tooling (GitOps + guardrails + runtime safety)
Recommended approach: “Flags-as-Code” with controlled UI
- Git is the source of truth for:
- flag definitions (metadata, owner, TTL, type)
- default states per environment
- approved targeting templates (where feasible)
- UI allowed for:
- day-to-day ramp changes within policy
- experiments (if integrated) within constraints
- Periodic drift detection reconciles UI changes back to Git (or blocks non-approved drift in production).
Toolchain components
- CLI / CI action
flag validate: schema + policy checks + naming + TTL + owner + forbidden operators
flag plan: diff summary by tenant/project/env
flag apply: deploy to flag service with change request ID
- CI gates
- Production changes require approvals and passing checks
- “Blast radius” estimation: how many users/tenants impacted
- “Dependency checks”: ensure referenced segments exist and are tenant-scoped
- Templates
- kill-switch template
- progressive rollout template (1% → 5% → 25% → 50% → 100%)
- experiment template (with end date + metrics)
- SDK governance
- version pinning and upgrade policy
- lint rules: forbid direct branching on unknown flag keys; require default behavior
- runtime fallback: cached last-known-good config; circuit breaker for flag service outage
- Release integration
- CI/CD ties deploy artifact version to flags:
- “flag targets only versions ≥ X”
- or “flag enabled only after deploy succeeded”
- Optional: automatic ramp schedules post-deploy with guardrails.
Environment strategy
- Dev: free-form, fast iteration.
- Staging: mirrors prod policies but with relaxed approvals.
- Prod: strict approvals, tight audit, constrained targeting operators, ramp limits.
7) Training & enablement plan (role-based, repeatable)
Training tracks (with hands-on labs)
A) Developers (2–3 hours + lab)
- Flag types: release, ops/kill-switch, permission, experiment
- Safe defaults, fallbacks, and avoiding “flag debt”
- Using templates, adding metadata/TTL
- Lab: create a kill switch + progressive rollout + cleanup/archival
B) Product/Experimentation (1–2 hours)
- Targeting basics, segmentation strategy, ethical targeting constraints
- Experiment setup, stop conditions, end-of-life responsibilities
- Reading dashboards and interpreting ramp metrics
C) SRE/On-call (1–2 hours + incident drill)
- Emergency override runbook
- Ramp safety and rollback patterns
- Auditing and evidence capture during incidents
- Drill: simulated outage → disable feature → expire override → postmortem steps
D) Tenant Admins (1–2 hours)
- RBAC, environment setup, integrations (SSO, SIEM)
- Tenant-level policy customization within org baselines
- Reviewing audit logs and responding to access requests
E) Security/Compliance (1 hour)
- Policy clauses, audit queries, retention, break-glass controls
- Periodic access review procedures
Reinforcement & governance cadence
- Office hours weekly for first 8–12 weeks after rollout.
- Quarterly flag hygiene review (expired flags, orphaned owners, stale kill switches).
- KPIs
- % flags with owner/TTL
- median time to remove expired flags
- number of emergency overrides (and time-to-expire)
- policy violations blocked by CI
- incidents mitigated by kill switch vs platform override
8) Minimal “golden rules” to publish org-wide (one-page)
- Every flag has an owner, purpose, TTL, and type.
- Production changes are auditable and approved per policy.
- Tenants are isolated by default; no cross-tenant targeting or data access.
- Prefer pre-built kill switches; platform override is last resort and time-bound.
- Flags must be cleaned up—no permanent “temporary” flags.
If you share your current flag platform (e.g., LaunchDarkly/Unleash/ConfigCat/homegrown), tenancy model (SaaS tenants vs org units), and compliance requirements (SOC2/ISO/HIPAA), I can map this into a concrete reference implementation (RBAC matrices, sample policies, CI pipelines, and audit schemas) tailored to your tooling.