-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: ESSR protected client APIs #351
base: main
Are you sure you want to change the base?
Conversation
WebOfTrust/signify-ts#304 created on Signify side |
} | ||
|
||
for key, value in headers.items(): | ||
key = "HTTP_" + key.replace("-", "_").upper() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does it need this replacement, is it a fix for another issue with the headers we're producing/receiving?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's how WSGI (falcon) expects it in the environ that builds the request. The headers in the actual HTTP request still have dashes like normal.
hio also does it: https://github.com/ioflo/hio/blob/main/src/hio/core/http/serving.py#L737-L740
if not ckever.verfers[0].verify(sig=cig.raw, ser=json.dumps(payload, separators=(",", ":")).encode("utf-8")): | ||
raise kering.AuthNError("Signature invalid") | ||
|
||
plaintext = agent.agentHab.decrypt(ser=cipher).decode("utf-8") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename to httpRequest for clarity
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #351 +/- ##
==========================================
+ Coverage 93.71% 93.92% +0.20%
==========================================
Files 37 37
Lines 8293 8491 +198
==========================================
+ Hits 7772 7975 +203
+ Misses 521 516 -5 ☔ View full report in Codecov by Sentry. |
src/keria/core/authing.py
Outdated
body = response.data.decode("utf-8") if response.data else "" | ||
|
||
if response.text: | ||
body = response.text.strip() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
text
sometimes used for e.g. 404 responses. None of the signify tests caught this. Need to at least expand the tests in this PR to cover different all the cases for bodies. todo.
This replaces the current RFC-9421 signed headers between Signify and KERIA with ESSR. Beyond confidentiality, it also resolves other issues from before such as unsigned query params and bodies. (#287)
The unsigned HTTP request from the client is converted to a HTTP bytestream and embedded in an ESSR payload. This payload becomes the body of a wrapper HTTP request for the
"/"
path - so tunneled via ESSR. The wrapper could be handled by pure TCP but for now this works quite nicely in the Falcon middlewares with minimal changes.Like the keripy ESSR parser, the commitment to unsigned HTTP request is done by taking a digest:
I have written the corresponding code in Signify and all integration tests pass. I will create a Signify PR tomorrow. They should probably merge together.