Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
23de815
Add outbound client identity (mTLS) design spec
ChristianPavilonis Nov 23, 2026
8f1fe66
Add outbound client identity implementation plan
ChristianPavilonis Nov 23, 2026
75dac36
Add portable outbound client identities to core and the manifest
ChristianPavilonis Nov 23, 2026
e7503aa
Reject client identities on Cloudflare, Spin and Axum
ChristianPavilonis Nov 23, 2026
926a321
Present client certificates on Fastly dynamic backends
ChristianPavilonis Nov 23, 2026
9910070
Add the Fastly client identity Viceroy runner
ChristianPavilonis Nov 24, 2026
83c757e
Document outbound client identities
ChristianPavilonis Nov 24, 2026
a6bffa1
Record implementation findings in the client identity spec and plan
ChristianPavilonis Nov 24, 2026
9cd4e7b
Record the client identity issue closeout in the plan
ChristianPavilonis Nov 24, 2026
96b37bf
Update outbound client identity stack base
ChristianPavilonis Nov 27, 2026
e3ff7c8
Merge PR #464 into PR #524 for the identity integration chain
aram356 Dec 3, 2026
af7354f
Place the Axum client identity test after the capability matrix
aram356 Dec 3, 2026
4f46386
Merge PR #464 into PR #524 for the identity integration chain
aram356 Dec 3, 2026
0d84aa7
Merge local PR #510 fixes into PR #524
aram356 Dec 4, 2026
dc0872d
fix(harness): supervise client-identity fixture builds
aram356 Dec 4, 2026
6a69c36
fix(fastly): scope client identity bindings to inbound requests
aram356 Dec 4, 2026
3d861ec
Merge local PR #464 fixes into PR #524
aram356 Dec 4, 2026
8025ae9
Merge PR #464 into PR #524 for the identity integration chain
aram356 Dec 4, 2026
f0197da
Document key-first client certificate rotation on Fastly
aram356 Dec 4, 2026
7412d74
Render client identity refusals with fixed public text
aram356 Dec 4, 2026
8daa8c4
Give a router-state HttpClient the app's client identity policy
aram356 Dec 4, 2026
f3195f7
Report an identity redirect to http as a redirect failure
aram356 Dec 4, 2026
2277e27
Add a changelog entry for outbound client identities
aram356 Dec 4, 2026
bb1bb7b
Merge PR #464 into PR #524 for the identity integration chain
aram356 Dec 4, 2026
9ccbdc3
Merge PR #464 into PR #524 for the identity integration chain
aram356 Dec 4, 2026
1ceec68
Merge PR #464 into PR #524 for the identity integration chain
aram356 Dec 4, 2026
0856797
Order the binding cache entry fields as the item-ordering lint requires
aram356 Dec 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,33 @@ settings, and request records.
successful responses, including application-returned error statuses. See
[Read the immutable request outcome](docs/guide/native-geo.md#read-the-immutable-request-outcome).

### Outbound client identities (mTLS)

- Declare a TLS client identity with `[capabilities.outbound.client-identities.<name>]`. Names are
1 to 64 characters of `[a-z0-9-]` and cannot start or end with `-`. The optional `config-store`
and `secret-store` fields default to the declared store defaults. The new
`outbound-client-identity` capability is `Native` on Fastly and `Unsupported` on Cloudflare,
Spin and Axum. Select an identity per request with
`OutboundRequest::client_identity(ClientIdentityName)`. Redirect hops keep the identity and are
checked again, and identity responses bypass the provider's response cache. See
[Client Certificates (mTLS)](docs/guide/proxying.md#client-certificates-mtls).
- Refusals return `EdgeError::ClientIdentity`, and `EdgeError::client_identity_error()` gives the
`ClientIdentityError`. `Undeclared`, `RequiresHttps` and `Unsupported` answer 500.
`MaterialMissing`, `MaterialInvalid` and `HostNotAllowed` answer 503, or 502 for a redirect hop,
including a redirect to `http`. Response bodies carry only fixed text for the status.
- `App` gives the manifest's identity policy to the request's `HttpClient` and to one registered
as router state. Build a client the application keeps elsewhere in `configure` with
`HttpClient::with_client_identity_policy(Arc::clone(app.client_identity_policy()))`.
- Only Fastly presents identities; Cloudflare, Spin and Axum reject them as `Unsupported`. On
Fastly, provision `<name>.certificate` and `<name>.hosts` in the identity's Config Store and
`<name>.private-key` in its Secret Store. `edgezero build`, `serve` and `deploy` reject an
identity whose stores cannot be resolved, through the new `Adapter::validate_client_identities`
hook, which the CLI capability gate calls for the selected adapter. Rotate by writing the key
before the certificate. See
[Fastly client certificates](docs/guide/adapters/fastly.md#client-certificates).
- Fastly dynamic backend names now use the `ez_b31v2_` prefix instead of `ez_b31v1_`. Hashes for
backends without an identity are otherwise unchanged.

### Portable conditional KV records

- Declare a record layout for a logical KV ID with `App::require_record_store(id, layout)` in
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions crates/edgezero-adapter-axum/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1022,6 +1022,14 @@ mod tests {
}
}

#[test]
fn client_identities_are_unsupported() {
assert_eq!(
AXUM_ADAPTER.capability(Capability::OutboundClientIdentity),
CapabilitySupport::Unsupported
);
}

#[test]
fn adapter_platform_metadata_matches_runtime_metadata() {
let metadata = AXUM_ADAPTER.platform_metadata();
Expand Down
37 changes: 33 additions & 4 deletions crates/edgezero-adapter-axum/src/outbound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ use edgezero_core::outbound::test_support::{
NativeBodyRecorder, native_body_recorder, observe_sdk_read, own_sdk_operation, own_sdk_source,
};
use edgezero_core::outbound::{
OutboundBatch, OutboundBatchDriverEvent, OutboundDispatchRequest, OutboundExchangeOwner,
OutboundFuture, OutboundHead, OutboundHeaderFidelity, OutboundHeaderInput, OutboundHttpClient,
OutboundPending, OutboundPreparedBatch, OutboundRequest, OutboundRequestParts,
OutboundResponse, OutboundResponseContext, OutboundSendMode, OutboundTask, OutboundTime,
ClientIdentityError, OutboundBatch, OutboundBatchDriverEvent, OutboundDispatchRequest,
OutboundExchangeOwner, OutboundFuture, OutboundHead, OutboundHeaderFidelity,
OutboundHeaderInput, OutboundHttpClient, OutboundPending, OutboundPreparedBatch,
OutboundRequest, OutboundRequestParts, OutboundResponse, OutboundResponseContext,
OutboundSendMode, OutboundTask, OutboundTime,
};
use edgezero_core::time::{Deadline, DispatchBudget, MonotonicClock, MonotonicInstant};
use futures::channel::{mpsc, oneshot};
Expand Down Expand Up @@ -157,6 +158,12 @@ impl AxumOutboundClient {
}

fn validate_options(request: &OutboundRequest) -> Result<(), EdgeError> {
if let Some(name) = request.client_identity_name() {
return Err(EdgeError::client_identity(
name,
ClientIdentityError::Unsupported { adapter: "axum" },
));
}
if request.image_optimizer_options().is_some() {
return Err(EdgeError::internal(anyhow::anyhow!(
"image_optimizer is not supported by axum",
Expand Down Expand Up @@ -1267,6 +1274,28 @@ mod clock_tests {
.expect("zero connect timeout conformance");
}

#[test]
fn client_identity_is_unsupported_without_transport() {
use edgezero_core::outbound::ClientIdentityName;
use futures::FutureExt as _;
let executor_owner = AxumOutboundExecutor::new();
let client = edgezero_core::HttpClient::with_client(
AxumOutboundClient::try_new(executor_owner.handle()).expect("client"),
);
let request = OutboundRequest::get("https://127.0.0.1:9/mtls")
.expect("request")
.client_identity(ClientIdentityName::new("mtls").expect("name"));
let error = client
.send(request)
.now_or_never()
.expect("rejected before any transport")
.expect_err("axum cannot present client identities");
assert_eq!(
error.client_identity_error(),
Some(&ClientIdentityError::Unsupported { adapter: "axum" })
);
}

#[test]
fn unsupported_optimizer_precedes_expiry_without_transport() {
use edgezero_core::outbound::test_support::check_unsupported_image_optimizer_preflight;
Expand Down
4 changes: 4 additions & 0 deletions crates/edgezero-adapter-cloudflare/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1620,6 +1620,10 @@ mod tests {
CapabilitySupport::Native,
),
(Capability::OutboundCacheBypass, CapabilitySupport::Native),
(
Capability::OutboundClientIdentity,
CapabilitySupport::Unsupported,
),
(
Capability::OutboundImageOptimizer,
CapabilitySupport::Unsupported,
Expand Down
13 changes: 13 additions & 0 deletions crates/edgezero-adapter-cloudflare/src/outbound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ use edgezero_core::error::{BadGatewayReason, BudgetSource};
all(feature = "cloudflare", target_arch = "wasm32"),
feature = "test-utils"
))]
use edgezero_core::outbound::ClientIdentityError;
#[cfg(any(
all(feature = "cloudflare", target_arch = "wasm32"),
feature = "test-utils"
))]
use edgezero_core::outbound::{OutboundCachePolicy, OutboundRequest};
#[cfg(feature = "test-utils")]
use edgezero_core::outbound::{OutboundSendMode, validate_for_dispatch};
Expand Down Expand Up @@ -3890,6 +3895,14 @@ fn timeout_error(cause: BudgetSource) -> EdgeError {
feature = "test-utils"
))]
fn validate_supported_options(request: &OutboundRequest) -> Result<(), EdgeError> {
if let Some(name) = request.client_identity_name() {
return Err(EdgeError::client_identity(
name,
ClientIdentityError::Unsupported {
adapter: "cloudflare",
},
));
}
if request.image_optimizer_options().is_some() {
return Err(EdgeError::internal(anyhow::anyhow!(
"image_optimizer is not supported by cloudflare",
Expand Down
16 changes: 16 additions & 0 deletions crates/edgezero-adapter-cloudflare/tests/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2076,6 +2076,22 @@ mod native_tests {
use futures_util::stream;
use std::time::Duration;

#[test]
fn client_identity_is_unsupported_before_other_preflight() {
let request = OutboundRequest::get("https://example.com/mtls")
.unwrap()
.client_identity(edgezero_core::ClientIdentityName::new("mtls").unwrap())
.body(Body::from_stream(stream::pending()))
.timeout(Duration::ZERO);
let error = validate_batch_request_for_test(&request).expect_err("unsupported");
assert_eq!(
error.client_identity_error(),
Some(&edgezero_core::ClientIdentityError::Unsupported {
adapter: "cloudflare"
})
);
}

#[test]
fn image_optimizer_rejection_precedes_other_preflight() {
let request = OutboundRequest::get("https://example.com/image")
Expand Down
85 changes: 85 additions & 0 deletions crates/edgezero-adapter-fastly/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ use edgezero_adapter::scaffold::{
ManifestSpec, ReadmeInfo, TemplateRegistration, register_adapter_blueprint,
};
use edgezero_core::env_config::{EnvConfig, merge_env_defaults};
use edgezero_core::manifest::Manifest;
use edgezero_core::{Capability, CapabilitySupport, PlatformMetadata};
use walkdir::WalkDir;

Expand Down Expand Up @@ -2041,6 +2042,7 @@ impl Adapter for FastlyCliAdapter {
Capability::IngressAdmission
| Capability::OutboundAuthorityOverride
| Capability::OutboundCacheBypass
| Capability::OutboundClientIdentity
| Capability::OutboundConnectTimeout
| Capability::OutboundFailureDiagnostics
| Capability::OutboundFlexiblePhaseBudget
Expand Down Expand Up @@ -2227,6 +2229,10 @@ impl Adapter for FastlyCliAdapter {
validate_fastly_config_key(logical_store_id, key, staging, local)
}

fn validate_client_identities(&self, manifest: &Manifest) -> Result<(), String> {
validate_fastly_client_identities(manifest)
}

fn preflight_deploy(
&self,
context: &AdapterDeployContext,
Expand Down Expand Up @@ -5925,6 +5931,36 @@ fn effective_deploy_environment(context: &AdapterDeployContext) -> Result<EnvCon
Ok(environment)
}

/// Fastly reads each client identity's certificate and hosts from a config store
/// and its key from a secret store, so both must resolve from the manifest.
fn validate_fastly_client_identities(manifest: &Manifest) -> Result<(), String> {
let unresolved: Vec<String> = manifest
.capabilities
.outbound
.client_identities
.iter()
.filter_map(|(name, identity)| {
let mut missing = Vec::new();
if identity.resolved_config_store(&manifest.stores).is_none() {
missing.push("config store");
}
if identity.resolved_secret_store(&manifest.stores).is_none() {
missing.push("secret store");
}
(!missing.is_empty()).then(|| format!("`{name}` (no {})", missing.join(" or ")))
})
.collect();
if unresolved.is_empty() {
return Ok(());
}
Err(format!(
"adapter 'fastly' reads client identity bindings from a config store and a secret store, \
and these identities cannot resolve one: {}. Declare [stores.config] and [stores.secrets], \
or name the stores with `config-store` and `secret-store`.",
unresolved.join(", ")
))
}

fn validate_fastly_config_key(
logical_store_id: &str,
key: &str,
Expand Down Expand Up @@ -6991,6 +7027,51 @@ mod tests {
assert!(FASTLY_BLUEPRINT.logging.endpoint.is_none());
}

#[test]
fn client_identities_need_resolvable_config_and_secret_stores() {
use edgezero_core::manifest::ManifestLoader;

let resolvable = ManifestLoader::load_from_str(
"[capabilities.outbound.client-identities.defaulted]\n\
[capabilities.outbound.client-identities.explicit]\n\
config-store = \"app_config\"\nsecret-store = \"keys\"\n\
[stores.config]\nids = [\"app_config\"]\n\
[stores.secrets]\nids = [\"keys\"]\n",
);
assert_eq!(
FastlyCliAdapter.validate_client_identities(resolvable.manifest()),
Ok(())
);

let no_secrets = ManifestLoader::load_from_str(
"[capabilities.outbound.client-identities.mtls]\n\
[stores.config]\nids = [\"app_config\"]\n",
);
let no_secret_error = FastlyCliAdapter
.validate_client_identities(no_secrets.manifest())
.expect_err("missing secret store");
assert!(
no_secret_error.contains("`mtls` (no secret store)"),
"{no_secret_error}"
Comment thread
aram356 marked this conversation as resolved.
Dismissed
);

let no_stores =
ManifestLoader::load_from_str("[capabilities.outbound.client-identities.mtls]\n");
let no_store_error = FastlyCliAdapter
.validate_client_identities(no_stores.manifest())
.expect_err("missing both stores");
assert!(
no_store_error.contains("`mtls` (no config store or secret store)"),
"{no_store_error}"
);

let none = ManifestLoader::load_from_str("[app]\nname = \"plain\"\n");
assert_eq!(
FastlyCliAdapter.validate_client_identities(none.manifest()),
Ok(())
);
}

#[test]
fn adapter_capability_matrix_matches_contracts() {
adapter_capability_matrix_matches_outbound_spec();
Expand Down Expand Up @@ -7091,6 +7172,10 @@ mod tests {
CapabilitySupport::BestEffort,
),
(Capability::OutboundCacheBypass, CapabilitySupport::Native),
(
Capability::OutboundClientIdentity,
CapabilitySupport::Native,
),
(
Capability::OutboundImageOptimizer,
CapabilitySupport::BestEffort,
Expand Down
8 changes: 6 additions & 2 deletions crates/edgezero-adapter-fastly/src/config_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ impl FastlyConfigStore {
unsafe_code,
reason = "the pinned ABI receives a live initialized slice and cannot resize it"
)]
fn read_entry(&self, key: &str, limit: u64) -> Result<Option<String>, ConfigStoreError> {
pub(crate) fn read_entry(
&self,
key: &str,
limit: u64,
) -> Result<Option<String>, ConfigStoreError> {
let read_limit = limit.min(MAX_ENTRY_BYTES);
match &self.inner {
FastlyConfigStoreBackend::Fastly(handle) => {
Expand Down Expand Up @@ -90,7 +94,7 @@ impl FastlyConfigStore {
unsafe_code,
reason = "the pinned host ABI writes only the supplied handle out-parameter"
)]
fn try_open_optional(name: &str) -> Result<Option<Self>, ConfigStoreError> {
pub(crate) fn try_open_optional(name: &str) -> Result<Option<Self>, ConfigStoreError> {
let mut handle = fastly_shared::INVALID_CONFIG_STORE_HANDLE;
// SAFETY: the UTF-8 name slice and initialized out-parameter remain live
// for this synchronous call. Config Store exposes no close operation.
Expand Down
Loading
Loading