{"id":36919176,"url":"https://github.com/donseba/go-csrf","last_synced_at":"2026-01-12T16:13:13.371Z","repository":{"id":142544501,"uuid":"612980896","full_name":"donseba/go-csrf","owner":"donseba","description":"Basic CSRF in golang","archived":false,"fork":false,"pushed_at":"2023-03-12T22:30:08.000Z","size":4,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-01T22:12:11.753Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","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/donseba.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-12T14:58:21.000Z","updated_at":"2024-02-20T12:14:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"773e9b9a-69f0-48c9-b8da-c99da5203707","html_url":"https://github.com/donseba/go-csrf","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/donseba/go-csrf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donseba%2Fgo-csrf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donseba%2Fgo-csrf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donseba%2Fgo-csrf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donseba%2Fgo-csrf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/donseba","download_url":"https://codeload.github.com/donseba/go-csrf/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donseba%2Fgo-csrf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28342219,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T15:50:39.657Z","status":"ssl_error","status_checked_at":"2026-01-12T15:49:49.297Z","response_time":98,"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":[],"created_at":"2026-01-12T16:13:13.295Z","updated_at":"2026-01-12T16:13:13.356Z","avatar_url":"https://github.com/donseba.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-csrf\n\n\nBasic CSRF handling in golang. There are quite a few versions on csrf handling, but I needed something to cover the bare minimum.\n\n```go\npackage example \n\nimport (\n\t\"net/http\"\n\t\n\t\"github.com/donseba/go-csrf\"\n)\n\nfunc exampleFormHandler(w http.ResponseWriter, r *http.Request) {\n    c := csrf.New()\n    // the token should be generated on the page that invokes the form\n    token := c.GenerateToken()\n    \n    // in this example we are going to set the csrf token into a cookie \n    // you could also pass the token to the form to post the token, and store the token in a session handler.\n    // most session handlers however also use a cookie with (no)sql backend.\n    c.SetCookie(w,token)\n    \n    // use the middleware. which can be called using `csrf.New().Middleware()` and wrap it \n    // around the handler(s) that need validation. Easiest way is to use it at the root. \n    // with chi you can do this. \n    r := chi.NewRouter()\n    r.Use(csrf.New().Middleware)\n}\n\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdonseba%2Fgo-csrf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdonseba%2Fgo-csrf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdonseba%2Fgo-csrf/lists"}