feat(orchestrator): slice 7 — sidecar-side PolicyResolver #362
Open
didericis-claude
wants to merge 2 commits from
orchestrator-slice7 into orchestrator-slice6
pull from: orchestrator-slice7
merge into: didericis:orchestrator-slice6
didericis:main
didericis:orchestrator-registration
didericis:orchestrator-lifecycle
didericis:orchestrator-supervise-writers
didericis:orchestrator-supervise-multitenant
didericis:orchestrator-gitgate-multitenant
didericis:orchestrator-rename-gateway
didericis:orchestrator-slice8
didericis:orchestrator-slice6
didericis:prd-orchestrator
didericis:orchestrator-slice5
didericis:orchestrator-slice4
didericis:orchestrator-slice3
didericis:orchestrator-slice2
didericis:ci-kvm-runner
didericis:post-build-image-smoke-test
didericis:firecracker-backend
didericis:issue-330-cached-images
didericis:forge-native-integration
didericis:prd-smolmachines-linux
didericis:claude-forward-host-credentials
didericis:fold-orchestrator-subpackage
didericis:prd-egress-control-plane
didericis:manifest-break-import-cycle
didericis:dlp-supervise-quality-fixes
didericis:table-drive-dlp-tests
didericis:fix-integration-test-failures
didericis:fix/macos-container-relative-dockerfile
didericis:prd-0054-install-script
didericis:commit-bottle-state
didericis:pr-211
didericis:move-codex-auth-to-contrib
didericis:feat/pipelock-skip-scan-extensions
didericis:prd-0049-named-labelled-agents
didericis:harden-git-gate-shell-rendering
Labels
Clear labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Breaking change that won't be backward compatible
Something is not working
Documentation changes
Improve existing functionality
New functionality
This is security issue
Issue or pull request related to testing
Priority
Critical
1
The priority is critical
Priority
High
2
The priority is high
Priority
Low
4
The priority is low
Priority
Medium
3
The priority is medium
Reviewed
Confirmed
1
Issue has been confirmed
Reviewed
Duplicate
2
This issue or pull request already exists
Reviewed
Invalid
3
Invalid issue
Reviewed
Won't Fix
3
This issue won't be fixed
Status
Abandoned
3
Somebody has started to work on this but abandoned work
Status
Blocked
1
Something is blocking this issue or pull request
Status
Need More Info
2
Feedback is required to reproduce issue or to continue work
No Label
Milestone
No items
No Milestone
Projects
Clear projects
No project
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: didericis/bot-bottle#362
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "orchestrator-slice7"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Slice 7 of PRD 0070, stacked on #361. The data-plane bridge that lets the consolidated sidecar apply each bottle's policy per request.
policy_resolver.py—PolicyResolverresolves a client's policy from the orchestrator'sPOST /resolvekeyed on(source_ip, identity_token), cached briefly (short TTL) so it isn't a round-trip per request;invalidate()drops an entry on teardown / live reload.403) →Noneso the caller denies; unreachable / unexpected status raises so the caller can fail closed too. Stdlib-only and free of bot-bottle imports → COPYable flat into the sidecar bundle.Scope note (honest): this is the sidecar-side client. Wiring it into the live egress mitmproxy addon (select
Configper client IP in the request path) and git-gate, plus routing all bottles' egress to the one shared sidecar, are the remaining data-plane pieces — a heavier change to the bundle's adversarial-input code, taken next.Re the slice-6 review note ("policy should be a structured type"): the resolved policy blob is exactly the egress
Configschema already defined inegress_addon_core(load_config), so it is structured at the point of consumption; the resolver stays format-agnostic (returns the blob) so git-gate/others can share it.Tests: resolve returns / caches / expires / invalidates;
403→ None (fail closed); other status + unreachable raise; missing policy → empty; posts source_ip + token. Full suite green.Merge order: #352 → #356 → #357 → #358 → #360 → #361 → this.
🤖 Generated with Claude Code
@@ -0,0 +49,4 @@self._ttl = ttlself._timeout = timeout# source_ip -> (fetched_at_monotonic, policy | None)self._cache: dict[str, tuple[float, str | None]] = {}@didericis-claude Should probably ignore the cache... think the policy resolver will be called infrequently enough and the speed is not important enough of a concern that the cache value here isn't really warranted. It's more important that we honor any revocations or agent changes/shutdowns that the orchestrator is aware of.
Agreed — dropped the cache in
de9da29.resolvenow hits the orchestrator every call, so a revocation / policy change / teardown the orchestrator knows about is honored immediately (no TTL staleness window on a security-relevant path). Also removedinvalidate(moot without a cache).Left a note in the docstring: if this ever becomes a hot path, add caching with orchestrator-driven invalidation (push on change), not a blind TTL — precisely so we never serve stale-permissive policy after a revocation.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.