Restricting OpenBao JWT logins with bound claims and CEL: when a valid token is not enough
An identity provider signature proves only that the provider issued the token, not that the token should open a secret path in OpenBao. The JWT/OIDC auth method in OpenBao checks that a token comes from a trusted issuer and is signed by a key OpenBao can verify, then maps the token to a role and issues an OpenBao token under that role's policies. In a shared identity provider, that trust is often far too broad. The same issuer may sign tokens for dozens of applications, pipelines and user populations, and a token minted for one of them may still pass issuer validation in OpenBao. Teams need to decide, for each role, which tokens are acceptable and what that role may grant.
The first controls are the audience and the claims bound to the role. The bound_audiences setting limits which aud values are accepted, so a token issued for a different relying party is rejected even when its signature is valid. The bound_claims map requires specific claim values, such as a group, repository or environment, and supports glob matching for patterns like a repository path prefix. Before writing the role, list the claims your identity provider actually emits for each workload and confirm their names and formats with the provider's configuration, because a role that binds a claim the provider never sets will reject everything or, if written loosely, accept more than intended.
Claims alone cannot express every rule. When a condition depends on combinations of claims, on the time of the request or on the shape of the token, teams move to CEL programs, which the OpenBao JWT role documentation describes as the way to write those expressions. Use CEL for the narrow cases that need it, keep each expression readable enough for a reviewer to audit, and test accepted and rejected tokens against every role before it reaches production. Confirm the CEL features and variables available in your OpenBao version in the OpenBao auth methods documentation before you depend on them.
The layers that narrow a JWT login in OpenBao
A JWT role in OpenBao is only as narrow as the layers around it. Each layer below blocks a different class of bad token, and none of them covers everything, so the role design has to combine them deliberately.
Trusted issuer and signing keys
The auth method's configured issuer and key source decide which tokens OpenBao will even evaluate. Any token signed by a key OpenBao does not trust is rejected before a role is consulted. This layer does not check what the token is allowed to do, so a trusted issuer that also serves other applications still needs the layers below. Confirm how the installed version fetches and rotates keys and how it handles discovery URLs against the auth methods docs.
Auth methods docsBound audiences
The bound_audiences setting requires the token's aud claim to contain a value you list, which stops tokens minted for a different relying party from being replayed against OpenBao. It does not limit which subjects or groups may log in, and a token issued for the right audience can still belong to the wrong user. Set the audience to a value your IdP issues specifically for OpenBao, and confirm how multiple audiences are matched in your version.
Bound claims with glob matching
The bound_claims map requires named claims to match values you specify, such as a repository path, a group name or an environment. Glob patterns let one role cover a family of values, but a loose pattern can admit more subjects than intended. Test each pattern against real token samples, and confirm whether list-valued claims and multi-claim matches behave as you expect in the installed release.
Role separation and token policies
Separate roles for separate workloads keep a compromised pipeline from reaching secrets meant for another team. Each role attaches its own token policies, so the narrowest policy set should apply to each one. Role separation does not stop a misconfigured role from being too broad, so review the policies attached to every role and the token TTLs they issue.
CEL programs for complex rules
CEL bound claims expressions let a role check conditions that plain claim matching cannot express, such as combining several claims or comparing values. A CEL rule is code that runs on every login, so a mistake can either lock out valid workloads or admit invalid ones. Write small, tested expressions, and confirm the supported CEL variables and functions for your version in the auth methods docs before depending on them.
What no layer covers
No single layer proves that the token holder is the intended workload, and a stolen token that still matches every rule will pass. Check token lifetimes, token revocation behavior and audit logs as part of the design, and plan a test login for each role after every change to the claims, the IdP or the OpenBao version.
Bound audiences, bound_claims, glob matching or CEL: which to use
This table compares the four ways to restrict a JWT role in OpenBao by the question each one answers, its typical use and its limits. Read it top to bottom to pick the simplest mechanism that closes the gap, then add the next one only when a specific trust rule needs it.
| Mechanism | Question it answers | Typical use | What it cannot express | Maintenance cost |
|---|---|---|---|---|
| Bound audiences | Was this token issued for this OpenBao role? | Stopping tokens minted for other applications at the same identity provider from logging in | Anything about the subject, group or environment of the user | Low: one value per role, changed when the client registration changes |
| bound_claims | Does a specific claim equal an exact value? | Restricting logins to one tenant, one group or one repository owner | Lists of acceptable values, pattern matches or conditions across several claims | Low to moderate: one entry per claim, reviewed when identity provider claim names change |
| Glob matching in bound_claims | Does a claim match a wildcard pattern? | Accepting a family of subjects, such as every branch of one repository or every user in a directory prefix | Exclusions, negation or logic that depends on two claims together | Moderate: broad patterns quietly widen access when new values appear, so review them on each change |
| CEL programs | Does a rule over all claims hold, including combinations and conditions? | Requiring a claim to be present and matched together with another, or allowing one branch only in a named environment | Little that is out of reach, but the rule is code that must be tested and read by reviewers | Highest: rules need tests, version control and review whenever the trust model changes |
| Combined use (illustrative) | Is the whole trust boundary described by one role? | One role per pipeline or per environment, with audience, a bound claim and a CEL check layered together | Replacing a clear role boundary with one broad role that accepts many trust sources | Moderate: more roles to track, but each one is easier to audit and to revoke |
How a JWT login passes through OpenBao role checks
The login starts when a workload asks its identity provider for a signed JWT, then presents that token to the OpenBao JWT/OIDC auth method. OpenBao checks the token signature and the role's bound audiences and bound_claims first, then glob patterns and any CEL program. Only if every check passes does OpenBao issue a token carrying the role's policies. The trust boundary sits between the identity provider and OpenBao, so the role rules are the only control OpenBao applies to the claims it receives.
Trust boundary and the ordered checks a JWT must pass before OpenBao issues a token.
Writing and testing a bound JWT role step by step
This sequence takes a team from a real identity provider token to a tested OpenBao JWT role that accepts only the workloads it should. Each step ends with a check so the team knows the role behaves as intended before it reaches production.
Capture and decode a real token from the issuer
The platform or identity team requests a token from the issuer for the workload or user that should log in, then decodes it without trusting it. Record the issuer value (iss), the audience (aud), the subject (sub) and every claim you plan to use to restrict access, such as repository, branch, environment or group. Confirm the claim names and value formats exactly, since OpenBao matches them as written. The step is done when you have a written list of claim names and sample values from a token the issuer actually produced, and you know which token fields you can rely on.
Enable the JWT/OIDC auth method
An administrator enables the JWT/OIDC auth method at a dedicated mount path so its roles are kept apart from other login methods. Use a path that reflects the issuer or workload type, since the path becomes part of every login URL. Confirm the method appears in the list of enabled auth methods and that the policy granting the administrator access to manage auth methods is scoped correctly. The check is a successful listing of the mount with no unexpected default settings left in place.
Configure the issuer and signing keys
Set the issuer URL and the way OpenBao validates token signatures, either by fetching keys from the issuer's discovery endpoint or by supplying the public keys directly. Confirm the issuer string matches the iss claim you captured in step one exactly, including trailing slashes, because a mismatch rejects every token. If your environment has no outbound path to the issuer, confirm with your network team how keys will be supplied. The check is a configuration read that shows the expected issuer and key source, plus a test login attempt that gets past signature validation.
Write the role with bound audience and bound claims
Create a role with a role type of JWT (or OIDC for browser-based flows) and set the bound audiences to the single audience value you captured. Add a bound_claims map for the exact values the workload must present, and set the claim the subject is read from. Keep the role narrow, with one role per workload class, and attach the least-privileged policy that the workload needs. The check is a read of the role showing the bound audience, bound claims and policies as intended, reviewed by a second person before any login is tested.
Add glob matching or a CEL program where needed
Where a claim must match a pattern rather than an exact value, such as a branch prefix, use glob matching in bound_claims. Where the rule combines several claims or needs logic that a claim map cannot express, write a CEL program that returns true only for acceptable tokens. Keep each expression short and document what it allows, because a broad pattern is the most common way a role ends up accepting tokens it should not. Confirm the expression compiles and that the role reads back with the intended rule. The check is a clean role update response and a written note explaining each pattern.
Test accepted and rejected tokens
Log in with a token that should succeed and confirm it returns a token with only the expected policies. Then present tokens that should fail: a wrong audience, a missing or altered claim, a token from another repository or group, and an expired token. Each rejected attempt should return a permission denied response, not a token with reduced rights. Confirm the denied attempts appear in the audit log with the auth path and error, which proves the control is observable. The check is a short test record listing each case, its expected outcome and its actual result.
Confirm denied logins are logged and alerted
Review the audit device output for the rejected test logins and confirm each one records the request, the auth mount and the failure without storing the token itself. Check that your log pipeline forwards these entries to the team that monitors authentication, and that an alert or review path exists for repeated denials. Confirm with your security team which events they need for investigations and whether the audit format meets their retention rules. The check is a found audit entry for each rejected test case in the central log store.
Designing claim rules that match how your identity provider issues tokens
A bound claim is only as strict as the value your identity provider actually puts in the token. Before you write a JWT role, confirm the exact claim names, value formats and subject structure your identity provider issues for the application that will log in. Claim names differ between providers: one may place group membership in a groups array, another in a namespaced custom claim, and a third may omit groups from the access token entirely and require a separate lookup. Subject (sub) formats also vary, with some providers issuing opaque identifiers, others issuing email addresses, and some changing the format when a tenant is migrated. Ask your identity provider administrators to confirm each claim name, its data type and whether it appears in the ID token, the access token or both.
Verify these assumptions against real tokens from the same client, issuer and flow that your workload will use, not against documentation or a sample from a different tenant. Decode a token from each relevant environment, check the aud, iss and the claims you plan to bind, and test the role with a token that should fail as well as one that should pass. Include an illustrative case where a bound claim such as a group name matches a value that exists in several applications or tenants. A rule that binds only on a generic group label can accept tokens issued for another application that shares that label, which is why bound audiences and issuer checks belong in the same review as the claim map.
Treat a broad rule as an access grant. If the bound value is a wildcard, a shared group name or a claim that another tenant can set, the role may accept tokens that were never meant for your cluster. Review each role with the question: which other applications, tenants or users could produce a token that passes this rule? Record the answer and the identity provider configuration it depends on, so that a later change to group naming or tenant setup is caught before it widens access.
Security risks in JWT role design
A JWT role is only as strict as its weakest condition. The risks below come from audiences that are not checked, claims users can influence, and rules that grow until nobody reviews them. Each card pairs a risk with the mitigation and the check to run whenever a role changes.
Accepting any audience
If a role does not bind the audience, a token issued for another application at the same identity provider can be presented to OpenBao. Bind bound_audiences to the value your OpenBao address is registered with, and confirm that every identity provider client you trust sets its own audience. Check that a token minted for a different client is rejected in a test login before the role goes live.
Matching claims users can edit
Some claims, such as display names, email addresses or free-text profile fields, can be changed by the user or by a self-service flow at the identity provider. A role that binds only to those values lets a user gain another user's policies after a small profile change. Bind to stable, administrator-controlled claims such as subject identifiers, group membership or tenant IDs, and document which claim each role trusts and who can change it.
Overly broad glob patterns
A wildcard such as repo:example-org/* in a bound claim matches every current and future repository under that prefix. Globs are convenient, but each added * widens the set of accepted tokens without any review step. Prefer exact values where possible, keep globs anchored to the narrowest prefix, and test a few non-matching values to confirm that the pattern rejects them.
Roles sharing broad policies
When several roles point at the same broad policy, a weakness in one role grants everything the policy allows. Each role should map to a policy scoped to the paths that workload needs, with no shared catch-all policy attached to multiple roles. Review the policy attached to each role during every change, and confirm that no role inherits access it does not need.
CEL programs nobody can review
CEL bound rules can express conditions that claims alone cannot, but long expressions with nested logic are hard to read and easy to get wrong. A subtle error can accept more tokens than intended or reject all of them. Keep each program short, name the intent in a comment or change description, and keep a set of positive and negative test tokens that the program must accept or reject before each change is merged.
Unreviewed role changes
Role definitions are configuration, and configuration drifts when changes are made directly through the API or the CLI without a record. Store role definitions in version control, require a second reviewer for changes to audiences, claim bindings, token policies and CEL programs, and run the positive and negative login tests after each deployment. Log who changed each role and keep the record with your audit trail.
Questions buyers ask about JWT role restrictions
How much effort does a JWT role design take, and what drives it?
The effort depends mostly on how many distinct workloads or user groups need their own role and how many claims must be checked. A single role that accepts one audience and one repository claim is a small task. A design covering many pipelines, environments and identity provider groups takes longer because each role needs its bound audience, its bound_claims map, its token policies and a test case. Ask for the number of roles, the claim sources and whether CEL rules are needed, since CEL programs add review and testing work. No duration is given here because it depends on the identity provider and the environment.
Can our own team restrict OpenBao JWT logins without a partner?
Yes, a team that already runs OpenBao and understands its JWT/OIDC auth method can write bound audiences and bound_claims roles in-house. The harder part is usually not OpenBao syntax but agreeing with the identity provider team which claims are stable, trustworthy and documented. Teams that lack an engineer who can read token payloads from their identity provider, or that need CEL programs for rules claims cannot express, often bring in outside help for the design review. A fixed-scope engagement from DeployOpen covers this design, implementation and testing in your infrastructure, with the scope agreed in writing first.
What does the identity provider team need to provide?
The identity provider team needs to confirm which claims their tokens carry, what values those claims hold for each application or group, and how often those values change. They also need to confirm the audience value their tokens use, the issuer URL and whether custom claims are added at token issuance. Without this, bound claims are built on guesses. Ask them to provide sample tokens from a non-production client, a list of groups or service accounts that should be allowed, and a named owner who will approve changes to claim mappings later.
How should we test JWT roles before go-live?
Test both the accepted and the rejected cases. Use a token that should match each role and confirm the login succeeds and returns the expected policies. Then use tokens with the wrong audience, a missing claim, a claim with a near-match value and a token from a different client, and confirm each is refused. Repeat the check for glob patterns and CEL programs, since a loose wildcard is a common source of unintended access. Keep these cases in version control so they run again after each role change or OpenBao upgrade.
What should we confirm about the OpenBao version before writing roles?
Confirm the exact version running in each cluster, because JWT behavior and the availability of CEL support can differ between releases. The OpenBao releases page lists the current minor lines, including v2.7.0 released September 23, 2026 and v2.7.1 released October 1, 2026. Check the release notes for your version and the auth method documentation before relying on a specific option. If you plan an upgrade, retest every role on the new version, since a rule that worked on one release should not be assumed to behave identically on the next.
What is the risk if a bound claim is too broad?
A broad claim can let tokens from unintended pipelines, branches or users receive a policy meant for a narrower workload. The effect is that a secret or dynamic credential is issued to a caller that should not have it. Keep each role tied to a specific audience and the most specific claims your identity provider can give, review glob patterns for accidental matches, and limit the token policies each role grants. Audit logs should show which role issued each token so you can trace misuse back to the rule that allowed it.
Does a JWT role design support compliance evidence?
A documented role design can supply evidence for access control reviews: each role's accepted audience, claim conditions, granted policies and the tests that prove refusals. It does not by itself satisfy any compliance framework, and DeployOpen prepares systems, controls and evidence for assessments without issuing audit reports or certifications. Ask your assessor which evidence they expect, such as change records for role updates, test results and audit log samples, and confirm those can be produced from your OpenBao deployment.
Limits to confirm in your environment
The JWT role design depends on a few facts that vary by OpenBao version, identity provider and audit setup. Confirm each one in a test cluster before any production role accepts tokens, because a claim rule that looks correct on paper can behave differently at the edges.
OpenBao version and plugin behavior
Record the exact OpenBao build you run and read the JWT auth method documentation for that version, not an older Vault page. The current releases are v2.7.0, released September 23, 2026, and v2.7.1, released October 1, 2026, and the previous minor line has its own v2.6.4 release. Confirm that bound_audiences, bound_claims, glob matching and the CEL options behave as the docs describe on your build, and check whether any auth plugin you depend on ships separately in openbao-plugins.
Auth methods docsCEL feature availability
Confirm that the CEL program option is available in your build and that your team has tested the expressions you plan to ship. Test every bound rule against a real token from your provider before trusting it, since a malformed or unsupported expression is the most likely cause of a role that either rejects everything or accepts too much. Keep the CEL programs short and reviewed, and record which version of OpenBao they were tested against.
Identity provider claim behavior
Check how your identity provider encodes the claims you bind, including whether groups arrive as a list or a string, whether optional claims are omitted for some users, and whether the aud claim is an array when several audiences are set. Some providers only add group claims when the application is configured to request them. Decode tokens from each application and each user type, and compare the claim values with the role definition.
Key rotation and token validation
Confirm how your provider rotates its signing keys and whether OpenBao fetches the new keys from the discovery endpoint on its own. A rotation that OpenBao does not pick up will cause logins to fail, and a loose configuration could hide that failure. Rehearse a signing key rotation in a test environment and check that logins resume without changing roles. Also confirm the token lifetime and clock skew allowances your provider uses.
Audit log content for reviews
Decide which fields reviewers need from the audit device before the first login is tested. Confirm that the audit log records the auth request, the role used, the identity alias and the resulting token policies, and that sensitive values are hashed as configured. Reviewers asking why a login was allowed need the claim-to-role path, so verify the log shows it on your version. Store the audit output where the security team can query it.
HA docsWhat a fixed-scope JWT role review covers
A fixed-scope JWT role review starts with an inventory, not with configuration. Before any role is written, DeployOpen would list every workload and pipeline that should log in to OpenBao through JWT or OIDC, every identity provider that issues their tokens, and the claims each provider actually puts in those tokens. That inventory is where most bound-claim mistakes are found, because the claim names, formats and values in a live token often differ from what the platform team assumed. The written scope would name which issuers and which OpenBao mounts are in view, and which existing roles are being reviewed, replaced or left alone.
From that inventory, role design covers the audience, the bound_claims map, glob matching where the values are patterns, and any CEL program needed for rules that a claim comparison cannot express. Test tokens are then built for each role, including tokens that should be rejected, so the accept and deny behavior is shown rather than assumed. The deliverables, the number of roles in scope and the testing approach are all agreed in writing before work starts. Scope, deliverables and timelines are set in that document. DeployOpen does not publish a price list, so a quote follows from the written scope.
Handover documentation records each role's intent, its bound settings, the test cases that prove it, and the steps to re-run those tests after an identity provider or pipeline change. Ask for that document to name the owner of each role and the process for approving changes. Confirm with your identity team which claim format changes are expected in the next quarter, because those will decide how much of the handover needs to cover future updates.
How DeployOpen scopes and delivers OpenBao JWT role work
DeployOpen plans, implements, tests and documents OpenBao JWT and OIDC roles inside your own infrastructure, so each role accepts only the tokens your identity provider issues for the workloads you intend. Engagements are fixed-scope, with the claim rules, CEL programs and test cases agreed in writing before any role is changed.
How we scope
- Inventory which identity provider issuers, audiences and workloads will log in through each JWT auth mount and role.
- Agree in writing which claims to bind, which glob patterns to allow and which rules need CEL programs.
- Define the policies each role may receive and the token TTLs, use limits and bound CIDRs that apply.
How we build
- Configure JWT roles with bound audiences and bound_claims maps, then add CEL programs only where claims alone are insufficient.
- Test each role with valid, expired, wrong-audience and wrong-claim tokens to confirm that only intended logins succeed.
- Record the role definitions, claim mappings and test results in configuration files kept under your version control.
How we hand over
- Deliver a written role matrix listing each role, its bound claims, its CEL rules and the policies it grants.
- Walk your identity and platform engineers through the role changes and the test suite, so they can rerun checks after changes.
- Document the steps to add a workload, change an identity provider claim and roll back a role if a login breaks.
How we support
- Review role changes and identity provider claim changes against the agreed matrix before they reach production.
- Ongoing support, upgrades and continuous testing are available as a retainer, including retesting after OpenBao upgrades.
- Confirm with your identity provider vendor how token claims are issued, since claim names and formats depend on that product.

