Repository navigation
Conversation
Let a sandbox policy endpoint's credential_binding set its own request placement, so one stored provider credential can be presented as a Bearer token at one endpoint and as a raw named header at another. Each endpoint accepts the credential only at its own placement; endpoints without one keep the provider profile placement. - Add NetworkCredentialPlacement to NetworkCredentialBinding and carry it on StaticCredentialEndpointBinding to the supervisor. - Select the placement per request from the matching endpoint bindings and resolve nothing when matching bindings disagree. - Validate placements strictly and reject overlapping bindings of one provider with different placements, or placement with credential_signing. - Include placement in the provider environment revision and stable workload handle without changing values for existing bindings. - Gate delivery on a new supervisor policy capability and a polling request flag; withhold affected credentials from older supervisors. Closes ai-openshell#5963 Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
89ab96c to
c230a0e
Compare
- Read the effective configuration with the trusted loader when recording admission reports and refreshing sandbox tokens, so the supervisor-facing capability gate no longer rejects these internal reads for placement-bearing policies. - Enforce the header value form of an explicit binding placement: bearer accepts only "Bearer <placeholder>", header only the bare placeholder, and basic only Basic authorization. Profile placements keep their documented behavior. - Treat a "/**" subtree as also matching its root path when checking overlapping bindings of one provider for conflicting placements. - Advertise supported policy capabilities in Health and have the CLI refuse to submit credential_binding.placement to a gateway that does not advertise it, since an older gateway drops the field. Refs ai-openshell#5963 Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
There was a problem hiding this comment.
gator-agent
PR Review Status
The team found three issues to address before pipeline handoff.
Action required: @mrunalp, please address the three inline findings.
Blocking findings:
GATOR-1453367c-01· Legacy supervisors can keep using the old credential placementGATOR-1453367c-02· Apply explicit placement to every request transformGATOR-1453367c-04· Preserve raw Rust SDK source compatibility on the patch train
Carried findings: None.
Non-blocking suggestions:
- Match runtime semantics when checking overlapping placement rules. A trailing
/**uses a literal subtree prefix, and compiled query parameter names are trimmed.
Gator metadata
- Validation: Implements accepted issue #5963.
- Docs: Updated the existing Fern policy schema and provider profile pages.
- Checks: DCO, Trivy Changes and Frozen Paths passed. Branch Checks and Helm Lint gates were pending. Maintainer Approval is evaluated at handoff.
- E2E: Core E2E required for the policy and credential flow changes. The unlabeled current-head workflow skipped the suites.
- Head SHA:
1453367cdf5ee4321db934410a68abcbd95ee7d7 - Base SHA:
c8053c7cce54a9dc1b4996b70ddb525f22197957 - Merge base SHA:
c8053c7cce54a9dc1b4996b70ddb525f22197957 - Patch ID:
f6a1839330051bcebc19bb99b057703280936e3e - Gator payload:
19 - Review mode:
initial - Specialist consults: review-correctness, review-security, review-compatibility
- Previous reviewed SHA: none
- Review budget exhausted: no
- Maintainer decision required: no
- Next state:
gator:in-review
| openshell_core::extension_protocol::POLICY_CREDENTIAL_BINDING_PLACEMENT_V1, | ||
| ) && policy.is_some_and(openshell_policy::uses_credential_binding_placement) | ||
| { | ||
| return Err(Status::unimplemented( |
There was a problem hiding this comment.
gator-agent
Warning · GATOR-1453367c-01 · Legacy supervisors can keep using the old credential placement
Summary When an operator changes placement on a running sandbox, an older polling supervisor treats the compatibility rejection as a transient RPC failure. It keeps the installed policy and cached credential even in fail-closed mode. Push delivery can also retain usable credentials when configured to keep the last valid policy.
Fix Reject the update before changing the desired policy if an incompatible supervisor would keep using the old placement, or revoke the affected cached credential through both delivery modes, including across reconnect and fallback. Preserve unrelated policy where the configured failure mode allows it.
Verify Use a mocked running supervisor and a synthetic credential. Cover polling, push, and push-to-poll reconnect under both failure modes. Verify that the update is rejected before the desired revision changes or that the old placement can no longer resolve the value. Verify quarantine in fail-closed mode and recovery on a compatible supervisor.
Agent context
crates/openshell-server/src/grpc/policy.rs:2948
| if invalid_port { | ||
| violations.push(format!("credential-bound endpoint '{}' for provider '{provider}' must define ports in range 1..=65535", endpoint.host)); | ||
| } | ||
| if let Some(placement) = &binding.placement { |
There was a problem hiding this comment.
gator-agent
Warning · GATOR-1453367c-02 · Apply explicit placement to every request transform
Summary When an operator configures an explicit credential placement, REST body and WebSocket text rewriting can still resolve the credential outside that placement. The trusted signing lookup can also select a separately scoped session token from an overlapping binding. The credential can reach an upstream request location the operator excluded.
Fix Carry explicit placement provenance for every auth style and enforce it in payload rewriting and signing. Bind signing lookups to the authorized provider. Keep profile-based payload rewriting when explicitly enabled and document how the flags interact with placement.
Verify Use synthetic values in resolver and signer fixtures. Check that the declared header still resolves, the body and WebSocket contexts deny the explicitly placed credential, and an independently scoped token is absent from signing inputs and output. Check that profile-only bindings still honor their rewrite options.
Agent context
crates/openshell-policy/src/lib.rs:2762
| // credentials. Absent keeps each credential's provider profile placement. | ||
| // When set, it replaces that placement for requests admitted by this | ||
| // endpoint only; other bindings of the same provider are unaffected. | ||
| NetworkCredentialPlacement placement = 2; |
There was a problem hiding this comment.
gator-agent
Warning · GATOR-1453367c-04 · Preserve raw Rust SDK source compatibility on the patch train
Summary Rust callers upgrading the SDK can no longer compile complete struct literals or exhaustive patterns for four public raw messages. The new members are placement on NetworkCredentialBinding and StaticCredentialEndpointBinding, supported_policy_capabilities on HealthResponse, and supports_static_credential_endpoint_placements on GetSandboxProviderEnvironmentRequest. Both v0.1.11 and the v0.1.12 prerelease seed are reachable from the target base, confirming a patch train.
Fix Keep the existing Rust struct shapes and expose the new fields through opt-in types or RPCs, or schedule the source break for a minor train with notice and migration guidance for optional placement, the boolean capability, and the capability list.
Verify Keep a downstream fixture that builds an existing complete NetworkCredentialBinding literal and a HealthResponse mock unchanged. Both should compile when switching the fixture from the released SDK to a patch candidate.
Agent context
proto/sandbox.proto:141
- Check overlapping bindings of one provider with host and path matchers that follow HostPattern and EndpointPathPattern: host labels are globs that never cross a dot, a "**" label matches one or more labels, and "<prefix>/**" is a literal prefix subtree. Run this check even when the request-pipeline host check reports no overlap. - Classify header rewrite failures with the same form-aware resolver used for the lookup, so an expired credential in a correctly formed header is reported as unavailable rather than a placement mismatch. Refs ai-openshell#5963 Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
There was a problem hiding this comment.
gator-agent
PR Review Status
The latest commit improves expired-credential error reporting. The three earlier findings remain open, and the team found one new mismatch between policy validation and runtime endpoint matching.
Action required: @mrunalp, please address the new inline finding and the three existing review threads.
Blocking findings:
GATOR-8362b6e8-01· Match runtime path semantics when validating placement overlaps
Carried findings:
GATOR-1453367c-01· Cached credential behavior on older supervisorsGATOR-1453367c-02· Placement enforcement across request transformsGATOR-1453367c-04· Rust SDK source compatibility
Gator metadata
- Validation: Implements accepted issue #5963.
- Docs: Existing Fern policy and provider profile updates cover endpoint placement.
- Checks: DCO, Frozen Paths, Trivy Changes, Branch Checks, and Helm Lint passed. Maintainer Approval is evaluated at handoff.
- E2E: Core E2E is required for policy and credential flow changes. The current-head workflow skipped the suites.
- Head SHA:
8362b6e8046223925aa4b7a3b45c9ed2d1ef8ee0 - Base SHA:
c8053c7cce54a9dc1b4996b70ddb525f22197957 - Merge base SHA:
c8053c7cce54a9dc1b4996b70ddb525f22197957 - Patch ID:
18de5fad2960bcb726ef813cef0dd17e1969d367 - Gator payload:
19 - Review mode:
follow_up - Specialist consults: review-correctness
- Previous reviewed SHA:
1453367cdf5ee4321db934410a68abcbd95ee7d7 - Review budget exhausted: no
- Maintainer decision required: no
- Next state:
gator:in-review
| return Some(vec![literal(prefix), descendants]); | ||
| } | ||
| let mut languages = vec![literal(pattern)]; | ||
| languages.extend(tokenize_runtime_path_glob(pattern)); |
There was a problem hiding this comment.
gator-agent
Warning · GATOR-8362b6e8-01 · Match runtime path semantics when validating placement overlaps
Summary When an operator gives two inspected endpoints different placements for the same provider and port, the gateway can admit a conflict that makes the credential unavailable on a matching request. It can also reject valid disjoint endpoints. The overlap parser loses glob classes whose first member is ] and lets an interior **/ end inside a path component.
Fix Match the runtime class grammar in both hosts and paths. Let **/ match zero characters or end at a separator. Preserve exact pattern-text matching and literal trailing subtrees. Keep a conservative result when a valid runtime pattern cannot be modeled.
Verify In a synthetic HTTPS policy fixture with two distinct header placements, verify that the same-host paths /v1/[]a] and /v1/a conflict. Cover negated classes and the root of a literal subtree as well. With overlapping hosts api?.example.com and api1.example.com, verify that /root/**/item and /root/xitem are admitted, while /root/item and /root/team/item conflict with the recursive selector. Verify that disjoint host classes and literals on the same path are admitted, including api[]a].example.com with apib.example.com and api[!]a].example.com with apia.example.com.
Agent context
crates/openshell-policy/src/ambiguity.rs:536
The new path-language builder drops the glob interpretation on a tokenizer error. The broader host intersection check also exposes the recursive path mismatch. The same class parse error makes the host intersection overly broad.
- Answer exact credential binding paths and hosts with the runtime matcher, model "**/" as whole path components, and treat selectors the overlap check cannot model as overlapping. - Deny explicitly placed credentials in request-body and WebSocket rewriting and in trusted signing lookups. Profile placements keep honoring the endpoint's rewrite options. - Deliver a placement-bearing policy to a polling supervisor without the placement capability as an unadmitted configuration, so it applies its policy validation failure mode instead of retrying with its previous placement. Refs ai-openshell#5963 Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
There was a problem hiding this comment.
gator-agent
PR Review Status
Mrunal Patel, I checked your updates to legacy polling, request transforms and endpoint matching. Polling now reports rejected configurations and the requested transform guards are in place. The findings below cover the remaining behavior and regressions in this revision.
Action required: @mrunalp, please address the findings below before pipeline handoff.
Blocking findings:
GATOR-655c9fcc-01· Keep provably disjoint endpoint paths admissibleGATOR-655c9fcc-02· Scope optional SigV4 credentials to the signing providerGATOR-655c9fcc-03· Apply an unchanged polling rejection once
Carried findings:
GATOR-1453367c-01· Legacy supervisors can still retain old credential placement in keep-last mode.GATOR-1453367c-02· Placement guards now cover body, WebSocket and signing transforms. Signing still needs provider scoping.GATOR-1453367c-04· The public raw Rust message changes still break existing complete struct literals on the patch train.GATOR-8362b6e8-01· The revised overlap check fixes the recursive cases but still mishandles some supported character classes.
Gator metadata
- Validation: Implements accepted issue #5963.
- Docs: Updated the existing Fern policy schema and provider profile pages.
- Checks: DCO, Frozen Paths, Trivy Changes and Helm Lint passed. Branch Checks were pending. Maintainer Approval is evaluated at handoff.
- E2E: Core E2E is required for the policy and credential changes. The current run skipped the suites.
- Head SHA:
655c9fcc76c5e640e438846891aeaacf857ebd6b - Base SHA:
c8053c7cce54a9dc1b4996b70ddb525f22197957 - Merge base SHA:
c8053c7cce54a9dc1b4996b70ddb525f22197957 - Patch ID:
6e635f8567bc8ec2c50d5fda39fcee4006a45521 - Gator payload:
19 - Review mode:
follow_up - Specialist consults: review-security, review-correctness
- Previous reviewed SHA:
8362b6e8046223925aa4b7a3b45c9ed2d1ef8ee0 - Review budget exhausted: no
- Maintainer decision required: no
- Next state:
gator:in-review
| credential_path_languages(left), | ||
| credential_path_languages(right), | ||
| ) else { | ||
| return true; |
There was a problem hiding this comment.
gator-agent
Warning · GATOR-655c9fcc-01 · Keep provably disjoint endpoint paths admissible
Summary The new fallback rejects different placements when the validator cannot model one of two paths. It rejects even paths with disjoint mandatory prefixes, so an operator can no longer apply otherwise valid policies for those endpoints.
Fix Check mandatory literal prefixes using the runtime's source-text, glob and subtree semantics before falling back to overlap for genuinely uncertain pairs.
Verify In the ambiguity fixture, use the same inspected REST host, port and provider with different named headers. Confirm that /alpha/[]a] and /beta/* are admitted. Repeat with /alpha///////**/item and /beta/*.
Agent context
crates/openshell-policy/src/ambiguity.rs:542
| } | ||
| // Trusted transforms such as signing place the value themselves, which | ||
| // an explicit binding placement does not authorize. | ||
| if self.explicit_placement_keys.contains(key) { |
There was a problem hiding this comment.
gator-agent
Warning · GATOR-655c9fcc-02 · Scope optional SigV4 credentials to the signing provider
Summary An inspected request with a usable long-lived signing key pair can now fail locally when an unrelated matching provider has an expired, explicitly placed session token. The placement check rejects the other provider's optional token before checking expiry, so the previously working request stops before it reaches the upstream.
Fix Resolve the signing tuple within the selected provider's authorized snapshot. Ignore foreign values before checking placement or expiry, and preserve denials for missing or unauthorized required keys and disallowed placement on the selected provider.
Verify Use synthetic credentials in the signer fixture. Confirm that a valid long-lived pair signs before and after an unrelated explicitly placed token expires, and that signing inputs and output omit that token. Confirm that a missing or unauthorized required key still rejects signing.
Agent context
crates/openshell-core/src/secrets.rs:904
| let config = load_sandbox_config(state, &sandbox).await?; | ||
| if matches!(principal, Principal::Sandbox(_)) { | ||
| if placement_capability_missing(&req.supported_capabilities, config.policy.as_ref()) { | ||
| return Ok(Response::new(unsupported_placement_config(config))); |
There was a problem hiding this comment.
gator-agent
Warning · GATOR-655c9fcc-03 · Apply an unchanged polling rejection once
Summary When a running legacy supervisor polls for a placement-bearing policy, each identical rejection writes the sandbox record and notifies watchers again. Under fail-closed mode, each poll also publishes a fresh deny-all generation.
Fix Make applying and reporting the same rejection idempotent. Reapply when the desired configuration, disposition, or runtime state changes, retry failed reports, and preserve the first fail-closed transition and recovery on a compatible supervisor.
Verify In a polling fixture, deliver the same unadmitted desired revision twice under each failure mode. After the first successful report, confirm the second reply leaves the sandbox resource version unchanged and, in fail-closed mode, leaves the deny-all generation unchanged. Confirm a failed report can still be retried.
Agent context
crates/openshell-server/src/grpc/policy.rs:2920
…sjointness - Treat an explicitly placed credential as absent in trusted signing lookups, so a foreign optional session token is ignored while a missing required key still fails as unavailable. - Skip the sandbox write and watcher notification when a repeated rejection report changes nothing. - Reject overlap between credential binding paths only when their mandatory literal prefixes and suffixes agree, before falling back to the conservative check. Refs ai-openshell#5963 Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
Maintainer Convergence DecisionMrunal Patel, I checked your updates to signing inputs, endpoint matching and repeated rejection reports. Explicitly placed keys are now excluded from signing, and repeated rejection reports avoid a redundant gateway write. The existing threads below still need a disposition. Root-cause findings:
Action required: @ai-openshell/maintainers, please confirm which of these existing requirements must be fixed in this PR and explicitly waive any you accept. If you want the held path-overlap Warning posted as a separate finding, please authorize another Warning-bearing round. Gator metadata
|
A component-aligned "**/" at the end of a credential binding path matches any remainder, and at the start it can match nothing, so its slash is not required in either position. Apply this in both the glob expansion and the literal suffix check, so "/a/**/" and "/a/*b" are reported as overlapping. Refs ai-openshell#5963 Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
Maintainer Convergence DecisionMrunal Patel, I checked the changes to SigV4 inputs, repeated rejection handling, and endpoint path matching. The changes exclude explicitly placed keys from signing, prevent repeated gateway writes for unchanged rejections, and improve overlap validation for trailing recursive wildcards. Seven existing findings still need a decision. Root-cause findings:
Action required: @ai-openshell/maintainers, please identify which of these findings need fixes in this PR and explicitly waive any you accept. Gator metadata
|
Summary
Let an endpoint's
credential_bindingset its ownplacement, so one stored provider credential can be presented asAuthorization: Bearer <placeholder>at one endpoint and asx-api-key: <placeholder>at another. Each endpoint accepts the credential only at its own placement. Replacing or removing the credential affects every binding, with no duplicate stored values.Related Issue
Closes #5963
Changes
NetworkCredentialPlacement(auth_style,header_name,query_param,path_template) toNetworkCredentialBinding, and carried it onStaticCredentialEndpointBindingto the supervisor.placementcombined withcredential_signing.openshell.policy.credential-binding-placement.v1, and a supervisor without it is refused any policy that usesplacement. The pollingGetSandboxProviderEnvironmentRPC gainssupports_static_credential_endpoint_placements; without it, credentials whose bindings use a placement are withheld asUnsupportedSupervisor.generate-sandbox-policyskill.Release Notes
A sandbox policy endpoint can set
credential_binding.placementto choose where the bound provider's credential goes at that endpoint. This lets one credential serve consumers that expect Bearer authorization and consumers that expect a named header.Testing
cargo clippy --testson core, policy, policy-schema, server, supervisor, and supervisor-networkrustfmt,buf lint, andmarkdownlintChecklist