Repository navigation
Conversation
|
All contributors have signed the DCO ✍️ ✅ |
|
I have read the DCO document and I hereby sign the DCO. |
|
recheck |
f6cf210 to
180527a
Compare
… affect them (v0.1.7 backport) Backport of feat/4945-policy-change-closes-everything (PR ai-openshell#5361) onto v0.1.7, squashed, for running against a v0.1.7 gateway and the openshell-firecracker driver. Not for merging. Differences from the branch: v0.1.7 has no credential placements, so the resolver tracking in ProviderCredentialState wraps the v0.1.7 resolvers directly, and one relay test uses rewrite_header_value in place of rewrite_header_value_for_name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
88d6b76 to
4ac8e89
Compare
6390b5b to
a996acd
Compare
a996acd to
3b4dee2
Compare
|
/ok to test 3b4dee2 |
BlockedGitHub reports merge conflicts with @johntmyers, I checked the current-head runs after your test request. Action required: @mr-miles, resolve the merge conflicts and inspect the failed Linux Rust lint jobs. A maintainer must accept linked issues #4945, #5363, #5365, #5366, and #5367 with DCO passed. Branch Checks is still running, with Rust lint failures on x86_64-linux and aarch64-linux. The annotations report exit code 101, but detailed logs were inaccessible from this sandbox, so the lint cause is not established. No workflow approvals, reruns, or dispatches were performed. Gator metadata
|
3b4dee2 to
0c01687
Compare
Blocked@mr-miles, your updated branch is now mergeable with Current-head CI runs now exist, including Branch E2E Checks, but require native GitHub Actions approval. Branch Checks, Helm Lint, and Trivy Changes also report PR Issue Acceptance failed because linked issues #4945, #5363, #5365, #5366, and #5367 still have Action required: a maintainer must review and approve the pending current-head workflow runs in GitHub, decide acceptance of the five linked issues, and rerun PR Issue Acceptance after accepting them. Workflow approval and reruns are outside this invocation's authorization. Gator metadata
|
BlockedThe new head passes DCO and PR Issue Acceptance, resolving the earlier issue-acceptance blocker. Current-head Branch Checks, Helm Lint, Trivy Changes, and Branch E2E Checks await native GitHub Actions approval. Code review remains deferred under the process-blocker gate. Action required: a maintainer must inspect and approve the pending current-head workflows in GitHub. The existing The previous head had failed Rust lint jobs; those results do not establish the outcome for this new commit. No workflow approval, rerun, or dispatch was performed. Gator metadata
|
johntmyers
left a comment
There was a problem hiding this comment.
gator-agent
PR Review Status
The first code review is complete. One blocking Warning remains: an authenticated connection can survive rotation of a credential it used.
@johntmyers, I checked the current-head runs following your test request: required checks and the selected E2E suite have passed. The earlier merge, issue-acceptance, DCO, and workflow-approval blockers are resolved, so the earlier process-only reports did not suppress this review.
Action required: @mr-miles, address the credential-continuity finding below and add the two regression cases.
Blocking findings:
GATOR-2e90ffc0-01: Preserve credential invalidation across publication and coalesced rotations.
Carried findings: None.
Gator metadata
- Validation: Implements accepted issues #5363, #5365, #5366, and #5367; partially addresses accepted issue #4945 within the stated connection-revalidation scope.
- Docs: Published policy management and network rules pages updated; no navigation change needed.
- Checks: Current-head required DCO, Branch Checks, Helm Lint, and E2E passed; PR Issue Acceptance and Trivy Changes also passed. Non-required statuses do not gate progression.
- E2E: Existing
test:e2e; current-head Branch E2E Checks run 44834339546 completed successfully. No additional trigger needed; no Windows-specific change identified. - Head SHA:
2e90ffc0337a94455cd4d110e2e3c48c99a3ef7e - Base SHA:
de7c2a5f3d6e5eb00f9bb56a5cf8a10becedbd69 - Merge base SHA:
de7c2a5f3d6e5eb00f9bb56a5cf8a10becedbd69 - Patch ID:
9c8831fda394e154bb00ea888d4236e404b30443 - Gator payload:
16 - Review mode:
initial - Previous reviewed SHA:
none - Review budget exhausted:
no - Maintainer decision required:
no - Next state:
gator:in-review
johntmyers
left a comment
There was a problem hiding this comment.
gator-agent
PR Review Status
The follow-up code review found no new blocking issues. GATOR-2e90ffc0-01 is fixed: credential continuity is checked after configuration publication, and credential versions retain intervening rotations and revocations. The added regression cases cover the publication race and A→B→A transitions, including prepared installs and grant configuration changes. I checked the code and test coverage; no local tests were run.
@mr-miles, your latest commit addresses both parts of the credential finding. I also verified @johntmyers's resolution of the original thread and preserved it.
Required Branch Checks and E2E are running on this head. The existing test:e2e label is appropriate, and no additional trigger is needed. The failed advisory compatibility review is not a required gate. Gator will inspect required CI results next cycle.
Blocking findings: None.
Carried findings: None; GATOR-2e90ffc0-01 is resolved.
Gator metadata
- Validation: Preserved project-validity review for accepted connection-revalidation issues; follow-up stays within that scope.
- Docs: Existing published policy management and network rules updates remain applicable; no new UX contract introduced by this fix.
- Checks: DCO, Helm Lint, PR Issue Acceptance, and Trivy Changes passed. Required Branch Checks remains pending.
- E2E: Existing
test:e2e; current-head Branch E2E Checks run 44844509966 is in progress. - Head SHA:
53380750ae427217ed37a94beff907b50a9ec948 - Base SHA:
de7c2a5f3d6e5eb00f9bb56a5cf8a10becedbd69 - Merge base SHA:
de7c2a5f3d6e5eb00f9bb56a5cf8a10becedbd69 - Patch ID:
23f5cfb48dd30dae3974f39c2a8dc58e2d532c8a - Gator payload:
16 - Review mode:
follow_up - Previous reviewed SHA:
2e90ffc0337a94455cd4d110e2e3c48c99a3ef7e - Review budget exhausted:
no - Maintainer decision required:
no - Next state:
gator:watch-pipeline
Relay setup pins the policy generation of the L4 decision and refuses the connection if any reload landed after it, even one that leaves the connection's contract unchanged. CONNECT answers 403 "policy changed", raw, passthrough and inspected relays do not start, and the direct transparent path refuses the connection. The window is short, but every policy approval lands in it for any connection being set up, and a retry is the only remedy. These tests state that a reload between the decision and relay setup is re-evaluated: the pin follows it when the connection's contract is unchanged, so the relay starts at the current generation, and an L7 route hydrated after such a reload is the decision's own route. The existing test that any reload between authorization and the pin refuses the relay is replaced by these. Guard tests that pass today: a reload that changes the connection's rules, and a quarantine, still refuse relay setup. Signed-off-by: mr-miles <miles.waller@gmail.com>
Relay setup pinned the generation of the L4 decision strictly, so any reload between the decision and the pin refused the connection, even one that left its contract unchanged: CONNECT answered 403 "policy changed", relays did not start, and the direct transparent path refused the connection. Every policy approval lands in that window for connections being set up at the time. revalidating_generation_guard now re-evaluates the connection against every generation since the decision, as the guard of an established connection does, and starts at the current generation if the contract held. A changed contract, a quarantine, or a decision that cannot be re-evaluated (a denial, or a generation no longer in the history) still refuses the connection. An L7 evaluator is cloned from the generation the pin reached, following any reload between pinning and cloning, and an L7 route hydrated after the decision is accepted when the guard shows the contract held up to the route's generation. Relay setup pins before it validates the route, so that check sees the followed guard. Signed-off-by: mr-miles <miles.waller@gmail.com>
Move the part of handle_transparent_tcp_connection that pins an allowed connection, from holding the decision's policy generation to building the connector from the policy DNS mapping, into pin_transparent_tcp. The connection handler keeps capture, identity, the policy decision and every audit emission, so behaviour is unchanged. The direct path had no tests: the handler needs a netfilter-redirected socket for the original destination and a procfs process identity. The pinning step now runs with a supplied decision, and characterisation tests pin down what it does today: it dials only the mapping's addresses for the authorized endpoint, re-evaluates a reload after the decision, and refuses a reload that changes the connection, an observation and an expired mapping. Signed-off-by: mr-miles <miles.waller@gmail.com>
…ot its layout A policy DNS mapping is bound to the policy generation it was published in, so every reload refuses every kept answer, even when the current policy still allows the connection. Claude Code (node) keeps the answer for api.anthropic.com and is refused with transparent_tcp_mapping_denied when an operator approves another host. Proto conversion also stamps the hash of the whole policy into every endpoint, so any reload gives every name a new synthetic address from the never-reused pool. These tests state that an answer stands for its name: the current policy decides each connection, a denied port is a proposed policy denial, and the deciding endpoint's destination rules select from the pinned addresses. A kept answer survives an unrelated reload, inserting an endpoint before it in the same policy, a port added to it, narrower allowed_ips that still contain the resolved address, and an unrelated reload for the trusted host gateway alias, on the staged and the direct transparent paths. A name keeps its address on a fresh lookup through the same changes. A reload never adds an address to a kept answer, and a kept answer whose addresses the reloaded endpoint forbids is refused by the destination rules, not because a reload happened. Guard tests that pass today: a kept observation is still refused once its name is approved, a control-plane port added to an exact host stays refused, and the direct path refuses addresses a reloaded endpoint forbids. Signed-off-by: mr-miles <miles.waller@gmail.com>
… one that issued them A policy DNS mapping recorded a contract per endpoint and port, keyed by endpoint position, and was bound to the policy generation it was published in, and its allocation identity hashed the endpoint objects, including the per-reload policy_hash stamp. Any reload refused every kept answer and gave every name a new synthetic address, even when the current policy still allowed the connection. A synthetic address now stands for one name and address family. Its record pins the trusted resolver addresses that passed the destination rules of at least one endpoint eligible for the name, and it is not tied to a policy generation. Each connection is authorized by the current policy as before, and the pinned addresses are filtered through that decision's own destination rules, so an address pinned for another endpoint of the name, another binary's or a looser one, is not reachable through a stricter one. A reload can never add a real address to a kept answer; the TTL still bounds how long it is used, and the name is never resolved again at connect time. The direct Linux transparent path now hydrates the decision's destination plan, with the trusted host gateway policy DNS uses, and filters the pinned addresses through it; it previously dialed the addresses pinned for the matched endpoint without the decision's rules. The port of a connection is decided by the policy alone, so a port added to an endpoint is usable with a kept answer, and a port the policy does not allow is a policy denial that the policy advisor sees as a proposal, like any other denied connection, rather than a mapping refusal. The allocation identity hash, the per-port endpoint contracts and the endpoint join between mappings and decisions are removed. The mapping lookup error the direct path reports for a reload during authorization is renamed PolicyChanged: the store never returns it. Signed-off-by: mr-miles <miles.waller@gmail.com>
…icy denies A kept answer is refused by the policy decision once its host leaves the policy or the policy is quarantined. One name allowed for two binaries with different destination rules pins both resolved addresses, and each connection reaches only the addresses its own endpoint permits, driven through a real policy DNS answer. The record pins the union of what the eligible endpoints permit, in resolver order. Signed-off-by: mr-miles <miles.waller@gmail.com>
The egress adapter design said a mapping holds an endpoint identifier and allowed ports and that a reload invalidates mappings whose endpoint contract changed. A mapping now holds the addresses some eligible endpoint permitted, each connection is decided by the current policy, and the deciding endpoint's rules filter the pinned addresses. Signed-off-by: mr-miles <miles.waller@gmail.com>
…ization A transparent connection to a synthetic address looks its mapping up twice: once to name the destination, refreshing it if it has expired, and again to pin the addresses after the connection is authorized. The second lookup read the store directly and never refreshed, so a mapping that was live at the first lookup but expired while the connection was authorized was refused with transparent_tcp_mapping_denied, on a host the policy allows. With a trusted resolver that answers TTL 0, every mapping lives one second, and authorization includes resolving the connecting binary's identity. The direct, staged and dispatch paths now pin through PolicyDnsService::lookup_for_pin, which refreshes an expired mapping the way the first lookup does and refuses observations. The bare store accessor and its non-refreshing lookup are test-only, so no connection path can bypass the refresh. Refs ai-openshell#4674 Signed-off-by: mr-miles <miles.waller@gmail.com>
The policy DNS paragraph said a placeholder stays the same only while its endpoint policy is unchanged, and that policy changes invalidate cached mappings. A placeholder now stands for its hostname for the life of the sandbox and each connection is judged by the current policy; an expired mapping is refreshed on connect, and a hostname the policy no longer allows is denied. Signed-off-by: mr-miles <miles.waller@gmail.com>
Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com>
Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com>
Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com>
5338075 to
66ab128
Compare
…reviews Add networking checklist rules: control-plane changes such as policy reloads, approvals, and credential rotations disrupt only the connections they affect, and a targeted check that replaces a conservative one reads consistent, fully published state with versions that change on every transition. The contracts member now compares the pull request description's claims with the behavior the diff changes. Add replay cases for #2373, which closed every relay on each policy reload, and #5361, whose credential revalidation raced publication. Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com>
Maintainer Approval NeededGator validation and PR monitoring are complete. The current head is a rebase-equivalent match of the reviewed patch, so the completed follow-up review remains valid. No blocking findings remain; Current-head required DCO, Branch Checks, Helm Lint, and E2E checks passed. The selected Human maintainer approval is now required. Gator metadata
|
Summary
Every network policy reload, provider attach/detach, and middleware registry change causes outbound network connections to be closed by the supervisor, and errors reported back to the sandbox.
This was deliberate (#2373, "invalidate relays on policy changes") and is documented, but much coarser than it needs to be. Also the behaviour is very confusing for workloads that ask for approvals while they are running, causing agents to focus on "solving" and diagnosing connectivity issues rather than their assigned work.
This PR adds the ability to re-validate open connections against a newly received policy, and close them only if the new policy would not allow them. The same behaviour applies for credential changes.
Related issue
Changes
Policy reloads
ConnectionPolicyContractis compared, to re-evaluate the connection against the new policy.revalidating_generation_guard.Policy DNS
allowed_ipsno longer refuses kept answers. A name also keeps its address on a fresh lookup instead of taking a new one from the never-reused pool on every reload (proto conversion stamps a hash of the whole policy into every endpoint).eligible_portsgate are removed, since mappings are no longer tied to a generation or to the ports authored when they were published. A hostname the current policy no longer allows refreshes to an observation at another address, and the connection is denied.PolicyDnsService::lookup_for_pin), so a TTL-0 mapping that expires during authorization is refreshed rather than refused. The bare store and its non-refreshing lookup are test-only, so no connection path can bypass the refresh.Provider credentials
SecretResolverandinject_or_report.Credential revocation (pre-existing bug)
revoke_provider_environment, and invalid bindings go throughreject_provider_bindings.Endpoint status (MCP)
Direct transparent TCP (Linux)
pin_transparent_tcp) so it can be tested without a netfilter-redirected socket.Safety boundaries
Release notes
Re-validate open connections against a newly received policy, and close them only if the new policy would not allow them. Cached policy DNS answers keep working across policy changes, and an expired answer is refreshed when a connection uses it.
Testing
Structured as red/green pairs:
Rebased onto main, including #5650's refresh-on-connect; its tests are adapted to mappings that are not tied to a generation.
Manual check: open a long-lived connection (for example a WebSocket or
curlto a slow endpoint) through the sandbox proxy, approve an endpoint for a different host, and confirm that the connection survives, the log shows "Policy change does not affect established connection; re-pinned", and the connection closes when its own host's rules change.Running in my own setup, have had no occurrences of dropped connections using the updated code. Previously I had an approx 60% success rate on triggering it with approvals while the agents were at work.
Checklist