Delivering secret zero with OpenBao response wrapping

Use single-use wrapping tokens to hand AppRole secret IDs and initial credentials to applications and pipelines without writing them to logs, and detect when a wrapped secret has been intercepted.

On this page

Delivering secret zero with OpenBao response wrapping: when teams need it

An application or pipeline needs its first credential before it can do anything else, and someone has to deliver that credential without leaking it. Response wrapping lets OpenBao hand over a secret as a single-use wrapping token that can be unwrapped once, so the secret itself never travels through chat, tickets, CI logs or configuration files in plain form. The pattern is most useful for the initial credential that bootstraps everything else, often called secret zero. In a common AppRole flow, the role_id is relatively stable and can be placed in configuration, while the secret_id is the sensitive half that must reach the workload once. Wrapping that secret_id is the usual way to deliver it, because the consumer calls the unwrap operation and the wrapping token stops working after that call.

The OpenBao docs describe the auth methods it supports, and they recommend AppRole for servers, so this is the case where wrapping matters most. Before you design the handoff, confirm in the OpenBao documentation for your version how wrapping TTLs, the wrapping endpoints and the unwrap call behave, and test them in a non-production cluster. The first handoff is the hardest part of the design because the wrapping token is itself a bearer secret. Whoever reaches it first can unwrap it, and a failed unwrap is the signal that something has gone wrong. Your plan needs to answer who creates the wrapped secret, how the consumer receives the token, how the consumer proves it is the intended recipient, and what the operator does when an unwrap fails.

This section covers the wrapping mechanism and the decisions around it. It does not cover the wider hardening program, such as root token handling, rate limits, lockout, metrics exposure or image choices, which are treated in their own sections of this group.

Each wrapped secret ID can be unwrapped only once, and reuse is visible in the audit log

The diagram starts with a trusted operator or pipeline asking OpenBao for a wrapped secret ID. OpenBao returns a wrapping token, not the secret ID itself, and the operator passes that token through a delivery channel to the workload. The workload unwraps it once to receive the secret ID. Check two points: the trust boundary between the delivery channel and the workload, and what happens on a second unwrap attempt, which should be refused and recorded in the audit log.

Hand-offs between OpenBao, the delivery channel and the workload, with the single-use unwrap check.

What response wrapping protects and what it does not

Response wrapping moves a secret out of the direct response and into a short-lived token that the recipient unwraps once. The cards below separate what that design protects from what it leaves to your delivery channel, your identity controls and your logging setup.

The wrapping token is single-use

A wrapping token can be unwrapped once. The wrapped secret is returned to the first caller that presents the token, and later attempts fail. For secret zero, this means the token in the pipeline or config management system is not a reusable credential. Confirm the exact unwrap behavior, token TTL options and error responses for your OpenBao version before writing automation that depends on them.

OpenBao HA docs

The secret is not in plain form in the message

The delivery message carries a wrapping token rather than the AppRole secret ID or initial credential itself. An observer who reads a chat message, ticket or build log sees only the token. Still, the token grants the right to unwrap, so treat it as sensitive until it is used or expires. Test that your pipeline never echoes the token into stdout or artifacts.

Logs record token use, not the secret

Audit devices record requests and responses in hashed form, and the wrap and unwrap operations appear as events. You can see when a token was created and when it was used, but not the secret value. This helps you spot a second unwrap attempt or an unwrap from an unexpected source. Confirm which audit device types you enable and how hashing applies to wrapping responses in your version.

The delivery channel still matters

If an attacker captures the wrapping token before the intended recipient unwraps it, they can take the secret instead. Whoever receives the token first wins the race. Choose a channel that the recipient controls, such as a direct handoff into an encrypted config management store, and review who can read that channel. The design narrows exposure but does not replace channel security.

The identity that requests the wrap is trusted

The wrap operation is only as strong as the identity that performs it. A pipeline token with broad policy rights can wrap any secret it can read, and the wrapped result reflects that authority. Scope the wrap capability with a narrow policy on the requesting identity, and review it when the pipeline changes. Your identity provider and its administrators remain outside what OpenBao itself can defend.

Which secret zero delivery pattern fits which workload

This table compares four ways to hand a first credential to a workload, from response-wrapped AppRole secret IDs to identity-based login that needs no stored secret. Read each row for when the pattern fits, what the delivery channel must protect, and what it costs to run, then match the pattern to the workload's platform and how often it is redeployed.

