Add WebFetch access with short-lived device delegation - #73
Merged
Merged
Conversation
Daily-AC
marked this pull request as ready for review
September 16, 2026 13:14
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.
What changes
Web chat AIs that can fetch URLs can now request temporary access to selected wanctl devices, wait for owner approval in the existing portal, and call one-shot commands or text-file operations through an opt-in
/webfetchadapter. Authorization remains in wanctl: device scope and expiration are enforced by the relay, while pairing, rules and operation approval remain on the controlled device.The owner chooses up to 16 owned devices and a 1–60 minute duration. Delegated credentials cannot enroll devices, administer them, mint credentials, or reuse another credential's session. Both carriers preserve scope, revalidate active leases, and check again after a delayed human approval. Persistent jobs deduplicate repeated GET requests; interrupted outcomes are not automatically rerun. Results are also unavailable after revocation.
The adapter uses a distinct controller identity per grant and never executes through the privileged portal identity. Browser tickets and relay credentials are stored only as hashes; raw relay credentials never enter AI-facing URLs. The trusted adapter sees its own plaintext, as documented. Inactive content is cleaned up after 24 hours without allowing old browser tickets to recreate grants.
Fixes #72.
Validation
go test ./...with real PostgreSQL; tagged test/build/vet checks and focused race tests for delegation, all four carrier combinations, expiry/revocation, late approvals, audit attribution and client cancellation.Deployment and compatibility
Disabled by default. Requires PostgreSQL and explicit WebFetch seed/public-origin/portal-origin configuration; no existing production deployment was changed. Relay, portal and controlled agents must be upgraded together for this feature: older agents reject delegated sessions.
Before rollback to a pre-feature relay, revoke all delegated tokens; old namespace-only resolvers do not understand their constraints. Revocation closes connected one-shot sessions but cannot undo completed effects or guarantee cleanup of deliberately detached processes. See operator documentation and 中文说明.