Repository navigation
migrate the context gatekeeper to kernel-owned observer tracking - #896
maxwellpeterson wants to merge 7 commits into
Conversation
|
LGTM! |
Preview:
|
- deprecate "use" sharing role
f4ef6da to
86a76a8
Compare
39113d9 to
d174765
Compare
|
LGTM! |
Eval resultsVerdict: ⚪ Unchanged. No task moved beyond what these runs can tell apart from noise.
Failed checks
|
🔬 Eval runs reviewPerformanceAgainst main, change-calendar passed 9/10 → 7/10 and chess 10/10 → 9/10; worker-logs stayed at 9/10 and every other task/model row passed, with ⚪ VERDICT: NO REGRESSION FROM THIS PRThe comparison is unchanged, and the candidate failures occur before any Context read, with no demonstrated connection to the diff’s migration of Context observation authorization into the kernel. TriageFailure modes
Tool errors
What to do
|
352ba74 to
d46273b
Compare
Stacked on #894 (and #881). Draft until those land.
Why
#881 moved observer bookkeeping into the overseer, but no gatekeeper uses it yet. This migrates the Context Library first.
Changes
Context gatekeeper (
packages/gatekeeper-context)ContextGatekeeper.describe()setssupportsObserverTracking. Every read goes throughauthorizeTrackedObservation()and reports the collections whose contents it revealed assubresources, one collection ID each. The binding only ever reads its own sharing domain, so the ID needs nothing else. Disclosure boundaries are unchanged:[], because its titles and counts are catalog metadata.ContextGatekeeper.verifyObserverAccess(observers, subresources)asks each observer'sContextVerifier.hasCollectionsAccess()about the collections. It allows only observers whose account can read every one now; a ragged answer allows nothing. The verifier itself is unchanged from main, and nothing is cached, so revocations apply at the next check.getHistoricalSubresources()exports everyobservedCollection:marker the gatekeeper-kit tracker left in the binding's storage. Pending markers are included, since their read may have been disclosed. The export is read-only, so the Workshop can ask again if the import doesn't commit.addObserver()throws. That refusal is one of the two ways the Workshop learns the gatekeeper has upgraded.removeObserver()retires the old tracker's registrations through the kit'sObserverTracker.removeObserver(), which is whatretireLegacyObserverRegistrationsasks for.ObservationGatewiring andCONTEXT_OBSERVER_DENIEDare removed. The Workshop's own denial is used, and it never names the collection.Integration tests (separate commit)
context-observer-upgrade.test.ts. It boots gatekeeper-context as built at mainfe3ce9fc3(legacy tracking), and two workspaces read a private collection each. It then upgrades the Worker in place with its storage kept, and checks both ways the Workshop can learn of the upgrade:addObserver(). They are refused with the Workshop's denial, which doesn't name the collection, and the action log shows "Imported earlier reads". Once the collection is everyone-viewable they are admitted, and the connection keeps reading as a tracked connection.authorizeTrackedObservation(), which switches that connection. The listing reports nothing, so only the imported record can refuse the collaborator, and it does.getHistoricalSubresources()returns[], both refusals fail; each was checked locally on its own.build-upgrade-base.tsnow builds a list of bases (Google plus Context). The redeploy-and-wait logic moved fromgoogle-fake.tsintoharness.tsasredeployWorker(); Google's upgrade suite uses it unchanged.context-sharing.test.tsuses shared fixtures (context-fixtures.ts). It now also checks that a refused collaborator is admitted once the collection becomes readable to them.Docs: the Context row and §10 opener in
docs/observers.md, the observer section ofplans/context-collection-sharing.md, the integration-testing upgrade notes, and thewrite-gatekeeperskill, which now points at Context as the first shipping example.Behavior notes
authorizeTrackedObservation()doesn't exist, so reads fail closed instead of being disclosed unchecked. Tracking is never downgraded, so rolling Context back to a legacy build after a workspace has switched makes the kernel refuse that connection's legacy reads.Verification
pnpm --filter @gadgets/gatekeeper-context test:run: 94 workerd + 95 node tests pass.pnpm --filter @gadgets/integration-tests test:run: 46 files, 216 tests pass (plus 1 expected fail), including the new upgrade suite and the Google upgrade suite.pnpm lintpasses.