{"id":23503739,"url":"https://github.com/xwp/cloudflare-worker-content-security-policy-handler","last_synced_at":"2025-05-05T16:26:10.284Z","repository":{"id":232816575,"uuid":"785172323","full_name":"xwp/cloudflare-worker-content-security-policy-handler","owner":"xwp","description":"Cloudflare content security policy handler","archived":false,"fork":false,"pushed_at":"2024-10-05T04:38:37.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-30T13:03:35.445Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xwp.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-04-11T10:47:34.000Z","updated_at":"2024-10-05T04:38:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"6680b24a-7f8d-487a-acc0-f13eae9f0b53","html_url":"https://github.com/xwp/cloudflare-worker-content-security-policy-handler","commit_stats":null,"previous_names":["patelutkarsh/cf-worker-content-security-policy-handler","xwp/cloudflare-worker-content-security-policy-handler"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xwp%2Fcloudflare-worker-content-security-policy-handler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xwp%2Fcloudflare-worker-content-security-policy-handler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xwp%2Fcloudflare-worker-content-security-policy-handler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xwp%2Fcloudflare-worker-content-security-policy-handler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xwp","download_url":"https://codeload.github.com/xwp/cloudflare-worker-content-security-policy-handler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252532876,"owners_count":21763493,"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":[],"created_at":"2024-12-25T08:31:05.660Z","updated_at":"2025-05-05T16:26:10.265Z","avatar_url":"https://github.com/xwp.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cloudflare Worker CSP Violation Handler\n\nThis project is a Cloudflare Worker that handles Content Security Policy (CSP) header violations and sends email notifications using Worker Cron. It uses Mailgun to send the emails.\n\n## Prerequisites\n\nBefore getting started, make sure you have the following:\n\n- A Cloudflare account\n- A Mailgun account and API key.\n- [Wrangler](https://developers.cloudflare.com/workers/wrangler/install-and-update/) installed.\n\n## Configuration\n\n1. Clone this repository:\n\n    ```bash\n    git clone https://github.com/xwp/cloudflare-worker-content-security-policy-handler.git\n    ```\n\n2. Install the project dependencies:\n\n    ```bash\n    cd cf-worker-content-security-policy-handler\n    npm install\n    ```\n\n3. Create table:\n\n    ```\n    npx wrangler d1 create kv\n    ```\n\n    Put the output in wranger.toml file as mentioned in step below replacing binding with `d1`.\n\n    Create table in the database with the above SQL.\n\n    ```\n    npx wrangler d1 execute kv --local --file=./schema.sql\n    ```\n\n4. Update the `wrangler.toml` file with your configuration details.\n\n    Update cron schedule as needed.\n\n    Update mailgun API key, from email address, to email address, and mailgun domain.\n\n    ```toml\n    [[d1_databases]]\n    binding = \"d1\"\n    database_name = \"{updateme}\"\n    database_id = \"{update_me}\"\n\n    [triggers]\n    crons = [\"0 0 * * 2\"]\n\n    [vars]\n    MAILGUN_API_KEY = \"\"\n    FROM_EMAIL_ADDRESS = \"\"\n    TO_EMAIL_ADDRESS = \"\"\n    MAILGUN_DOMAIN = \"\"\n    ```\n\n## Deploying the Worker\n\nTo deploy the worker, run the following command:\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxwp%2Fcloudflare-worker-content-security-policy-handler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxwp%2Fcloudflare-worker-content-security-policy-handler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxwp%2Fcloudflare-worker-content-security-policy-handler/lists"}