PatternWhen it fitsWhat the channel must protectCost to operate
Response-wrapped AppRole secret IDVirtual machines or bare-metal servers with no platform identity to attest them, where an orchestrator or配置 tool can request a wrapped token at deploy timeThe wrapping token until unwrapped, since anyone holding it can unwrap it once. Confirm that the deploy tool does not write it to logs or shell historyRecurring work to build wrap and unwrap steps, monitor wrap token use, and rotate role settings. Confirm how your automation stores the wrapping token
Wrapped initial token for a bootstrap stepA one-time bootstrap where a provisioning job needs a short-lived token to configure an application, then exitsThe token must reach only the bootstrap process, with a short TTL and a single use. Confirm that the provisioning job does not persist the unwrapped tokenMostly one-time design and testing, with a small recurring review of bootstrap jobs and their access policies
Pipeline-injected wrapping token from a CI systemBuild and deploy pipelines that already hold a protected credential store and deliver secrets to a target host at deploy timeThe CI system's own secret store and the job log masking. Confirm that wrapping tokens are masked and that forked or untrusted pipeline runs cannot read themRecurring pipeline maintenance, runner hardening and secret store administration, which you may already pay for in your CI platform
Orchestrator-native identity (Kubernetes or JWT auth)Workloads running on a platform that issues verifiable identity tokens, so no stored secret is needed at allThe identity provider and its token signing keys, plus the trust configuration in OpenBao. Confirm the bound claims and audiences before go-liveRecurring work to maintain role bindings and monitor the identity provider, usually the lowest ongoing secret handling effort

Configuring AppRole and response wrapping step by step

This sequence gives a trusted party a single-use wrapped secret ID that a workload can unwrap once and then use to log in. Each step ends with a check you can run, so you can confirm the delivery path works before any production workload depends on it.

  1. Enable the AppRole auth method

    An operator with a narrow administrative policy enables AppRole with the bao auth enable approle command, not the root token. Mount it at a path your team will recognize and record that path in your runbook so pipelines and automation reference the same name. Done means bao auth list shows the AppRole mount and the audit device has logged the enable operation. Confirm the audit device is active before you continue, because later steps depend on those entries.

  2. Define a narrow policy for the workload

    Write a policy that grants only the paths and capabilities the workload needs, such as read on one KV path, and nothing else. Keep the policy file in version control so reviewers can see every grant and changes go through review. Check the result with bao policy read and confirm there are no wildcard paths or write capabilities that the workload does not use. Done means a reviewer has approved the policy text that will be attached to the role.

  3. Create the AppRole with bounded secret ID settings

    Create the role with bao write auth/approle/role/<name>, attaching the narrow policy and setting the secret ID time-to-live and use limits. Choose the values with your security team based on how long the workload needs to start and how many times it should be able to log in with one secret ID. Read the role back with bao read auth/approle/role/<name> and confirm the policy, token settings and secret ID limits match the approved design. Confirm the exact parameter names against the AppRole documentation for your OpenBao version.

  4. Generate a wrapped secret ID

    The trusted party requests a secret ID with a wrap time-to-live set on the request, using a command in the form bao write -wrap-ttl=<duration> -f auth/approle/role/<name>/secret-id. Keep the wrap time-to-live short but long enough for the handoff to finish, and agree on the value with the team that will deliver it. The response contains a wrapping token and accessor rather than the secret ID itself. Done means the output shows wrapping information and the secret ID is not printed in plain text in the terminal or pipeline log.

  5. Deliver the wrapping token to the workload

    The trusted party passes the wrapping token to the workload through a channel your team has approved, such as the orchestrator's secret store or a masked, protected pipeline variable. The wrapping token is not the secret ID, but anyone who holds it before the workload does can try to unwrap it, so limit who can read the store and the pipeline settings. Done means the recipient has the token and a review of the CI or orchestrator logs shows no copy of it in output, comments or job records.

  6. Unwrap the token on the workload

    The workload unwraps the token once with the unwrap command or API call, for example bao unwrap <wrapping-token>, and receives the secret ID in the response. Store the result only in the memory or file location the workload reads at startup, with file permissions limited to its service account. Confirm the command syntax for your version before automating it. Done means the workload holds a secret ID and the wrapping token no longer returns the secret when used again.

  7. Confirm the workload logs in

    The workload logs in with its role ID and the unwrapped secret ID using bao write auth/approle/login role_id=<role-id> secret_id=<secret-id>. The response should return a client token carrying only the policies you attached to the role. Read the role's secret ID accessor or lookup details to confirm the use count has increased as expected. Done means the workload can read its approved path and cannot read anything outside the policy.

  8. Verify single use and audit entries

    Repeat the unwrap with the same wrapping token and confirm it fails, since a wrapping token is designed for one use. Review the audit log for the wrap, unwrap and login entries, and check that the entries show the expected paths and identities without exposing the secret ID in clear text. If a legitimate unwrap fails because the token was already used, treat it as a possible interception: revoke the secret ID, issue a new one and investigate who had access to the handoff. Done means the failure is confirmed, the audit trail matches the sequence and your runbook records the procedure.

