{"id":15715510,"url":"https://github.com/cloudflare/dmarc-email-worker","last_synced_at":"2025-04-19T19:04:37.407Z","repository":{"id":146146785,"uuid":"610848030","full_name":"cloudflare/dmarc-email-worker","owner":"cloudflare","description":"DMARC reports processor using Cloudflare Workers and Email Workers","archived":false,"fork":false,"pushed_at":"2024-10-01T14:27:20.000Z","size":87,"stargazers_count":115,"open_issues_count":5,"forks_count":17,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-03-21T13:58:20.708Z","etag":null,"topics":["cloudflare","dmarc","workers"],"latest_commit_sha":null,"homepage":"https://blog.cloudflare.com/how-we-built-dmarc-management/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudflare.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-07T15:50:06.000Z","updated_at":"2025-03-18T03:01:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"ced5a576-850a-4770-92e4-5c9b1c2fde15","html_url":"https://github.com/cloudflare/dmarc-email-worker","commit_stats":{"total_commits":13,"total_committers":6,"mean_commits":"2.1666666666666665","dds":0.6153846153846154,"last_synced_commit":"69a27115d8d6d9f66a7d5da3707912092edb1b7e"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflare%2Fdmarc-email-worker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflare%2Fdmarc-email-worker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflare%2Fdmarc-email-worker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflare%2Fdmarc-email-worker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudflare","download_url":"https://codeload.github.com/cloudflare/dmarc-email-worker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246180903,"owners_count":20736460,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloudflare","dmarc","workers"],"created_at":"2024-10-03T21:41:48.215Z","updated_at":"2025-03-29T12:03:39.752Z","avatar_url":"https://github.com/cloudflare.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dmarc-email-worker\n\nA Cloudflare worker script to process incoming DMARC reports, store them, and produce analytics.\n\nIt makes use of:\n\n- [Cloudflare Workers](https://workers.cloudflare.com/)\n- [Email Workers](https://developers.cloudflare.com/email-routing/email-workers/)\n- [R2](https://developers.cloudflare.com/r2/)\n- [Worker Analytics](https://developers.cloudflare.com/workers/analytics/)\n\nMore details on the [blog post](https://blog.cloudflare.com/how-we-built-dmarc-management/).\n\n## Install instructions\n\n1. Clone this repo\n1. Install dependencies with `npm install`\n1. Login to your Cloudflare account with `npx wrangler login`\n1. Ensure that the names of the R2 buckets used and Worker Analytics dataset are correct in `wrangler.toml`\n1. Run `npx wrangler publish` to publish the worker\n1. Configure an Email Routing rule to forward the email from a destinattion address to this worker `dmarc-email-worker`\n1. Add this address as RUA to your domain's DMARC record\n\n## Inspecting the data\n\nAfter obtaining the `account_id` and `token` from the [API Tokens](https://dash.cloudflare.com/profile/api-tokens) page, you can run the following query to get the DMARC reports:\n\n```bash\ncurl -X POST 'https://api.cloudflare.com/client/v4/accounts/\u003caccount_id\u003e/analytics_engine/sql' \\\n-H 'Authorization: Bearer \u003ctoken\u003e' \\\n-d 'SELECT\n    timestamp,\n    blob1 AS reportMetadataReportId,\n    blob2 AS reportMetadataOrgName,\n    toDateTime(double1) AS reportMetadataDateRangeBegin,\n    toDateTime(double2) AS reportMetadataDateRangeEnd,\n    blob3 AS reportMetadataError,\n    blob4 AS policyPublishedDomain,\n    double3 AS policyPublishedADKIM,\n    double4 AS policyPublishedASPF,\n    double5 AS policyPublishedP,\n    double6 AS policyPublishedSP,\n    double7 AS policyPublishedPct,\n    blob5 AS recordRowSourceIP,\n    toUInt32(double8) AS recordRowCount,\n    double9 AS recordRowPolicyEvaluatedDKIM,\n    double10 AS recordRowPolicyEvaluatedSPF,\n    double11 AS recordRowPolicyEvaluatedDisposition,\n    double12 AS recordRowPolicyEvaluatedReasonType,\n    blob6 AS recordIdentifiersEnvelopeTo,\n    blob7 AS recordIdentifiersHeaderFrom\nFROM dmarc_reports\nWHERE timestamp \u003e NOW() - INTERVAL '\\''24'\\'' DAY'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudflare%2Fdmarc-email-worker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudflare%2Fdmarc-email-worker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudflare%2Fdmarc-email-worker/lists"}