feat(providers): add custom profile registry#1170
Open
johntmyers wants to merge 8 commits intomainfrom
Open
Conversation
18 tasks
|
Label |
fd335cd to
71e7a17
Compare
TaylorMutch
approved these changes
May 6, 2026
zredlined
approved these changes
May 6, 2026
6 tasks
drew
approved these changes
May 7, 2026
Collaborator
drew
left a comment
There was a problem hiding this comment.
Looks good. Mostly focused on the CLI contracts.
Comment on lines
+636
to
+651
| #[derive(Clone, Debug, ValueEnum)] | ||
| enum ProviderProfileOutput { | ||
| Table, | ||
| Yaml, | ||
| Json, | ||
| } | ||
|
|
||
| impl ProviderProfileOutput { | ||
| fn as_str(&self) -> &'static str { | ||
| match self { | ||
| Self::Table => "table", | ||
| Self::Yaml => "yaml", | ||
| Self::Json => "json", | ||
| } | ||
| } | ||
| } |
Collaborator
There was a problem hiding this comment.
this is probably useful as a common type for all cli entities
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.
Summary
Adds a custom provider profile registry on top of the built-in YAML profile catalog so profiles can be exported, linted, imported, listed, retrieved, deleted, and used when creating provider records incrementally.
Closes #1081
UX Changes
openshell provider list-profilesnow supports-o table|yaml|json; table remains the default for browsing.openshell provider profile export <id> -o yaml|json; YAML is the default authoring/export format.openshell provider profile import -f <file>for single-profile import.openshell provider profile import --from <directory>for non-recursive bulk import of*.yaml,*.yml, and*.jsonprofile files.openshell provider profile lint -f <file>andopenshell provider profile lint --from <directory>to validate profile files without registering them.openshell provider profile delete <id>for deleting registered custom profiles.openshell provider create --type <id>now accepts imported custom provider profile ids in addition to built-in provider types.a-z,0-9, and-; import/lint rejects whitespace, uppercase, underscores, empty segments, and leading/trailing dashes.generic,github, orgh; those ids remain reserved for provider records.Provider.typematches that profile id.UX Example
Export the built-in GitHub profile as YAML:
Built-in profiles and legacy provider type ids are reserved, so the edited profile uses a new custom lowercase kebab-case
id. The profile YAML can also use the full network policy endpoint shape, including L7 allow/deny rules:Lint and import the custom profile:
Notional
list-profilesoutput after import:Create a provider record that points at the imported profile id:
Enable provider-profile policy composition at the gateway:
Launching a sandbox with
work-githubcomposes the profile policy layer JIT:The effective policy includes the sandbox's base policy plus a generated provider layer. Relevant composed network-policy fragment:
Changes
StoredProviderProfileobject metadata support.object_type = "provider_profile"; no new tables or migrations.genericno-built-in-profile fallback path.Provider.typematches the profile id.openshell provider list-profiles -o table|yaml|jsonandopenshell provider profile export|import|lint|delete.openshell provider create --type <id>to create provider records backed by imported custom profiles.docs/*updates remain out of scope for this issue.Testing
RUSTC_WRAPPER= cargo check -p openshell-cli -p openshell-server -p openshell-providersRUSTC_WRAPPER= cargo test -p openshell-providers profileRUSTC_WRAPPER= cargo test -p openshell-providers profile_idRUSTC_WRAPPER= cargo test -p openshell-server grpc::provider::tests::RUSTC_WRAPPER= cargo test -p openshell-server provider_profileRUSTC_WRAPPER= cargo test -p openshell-server provider_policy_layers_include_custom_provider_profilesRUSTC_WRAPPER= cargo test -p openshell-server import_provider_profile_rejects_legacy_provider_type_idsRUSTC_WRAPPER= cargo test -p openshell-server import_provider_profile_rejects_noncanonical_idsRUSTC_WRAPPER= cargo test -p openshell-server provider_profile_get_and_delete_normalize_request_idsRUSTC_WRAPPER= cargo test -p openshell-server provider_policy_layers_skip_custom_profile_for_legacy_provider_typeRUSTC_WRAPPER= cargo test -p openshell-server provider_policy_layers_normalize_custom_provider_type_idsRUSTC_WRAPPER= cargo test -p openshell-cli provider_create_accepts_custom_profile_type_idsRUSTC_WRAPPER= cargo test -p openshell-cli provider_profile_cli_run_functions_support_custom_profilesRUSTC_WRAPPER= cargo test -p openshell-cli provider_mise run pre-commitChecklist