{"id":18368148,"url":"https://github.com/thinkjs/think-csrf","last_synced_at":"2025-10-04T14:15:52.079Z","repository":{"id":73609531,"uuid":"92124526","full_name":"thinkjs/think-csrf","owner":"thinkjs","description":"CSRF for ThinkJS 3.0","archived":false,"fork":false,"pushed_at":"2021-06-30T23:51:22.000Z","size":11,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-01-24T11:35:03.954Z","etag":null,"topics":["csrf","think-middleware","thinkjs3"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/thinkjs.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":"2017-05-23T03:23:11.000Z","updated_at":"2021-06-30T23:51:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"d9a2d74f-c6b3-40e0-ad00-14f133bda6b2","html_url":"https://github.com/thinkjs/think-csrf","commit_stats":{"total_commits":19,"total_committers":2,"mean_commits":9.5,"dds":"0.10526315789473684","last_synced_commit":"375debf862f89ac79b4ab87f38cb116741424f0a"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkjs%2Fthink-csrf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkjs%2Fthink-csrf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkjs%2Fthink-csrf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkjs%2Fthink-csrf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thinkjs","download_url":"https://codeload.github.com/thinkjs/think-csrf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239054534,"owners_count":19574156,"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":["csrf","think-middleware","thinkjs3"],"created_at":"2024-11-05T23:24:48.643Z","updated_at":"2025-10-04T14:15:47.030Z","avatar_url":"https://github.com/thinkjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# think-csrf\n[![npm](https://img.shields.io/npm/v/think-csrf.svg)](https://www.npmjs.com/package/think-csrf)\n[![Build Status](https://travis-ci.org/thinkjs/think-csrf.svg?branch=master)](https://travis-ci.org/thinkjs/think-csrf)\n[![Coverage Status](https://coveralls.io/repos/github/thinkjs/think-csrf/badge.svg?branch=master)](https://coveralls.io/github/thinkjs/think-csrf?branch=master)\n\nCSRF for Thinkjs 3.0\n\n## Install\n\n```\n$ npm install think-csrf --save\n```\n\n## How to use\n\nconfig file `src/config/middleware.js`\n\n```javascript\nconst csrf = require('think-csrf');\n\nmodule.exports = [{\n  handle: csrf,\n  options: {\n    session_name: 'csrf_token',\n    form_name: '_csrf',\n    header_name: 'x-csrf-token'\n  }\n}];\n```\n\n**Usage**\n\n`ctx.csrf` getter for CSRF token\n\n## Options\n\n| Name | Description | Default | \n| :------ | :------ | :------ |\n| `session_name` | csrf token's session name | `'csrf_token'` |\n| `form_name` | request csrf token's name in body and query | `'_csrf'` |\n| `header_name` | request csrf token's name in header | `'x-csrf-token'` |\n| `errno` | error status | `403` |\n| `errmsg` | error message | `'invalid csrf token'` |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinkjs%2Fthink-csrf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthinkjs%2Fthink-csrf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinkjs%2Fthink-csrf/lists"}