Add callback support to kryptoEcMiddleware
#1303
Merged
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.
Problem
Sometimes we see a browser able to make requests to
http://localhost
, but unable to meaningfully work with the response. This breaks agent detection in the device trust flow.Solution
One solution is to setup a simple callback. The intent here, is to allow K2 to set a URL to post back to, and then
kryptoEcMiddleware
can post the response to it.This should be reasonable secure -- the callback URL is inside the krypto box, and the response is the same as what we'd send via PNG. eg: it's all opaque crypto data. There are a couple of small exceptions...
I first tried implementing this in middleware, but it was messy. First, because the url comes out of the box, so that has to be passed from the inner layer up to the outer layer. Second, because the outer layer works with readers, so there's a bunch of extra io teeing. It's much simpler this way.