Skip to content

Lit Actions: expose the requester's IP address (Lit.Actions.requesterIpAddress()) #630

Description

@clawdbot-glitch003

Summary

Add a runtime op that returns the IP address of the HTTP client that invoked the current action, e.g.

const ip = await Lit.Actions.requesterIpAddress(); // "203.0.113.7"

Motivation

We're building a programmable credential-access product (a Turnkey "Secrets" clone — see plans/programmable-credential-access.md) as an app on top of Chipotle rather than inside it. The app is control-plane only: a pinned reader action decrypts a secret and returns it directly to the calling agent, gated by an app-signed grant. Today the action has no information about who called it beyond "some usage key in the group", so it cannot enforce caller-scoped policy such as:

  • "this credential may only be read from the agent fleet's egress CIDR"
  • "bind this grant to the IP it was issued to" (blunts grant theft/replay)
  • IP-based rate limiting or geo-fencing inside the action

Rather than adding an enforced per-credential allow_net / egress allowlist to the runtime (bigger change, discussed and deferred), the simplest primitive is to expose the requester IP and let the action enforce whatever it wants in JS.

Proposed implementation

  • lit-api-server: capture req.client_ip() in the lit_action / lit_binary_action handlers and pass it into the execution request (new optional field on ExecuteJsRequest in lit-actions/grpc/schema, alongside ipfs_id).
  • lit-actions: add op_requester_ip_address (sync op reading from the per-execution state) + a Lit.Actions.requesterIpAddress() binding in ext/js/02_litActionsSDK.js; for the gVisor lane, expose it as a reserved env var (e.g. LIT_REQUESTER_IP) via the existing RESERVED_ENV machinery in gvisor-server/src/supervisor.rs.
  • Return null/empty when unavailable rather than throwing.

Trust model note

client_ip() honours Rocket's ip_header (default X-Real-IP) and otherwise falls back to the socket peer. Behind dstack-ingress the peer is always the proxy, so this is only meaningful if the ingress overwrites X-Real-IP with $remote_addr (same caveat already documented in lit-api-server/src/core/v1/guards/rate_limit.rs). Docs for the new op should state that plainly.

Related (optional follow-up)

A sibling op Lit.Actions.requesterApiKeyHash() (keccak256 of the calling usage key, which the server already computes for on-chain authz) would let actions bind grants to a specific agent identity, not just its IP. Worth doing at the same time if cheap — same plumbing.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions