get unverified DID from Issuer instead of Subject#215
get unverified DID from Issuer instead of Subject#215uniphil wants to merge 2 commits intoalnkesq:mainfrom
Conversation
[Inter-Service Authentication (JWT)](https://atproto.com/specs/xrpc) from the XRPC doc specifies that the user's DID is passed in the `iss` (issuer) field. The JWT from the bearer token that the client receives from the PDS happens to put it in `sub` (subject) but this token is meant to be opaque to clients and confidential to the PDS. I don't think third-party appviews can ever use that token safely, since only the PDS can verify it. This change makes AppViewLite look instead for `Issuer` which should make xrpc-proxied requests _work_, but note that it's still not verifying the JWT, so these tokens can be trivially forged. Assuming this works, the token can be verified with the users's pubkey, and then this will be closer to being safe.
|
I logged into my PDS, and the JWT I got back had Subject=(my did) and Issuer=null. Additionally, |
|
the JWTs your client (social-app/deer/) gets from your PDS are opaque bearer tokens meant only for the PDS
so i think it's a few problems to send this token to an AppViewLite instance:
Instead, clients should proxy requests through their PDS to the intended AppView (eg setting the This is where It does make it really annoying for local app development, since your client can't just make a local network request to the AppView -- it goes through the PDS so you need to have a service DID resolveable that points back to a PDS-accessible dev instance. soooo needs ngrok, tailscale funnel, or cloudflare's thing, or dynamic dns with some router port forwarding 😭... plus some public DNS records to resolve the did:web for the local dev appview into that tunnel. i'm not sure if someone has made a good helper for this yet. feels like a locally-running dummy PDS that just does local appview proxying might be enough. i think i'm going to capture some forwarded requests and just CURL them at the xrpc endpoints directly for now, skipping social app entirely to debug appview. |
|
As a stopgap measure, the DID is now fetched from |
Inter-Service Authentication (JWT) from the XRPC doc specifies that the user's DID is passed in the
iss(issuer) field. The JWT from the bearer token that the client receives from the PDS happens to put it insub(subject) but this token is meant to be opaque to clients and confidential to the PDS. I don't think third-party appviews can ever use that token safely, since only the PDS can verify it.This change makes AppViewLite look instead for
Issuerwhich should make xrpc-proxied requests work, but note that it's still not verifying the JWT, so these tokens can be trivially forged.Assuming this works, the token can be verified with the users's pubkey, and then this will be closer to being safe.