Draft
Conversation
Signed-off-by: Brian Hardock <brian.hardock@fermyon.com>
51fbfa1 to
2d2cdcb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implementation of SIP 023
Summary
New
spin-capabilitiescrateThe monolithic
deny-alladapter and associated logic in thespin-composecrate has been replaced by a newspin-capabilitiescrate (crates/capabilities/) that provides:InheritConfigurationenum — The canonical representation of the inheritance mode (All,None, orSome(Vec<String>)), shared between the manifest schema and composition logic.apply_deny_adapter(source, inherits)function — Given a dependency's Wasm component bytes and anInheritConfigurationvalue, this function selectively composes deny adapter exports into the dependency. Only the interfaces that are not in the allow list are plugged with the deny adapter; allowed interfaces pass through to the host.Selective deny adapter composition
The previous approach used
wac_graph::plugto blanket-plug thedeny-alladapter into a dependency. The new approach enumerates the deny adapter's exports and selectively wires each one into the dependency's matching imports — but only for interfaces not in the computed allow list. This means:inherit_configuration = true→ no deny exports are applied; the original component is returned as-isinherit_configuration = false(or omitted) → all matching deny exports are applied, identical to the previousdeny-allbehaviorinherit_configuration = ["allowed_outbound_hosts", "variables"]→ only the HTTP/sockets/MQTT/Redis and variables interfaces pass through; all other matching imports are deniedThe deny adapter component
The deny adapter component is a Wasm component that exports stub implementations of every capability interface Spin provides. Each stub returns a deny/error result. The adapter is built from
crates/capabilities/deny-adapter/, a WASI component written in Rust usingwit-bindgen, and the compiled.wasmis embedded into thespin-capabilitiescrate at build time.Manifest schema changes
The
ComponentDependencyenum incrates/manifest/src/schema/v2.rsis extended with an optionalinherit_configurationfield on each variant (Package,Local,HTTP,AppComponent). The field is represented as theInheritConfigurationenum:The component-level
dependencies_inherit_configurationfield is changed frombooltoOption<bool>to support the mutual-exclusion check during normalization.Manifest normalization
A new normalization step (
normalize_dependency_inherit_configuration) runs during manifest processing. It:dependencies_inherit_configurationand per-dependencyinherit_configurationare not used simultaneously on the same component (raises an error if both are present).dependencies_inherit_configuration = true, expands it intoinherit_configuration = trueon every dependency of that component, then clears the component-level field.Loader changes
The loader (
crates/loader/src/local.rs) no longer threads aboolthrough the dependency loading pipeline. Instead, it reads theinherit_configurationfrom each dependency directly and maps it to the locked app'sInheritConfigurationrepresentation. Theload_component_dependencymethod now returns a fully resolvedLockedComponentDependencywith the appropriateinheritfield, and a separateload_dependency_contentmethod is extracted for callers that only need the Wasm path and export name.