multi: extract session ID from context #1045
Draft
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.
Currently, in our RPC interceptors, we use the macaroon data in the request to extract the session ID. This is not ideal since we are using the root key ID of the macaroon and this can cause issues because sometimes we also store the first 4 bytes of an account ID in there. Or it could just be a totally unrelated macaroon that happens to have root key ID that matches with one of our session IDs.
We should instead use a much more reliable way of passing along session ID info: we can do this because any request that comes in via a session, we can intercept and add the session ID to the grpc metadata for the call via the context. This will then be included in the ctx info that LND gets when which interceptors to send the request too. So LND can then send this metadata info back to lit via the
lnrpc.RPCMiddlewareRequest
message (see PR here), LiT can then extract the session ID in a much more reliable way during request interception.Depends on: