Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
This implementation aims to be usecase agnostic. As such it accepts the
component pieces of a request rather than a full opinionated request object
like httpx.Request
.
https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html
from aws4 import generate_challenge, validate_challenge
payload = "<extract content from request>"
challenge = generate_challenge(
method=request.method,
url=request.url,
headers=request.headers,
content=payload.decode("utf-8"),
)
secret_access_key = <load secret key using the challenge.access_key_id>
validate_challenge(challenge, secret_key.secret_access_key)
An example of an httpx AWS4 request signing. In this example the Authorization
header is injected into request.headers
from datetime import datetime, timezone
import aws4
service = "s3"
region = "us-east-1"
access_key_id = "my-access-key-id"
secret_access_key = "my-secret-access-key"
def http_aws4_auth(request: httpx.Request):
dt = datetime.now(tz=timezone.utc)
request.headers["x-amz-date"] = aws4.to_amz_date(dt)
request.headers["host"] = request.url.netloc.decode("utf-8")
body = request.content.decode("utf-8")
if body:
request.headers["Content-Length"] = str(len(body))
aws4.sign_request(
service,
request.method,
request.url,
region,
request.headers,
body,
access_key_id,
secret_access_key,
dt,
)
with httpx.Client() as client:
r = client.request(
url="http://localhost",
auth=auth,
)
Thanks to @ozzzzz and @ivanmisic for work on the initial httpx/fastapi implementations this was extracted from.
FAQs
Usecase agnostic implementation of AWS4 signing schema.
We found that auth-aws4 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.