Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Python implementation of the AWS4 compatible Escher HTTP request signing protocol.
Escher helps you creating secure HTTP requests (for APIs) by signing HTTP(s) requests. It's both a server side and client side implementation. The status is work in progress.
The algorithm is based on Amazon's AWS Signature Version 4, but we have generalized and extended it.
More details are available at escherauth.io.
Escher works by calculating a cryptographic signature of your request, and adding it (and other authentication information) to said request.
Usually you will want to add the authentication information to the request by appending extra headers to it.
from escherauth import Escher
request = {
'method': 'POST',
'url': '/',
'host': 'example.com',
'headers': [
['X-Foo', 'bar'],
],
'body': '{"this_is": "a_request_body"}',
}
escher = Escher('YOUR_ACCESS_KEY_ID', 'YOUR SECRET', 'example/credential/scope')
signed_request = escher.sign_request(request)
from pprint import pprint
pprint(signed_request)
Signing a Requests request:
import requests
from escherauth import EscherRequestsAuth
auth = EscherRequestsAuth('YOUR_ACCESS_KEY_ID', 'YOUR SECRET', 'example/credential/scope')
response = requests.post('https://httpbin.org/post', json={'this_is': 'a_request_body'}, auth=auth)
from pprint import pprint
pprint(response.json())
In some cases you may want to send authenticated requests from a context where you cannot modify the request headers, e.g. when embedding an API generated iframe.
You can however generate a presigned URL, where the authentication information is added to the query string.
from escherauth import Escher
escher = Escher('YOUR_ACCESS_KEY_ID', 'YOUR SECRET', 'example/credential/scope')
presigned_url = escher.presign_url('http://example.com/', expires=300)
print(presigned_url)
You can validate a request signed by the methods described above. For that you will need a database of the access keys and secrets of your clients.
from escherauth import Escher, EscherException
escher = Escher('', '', 'example/credential/scope')
signed_request = {
'body': '{"this_is": "a_request_body"}',
'headers': [
['Host', 'example.com'],
['X-Escher-Date', '20240227T121443Z'],
['X-Escher-Auth', 'ESR-HMAC-SHA256 Credential=YOUR_ACCESS_KEY_ID/20240227/example/credential/scope, SignedHeaders=host;x-escher-date, Signature=5febb099193b8e6c4027ff810e0faa5bc8a275efb46f2d5c1af8810f4332c4cb'],
],
'method': 'POST',
'url': '/',
}
key_db = {
'ACCESS_KEY_OF_CLIENT_1': 'SECRET OF CLIENT 1',
'ACCESS_KEY_OF_CLIENT_42': 'SECRET OF CLIENT 42',
}
try:
escher.authenticate(signed_request, key_db)
print('OK')
except EscherException as e:
print(f'The validation failed: {e}')
FAQs
Python implementation of the AWS4 compatible Escher HTTP request signing protocol.
We found that escherauth demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.