How to detect a wrapping token that someone else unwrapped

The detection logic rests on one property of single-use wrapping: a wrapping token can be unwrapped once. If an attacker or a misrouted process unwraps it before the intended workload does, the workload's own unwrap call fails, and that failure is the signal to investigate. Treat every failed unwrap of a wrapping token your pipeline or service expects to use as a possible interception until you have ruled out a retry, a duplicate job or a configuration error. The design goal is that a legitimate party's failure is loud and traceable, not silent.

To make that signal useful, correlate three audit events for each delivery: the wrap request made by the issuing party, the unwrap call, and the login that the receiving workload makes with the resulting secret ID. Audit entries record the accessor and request metadata, so you can match a wrap to its unwrap by identifiers you control, such as a pipeline run ID or a host name placed in the wrap's request context. Confirm in your own environment and version which audit fields are written for wrap and unwrap operations, whether the wrapping token itself is hashed in the log, and how long your audit sink retains them. Check the audit device settings in the OpenBao auth methods documentation before writing alert rules against them, because field names and hashing behavior can differ between releases.

Alert on failed unwraps for wrapping tokens that should have a single consumer, and on any unwrap that arrives from an unexpected source address or identity. Route the alert to the team that owns the workload, not only to a shared log queue. If an interception is suspected, revoke the secret ID that was delivered (and its dependent tokens), issue a new secret ID through a fresh wrap, and rotate any value that the affected workload may have read. Rehearse this path before you need it, and confirm with your team how revocation is authorized and how the new wrap is delivered without repeating the exposure.

Security and operational considerations for wrapped secrets

Response wrapping moves the secret out of the delivery path, but the wrapping token itself becomes the sensitive object. The cards below cover the controls that keep that token short-lived, limited to the right identities, and out of logs, and the process steps that decide what happens when interception is suspected.

Keep wrap TTLs short

A wrapping token is valid for a time window set by the wrap_ttl on the request or the response-wrapping settings of the path. Set it to the smallest window the receiving application or pipeline needs to start up and unwrap. A long TTL gives an interceptor more time to use a token before the legitimate consumer does. Check the TTL on every wrap call in your pipeline definitions, not only the ones you wrote yourself.

Auth methods docs

Restrict who may request wraps

Only the identities that generate secret IDs should hold the policy capability to wrap them. Write a narrow policy on the AppRole secret ID path and the sys/wrapping/wrap path, and bind it to the CI runner or provisioning role rather than to general automation tokens. Review the effective permissions after each policy change, because a broad wildcard grant can let a developer token produce wrapped secrets for any role.

Keep audit logs free of unwrapped secrets

Audit devices record request and response data, so a wrapped secret that appears in a request or response body can end up in a log stream your teams can read. Confirm which fields your audit device hashes and which it leaves in plain text, and test that a wrap and unwrap leave only the wrapping token accessor in the log. Route audit output to storage with restricted read access, and check it before you enable any debug logging on a pipeline runner.

Plan revocation after failed unwraps

When an unwrap fails because the token was already used, expired or invalid, treat the event as a possible interception and not as a routine error. Define a runbook that revokes the secret ID tied to the wrap, reissues it through a controlled path and alerts the owning team. Alert on unwrap failures in audit logs and decide in advance who can authorize the reissue, since the application cannot tell an attacker from a restarted pod on its own.

Protect the delivery channel and pipeline variables

The wrapping token is delivered through a CI variable, a file on a host or a message to an orchestrator, and each of these may be read by more people than the application. Limit who can read pipeline variables, mask them in job logs and avoid echoing them in build scripts. Deliver to the workload over a channel your platform already controls, and confirm that the job runner does not store the token in cached artifacts or shared workspaces.

Handle root and unseal key holders separately

Wrapping does not change who can recover the cluster. Root token generation, unseal keys and recovery keys belong to a separate set of people, with their own approval steps and storage. Do not issue a wrapped secret to a person who also holds those keys, and do not use the root token to create wraps. Document the boundary in your access model so that the team delivering secret zero cannot also reach the controls that protect the whole cluster.

Questions teams ask before delivering secret zero with OpenBao

How much effort does a secret zero design and rollout take?

