{"id":15941753,"url":"https://github.com/benwr/origin_check","last_synced_at":"2026-01-27T15:03:02.413Z","repository":{"id":216603594,"uuid":"741755775","full_name":"benwr/origin_check","owner":"benwr","description":"Stateless / zero-configuration Tower middleware that checks the Origin and Referer, as a minimal CSRF mitigation","archived":false,"fork":false,"pushed_at":"2024-10-07T09:26:52.000Z","size":37,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-16T03:29:31.322Z","etag":null,"topics":["axum","csrf","security","tower","web"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/benwr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-11T03:28:38.000Z","updated_at":"2024-01-13T15:35:12.000Z","dependencies_parsed_at":"2024-01-12T12:58:42.940Z","dependency_job_id":"a54e34f4-ea8b-4ebb-96db-ccbfd817e73a","html_url":"https://github.com/benwr/origin_check","commit_stats":null,"previous_names":["benwr/origin_check"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/benwr/origin_check","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benwr%2Forigin_check","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benwr%2Forigin_check/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benwr%2Forigin_check/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benwr%2Forigin_check/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benwr","download_url":"https://codeload.github.com/benwr/origin_check/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benwr%2Forigin_check/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28815385,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T12:25:15.069Z","status":"ssl_error","status_checked_at":"2026-01-27T12:25:05.297Z","response_time":168,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["axum","csrf","security","tower","web"],"created_at":"2024-10-07T07:20:45.393Z","updated_at":"2026-01-27T15:03:02.375Z","avatar_url":"https://github.com/benwr.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# origin\\_check\n\n[![Crates.io Version](https://img.shields.io/crates/v/origin_check)](https://crates.io/crates/origin_check)\n[![docs.rs](https://img.shields.io/docsrs/origin_check)](https://docs.rs/origin_check/latest/origin_check/)\n[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/benwr/origin_check/rust.yml)](https://github.com/benwr/origin_check)\n\n\nA minimal `Tower` middleware layer for mitigating CSRF attacks.\n\nExamines the `Origin` or `Referer` header of incoming requests, and compares\nit to the target `Host` and `URI`.\n\n```\nlet (mock_service, _) = tower_test::mock::spawn::\u003chttp::Request\u003c()\u003e, ()\u003e();\nlet csrf_proof_service = origin_check::OriginCheck::new(mock_service);\n```\n\n# IMPORTANT NOTES:\n\nThis crate makes several assumptions that *must all be true for it to be a good\nchoice for you:*\n\n1. Your site is accessed exclusively in \"secure contexts\", like over `https` or\n   on `localhost`.\n2. State changes are *never performed* in response to `GET` or `HEAD` requests.\n   Such requests are _always allowed_ by this service, regardless of CSRF\n   indicators.\n3. All other requests _should fail_ if the hostname and port of the `Origin` or\n   `Referer` does not _exactly_ match the `Host`. This means that you cannot,\n   e.g., send POST requests from one subdomain to another, or from one port to\n   another.\n4. Your users' browsers will set the `Origin` or `Referer` header on\n   non-`GET`/-`HEAD` requests, when those requests are initiated by your site.\n   In order to ensure this, be careful that the `Referrer-Policy` for your site\n   is not set to `no-referrer`.\n\nYou probably want to set `SameSite=Strict` or `SameSite=Lax` on any\nauthentication cookies, as additional protection against CSRF.\n\nYou likely also want to set `X-Frame-Options: DENY` for your site by default,\nto prevent clickjacking, which is a distinct but related problem to CSRF.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenwr%2Forigin_check","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenwr%2Forigin_check","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenwr%2Forigin_check/lists"}