Bootstrap Delivery Needs a Receipt, Not Another Shared Secret

·

11 min read

A bootstrap system often needs to deliver a credential before the receiving workload has an established identity. The easy implementation gives the deployment service a reusable secret and asks it to forward that secret through several layers of automation. The resulting design expands the number of places capable of reading or retaining the credential.

Vault response wrapping offers a more precise primitive: pass a short-lived reference to a response, then let the intended consumer redeem it. The difficult part is not generating that reference. It is defining what the consumer validates, what the coordinator records and what happens when delivery becomes uncertain.

This study examines that handoff using the response-wrapping contract captured in Vault 1.18.0. The tagged documentation predates the April 2026 editorial scope and describes functionality established well before that release. The design is independent of later agent identity products. Archived wrapping concepts, Release record.

A wrapping token remains a credential

When wrapping is requested, Vault stores the original response in the cubbyhole associated with a single-use token and returns wrapping information instead of the secret response. The wrapper has its own lifetime, separate from the lifetime of the secret inside. That reduces the exposure window of the delivery reference, but possession of a usable reference still matters.

A relay that sees the wrapper must therefore treat it as sensitive. Excluding the underlying secret from a deployment log is useful, but logging the redeemable token would still allow another party to race the intended consumer. The architectural benefit is limited disclosure and redemption visibility, not permission to treat the wrapper as public metadata.

A model-assisted deployment coordinator should normally receive a delivery identifier and state, rather than the wrapper itself. A narrow delivery service can manage the reference and expose facts such as issued, delivered, redeemed or uncertain. That service boundary is a proposed design; wrapping does not automatically prevent an application from returning credentials to an AI tool caller.

The same principle applies to clipboard operations, pipeline outputs and environment variables. Removing the plaintext payload from one hop does not establish that the remaining bearer reference is handled correctly across every hop.

Validate the origin before redemption

The wrapper's lookup operation returns creation metadata, including creation path and creation time. A consumer can inspect those properties before attempting unwrap. An exact expected path is valuable when the secret should originate from one specific role or resource, rather than any endpoint under a broad prefix. Archived lookup API.

That distinction closes a substitution gap. A reference created by a generic wrapping operation may contain data that another party already observed. A token being valid does not establish that its contents came directly from the intended issuing endpoint.

The expected path should come from trusted workload configuration or an approved deployment record. Taking the expected path from the same untrusted delivery message that contains the token would make the check circular. The sender could replace both the token and the criterion used to accept it.

Lookup also does not reserve the token. Another party may redeem it between lookup and unwrap. The consumer must treat successful metadata inspection and successful redemption as separate observations, and handle a failure at either stage without relaxing the origin check.

Single use changes retry semantics

The unwrap API returns the original wire-format response and consumes the wrapping token. It permits either the wrapper as the client token or a separately authorized caller passing the wrapper in the request body. The documented warning against supplying the wrapper in both positions is significant: that can cause a double-use failure rather than a useful retry. Archived unwrap API.

The more subtle uncertainty occurs when the request succeeds but the response is lost. The consumer may know that it sent an unwrap request, while lacking the secret response. A second unwrap cannot be treated as a normal idempotent fetch.

The coordinator needs an explicit uncertain state. It should correlate the request with audit evidence and the consumer's startup result before deciding whether to issue a replacement. Blindly repeating the entire bootstrap sequence can create additional credentials while leaving the first issuance unexplained.

This is not evidence that a failed unwrap always indicates interception. Expiry, prior successful redemption, cancellation and delivery errors can also explain it. The security response should preserve ambiguity until the relevant evidence is collected, rather than making an unsupported accusation or assuming a harmless retry.

Wrapped bootstrap handoff showing metadata inspection, origin rejection and single-use redemption

Proposed workflow: a delivery service transports the wrapper; the consumer inspects origin metadata, rejects an unexpected origin, or proceeds to single-use redemption and bootstrap.

Model the decision boundary

The following original program models the consumer-side decision. It contains no secret values and makes no Vault request. The metadata and transport outcomes are synthetic, and authentication of that metadata remains an integration responsibility.

from dataclasses import dataclass

@dataclass(frozen=True)
class Wrapper:
    path: str
    created_at: int
    ttl: int

def next_step(wrapper, expected_path, now, max_age, outcome):
    if wrapper is None:
        return "INVESTIGATE"
    if wrapper.path != expected_path:
        return "REJECT_ORIGIN"
    if wrapper.ttl <= 0 or max_age < 0:
        return "REJECT_METADATA"
    age = now - wrapper.created_at
    if age < 0 or age >= min(wrapper.ttl, max_age):
        return "EXPIRED_OR_STALE"
    if outcome == "not_attempted":
        return "UNWRAP_ONCE"
    if outcome == "success":
        return "VERIFY_STARTUP"
    if outcome in {"timeout", "connection_lost"}:
        return "RECONCILE"
    return "INVESTIGATE"

w = Wrapper("auth/approle/role/worker/secret-id", 100, 120)
assert next_step(w, w.path, 110, 60, "not_attempted") == "UNWRAP_ONCE"
assert next_step(w, w.path, 110, 60, "timeout") == "RECONCILE"
assert next_step(w, "sys/wrapping/wrap", 110, 60, "not_attempted") == "REJECT_ORIGIN"
print("Bootstrap decision examples passed")