The effort depends mostly on how many application types and pipelines need a secret ID, and how many of them already have a delivery path. A small set of services on one orchestrator is a short design exercise. A mixed estate with virtual machines, containers, CI runners and batch jobs needs a separate delivery pattern for each, plus testing of failure paths such as expired wrapping tokens and retries. Ask any partner for the effort broken into discovery, pattern design, pipeline changes, failure testing and handover, and for the assumptions behind each line. No duration is given here because it depends on the environment.

What does the work need from our team?

Expect to supply people who own each application and pipeline, someone who can approve changes to CI/CD configuration, and a platform owner who runs the OpenBao cluster. Security or compliance staff should review the AppRole and policy design and the detection approach before go-live. Without these people available on a schedule, delivery work stalls, so agree on named owners and review slots in the written scope.

Can our own engineers build secret zero delivery without a partner?

Yes, if your team already runs OpenBao and understands AppRole, policies and the wrapping workflow. The main risk is not the first working example but the edge cases: wrapping tokens expiring before a pipeline picks them up, wrapped values appearing in job logs, and no alert when a wrapping token is unwrapped twice. Teams that build in-house often skip the failure tests and the interception checks. A partner is useful when you need those tested and documented on a deadline, or when several teams must follow one pattern.

Which pipelines and orchestrators make secret zero delivery harder?

Delivery is harder where the pipeline platform stores or echoes values by default, or where the job runner cannot make a direct, authenticated call to OpenBao. Common friction points include:

  • Build systems that print environment variables or command arguments into logs or artifacts
  • Ephemeral runners that cannot reach the OpenBao listener or cannot hold an unwrap step securely
  • Workflows that cache or pass job outputs between stages without masking
  • Legacy schedulers where the only input channel is a shared file

Review each orchestrator you run for these traits before choosing a delivery pattern.

What drives the cost of a secret zero engagement?

Cost follows the written scope. The main drivers are the number of distinct delivery patterns, the number of pipelines and runners to change, how much of the OpenBao setup already exists, and how much detection and alerting you want on unwrap attempts. One-time costs cover design, pipeline changes, testing and documentation. Recurring costs appear when you add new applications, rotate secret ID delivery methods or need ongoing support. Ask a quote to separate these lines and to state which systems are in scope and which are out of scope. DeployOpen does not publish a price list, so a quote is produced from the written scope.

How does a partner scope secret zero delivery work?

A partner usually starts with an inventory of applications, pipelines and runners that need initial credentials, then groups them by how they start and where they run. Scope is then written as a set of patterns, the systems each pattern covers, the tests that prove it works, and the handover material your team receives. Confirm in the written scope whether the work includes interception detection, audit log review, and retesting after a change. Engagements are typically fixed-scope and agreed in writing before work starts.

What should we confirm about our OpenBao version before starting?

Confirm the OpenBao version you run and whether the wrapping and AppRole behavior you plan to use matches that version's documentation. The project publishes releases on its GitHub releases page, including the 2.7 line, so check the release notes for your version before designing the pattern. Also confirm your storage backend and HA setup, because the delivery pattern depends on whether requests reach an active node reliably. Ask your vendor or partner to state the version they tested against.

How DeployOpen scopes secret zero delivery for your OpenBao

DeployOpen scopes secret zero delivery as a fixed-scope engagement, with the deliverables, the systems in scope and the timeline agreed in writing before any work starts. For response wrapping, the written scope should name each delivery path to be covered: which AppRole roles receive wrapped secret IDs, which pipelines or configuration management tools unwrap them, which wrapping TTLs apply, and which interception signals the security team will watch. A quote follows from that scope, so the more precisely the delivery paths are listed, the more closely the quote reflects the actual work.

The implementation runs inside your infrastructure, on your OpenBao cluster and within your network, cloud accounts or data center. DeployOpen configures the wrapping policies, the response-wrapping calls on the approved paths, the unwrap logic in your applications or pipelines and the audit device review that detects a second unwrap attempt. Before the engagement closes, the agreed deliverables should include the policy files, a runbook for the platform team, and test results showing that a wrapped token can be unwrapped once and that the failed unwrap is logged. Confirm with your own security team which audit log destination and retention they require, since those settings are yours to own after handover.

DeployOpen also prepares the audit evidence your compliance and security reviewers will ask for, such as the documented design, configuration exports, test records and the detection procedure. DeployOpen prepares these artifacts but does not issue audit reports, attestations or certifications; your independent auditor or certification body makes those determinations. Ongoing support, upgrades and continuous testing are available as retainers, which suit teams that add new AppRole roles or rotate delivery paths often. Ask any provider for the written scope, the named deliverables and the acceptance criteria before you compare quotes.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.