Skip to content

Cloudflare Rules can now sign requests to private S3 and GCS buckets

New HMAC and SigV4 functions in the Rules language let you authenticate reads from private cloud storage without writing a Worker to compute the signature.

Source: Cloudflare

Cloudflare’s Rules language has gained cryptographic signing functions built for one specific job: authenticating reads from private Amazon S3 and Google Cloud Storage buckets. The new functions are hmac_md5(), hmac_sha1(), hmac_sha256() and hmac_sha512() for raw keyed digests, sign_sigv4_hmac_sha256() to derive a SigV4 signing key and return the signature in one call, format_date() for UTC timestamps, and encode_hex() to format a digest as hex.

They’re meant to run inside Request Header Transform Rules, setting headers like x-amz-date or x-goog-date on the fly:

format_date(http.request.timestamp.sec, "%Y%m%dT%H%M%SZ")

The HMAC and SigV4 functions need a Pro, Business or Enterprise plan. format_date() alone is free on every plan.

Why it matters: proxying a private S3 or GCS bucket through Cloudflare used to mean writing a Worker just to compute the SigV4 signature on each request. Doing it in a Transform Rule instead removes that Worker entirely for the simple case, one less thing to deploy and maintain for what is otherwise a static routing problem.

Share

Related reading

More from The Wire

All briefs