The age limit is a local acceptance rule, independent of Vault's own token validation. It can make an otherwise redeemable wrapper unacceptable to a particular deployment after a long scheduling delay. An implementation must account for trusted clock sources and acceptable clock skew; the example intentionally uses a simple integer clock.

The function returns an action rather than a secret. That makes the boundary testable without inventing a cryptographic implementation. It also makes clear that a successful unwrap is followed by startup verification, not immediate declaration that the workload is operational.

A real adapter must fetch lookup metadata from the intended Vault server over an authenticated transport. A correct path string received from an impersonated server is not reliable origin evidence. Server identity and wrapper origin are different checks, and both belong in the handoff contract.

AppRole makes the authority split concrete

AppRole separates a RoleID from a SecretID when that role requires both. A bootstrap coordinator can request a response-wrapped SecretID while the application receives its RoleID through a separate configuration channel. This is an established pattern, not proof that either identifier is harmless under every role configuration. Archived AppRole concepts.

The role's settings determine the resulting security properties. SecretID usage limits, its lifetime and the Vault token limits are distinct. A single-use wrapping token does not automatically make the SecretID inside single-use, and a short wrapper TTL does not shorten every token later issued through that SecretID.

The AppRole API exposes those role and SecretID controls separately. A concrete implementation needs to select them from the worker's boot and renewal requirements, rather than copying a short TTL into one field and assuming the entire credential chain now shares that bound. Archived AppRole API.

A useful acceptance test follows the complete chain: wrapper creation, origin lookup, redemption, AppRole login and a narrowly permitted operation. It also verifies that the resulting identity cannot read unrelated secrets or issue new bootstrap material. Testing only unwrap would leave the actual workload authority unexamined.

Separate delivery proof from workload readiness

The deployment service can record that it transmitted a wrapper. The consumer can record that it redeemed it. The application can report that it authenticated and passed its health check. Those events describe different stages.

A green delivery status must not conceal an application that received the response but could not use it. Conversely, a missing acknowledgement does not prove that no credential exists. A process can crash after redemption but before reporting success.

The durable record should therefore include a deployment revision, intended consumer identity, expected creation path, wrapper issuance reference and correlated observations. The record should avoid storing the token or wrapped payload when those values are unnecessary for recovery.

Consumer acknowledgement also needs authentication. If any pipeline job can claim redemption on behalf of any worker, the receipt system merely creates another place to assert success. The acknowledgement should be bound to the intended deployment and producer identity.

A timestamp alone is insufficient when a workload is redeployed. Evidence from the previous instance must not satisfy the current handoff. A stable deployment identifier plus a specific attempt identifier makes retries and replacement attempts distinguishable.

Rewrapping is not universal recovery

The rewrap API moves the same response into a new wrapper, invalidates the old token and uses the original creation TTL for the new wrapper. That can support deliberate wrapper rotation without exposing the contained response. It should not be confused with generating a new application credential. Archived rewrap API.

A controller should not invoke rewrap merely because a receiver is slow. It needs to know whether the original wrapper remains usable and whether extending the delivery opportunity is acceptable. Rewrapping an unredeemed response and replacing a possibly consumed credential are different operations.

The receiving workflow must also learn the new reference through its authorized delivery path. A rewrap event that invalidates the old token without a reliable handoff can create an avoidable startup failure.

This is a practical reason to keep wrapper lifetime aligned with realistic provisioning latency. Extremely short delivery windows can increase operational failures without eliminating the need for secure transport, identity checks and recovery ownership.

An interface that can explain an incomplete boot

The local model can exercise wrong origin, missing metadata, expired and future-dated observations, first redemption, successful redemption and uncertain transport outcomes. These checks establish the behavior of the proposed decision logic; they do not validate Vault's implementation or prove that a real bootstrap channel resists interception.

A production trial should deliberately lose the unwrap response, delay the consumer beyond its acceptance window, submit a token created through an unexpected endpoint and restart the coordinator during acknowledgement. Each scenario should leave a distinct durable state and a bounded recovery action.

Operational metrics should preserve the same distinctions. Time to wrapper delivery is different from time to authenticated startup. Counts of expired wrappers are different from confirmed unexpected redemptions. Aggregating all failures into “bootstrap secret unavailable” would erase the evidence needed to improve the design.

The delivery channel also needs a bounded retention policy. A pipeline artifact containing a wrapper may remain after the wrapper expires, but its existence can still reveal deployment timing and expected secret paths. A successful bootstrap should remove unnecessary copies and retain only the non-secret audit references needed for investigation.

Replacement issuance should have a clear owner. If both the deployment platform and the workload supervisor react independently to a startup timeout, each may request another SecretID. The resulting ambiguity is not solved by making every wrapper single-use. A shared attempt record or another single-owner mechanism is needed to decide which bootstrap attempt is authoritative.

The same record can prevent a delayed acknowledgement from closing a newer attempt. A consumer that finally reports success for attempt one must not satisfy the readiness condition for attempt two. The coordinator can retain the late event as evidence while refusing to advance the current deployment. This is a correlation rule, not a new cryptographic guarantee.

These details make the handoff more useful to application teams: recovery instructions can name the failed stage and authorized next operation, instead of asking for a fresh secret without explaining the status of the previous one.

Response wrapping is strongest when the surrounding platform respects its single-use semantics. The credential travels through fewer plaintext boundaries, origin checks become explicit and uncertainty is retained rather than hidden by retries. The resulting developer experience is a bootstrap process that can explain where it stopped and which authority still exists, even when the worker never becomes healthy.