{"id":13614481,"url":"https://github.com/tinyhttp/malibu","last_synced_at":"2025-09-07T12:37:16.611Z","repository":{"id":47167060,"uuid":"377820797","full_name":"tinyhttp/malibu","owner":"tinyhttp","description":"🏄 Framework-agnostic CSRF middleware for modern Node.js","archived":false,"fork":false,"pushed_at":"2025-02-24T02:16:32.000Z","size":444,"stargazers_count":166,"open_issues_count":0,"forks_count":6,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-07-01T10:49:14.505Z","etag":null,"topics":["csrf","esm","http","middleware","nodejs","security","session","tinyhttp"],"latest_commit_sha":null,"homepage":"https://tinyhttp.v1rtl.site/mw/malibu","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/tinyhttp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","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},"funding":{"ko_fi":"aldy505","github":["aldy505"]}},"created_at":"2021-06-17T12:20:25.000Z","updated_at":"2025-06-28T04:32:07.000Z","dependencies_parsed_at":"2022-09-19T03:10:14.988Z","dependency_job_id":"8fd8ecc4-a63f-4ac8-877f-424ea2fdc467","html_url":"https://github.com/tinyhttp/malibu","commit_stats":{"total_commits":94,"total_committers":8,"mean_commits":11.75,"dds":0.5851063829787234,"last_synced_commit":"bb9ddf625797a5b5f9e12458e5fb42ef1a037f82"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/tinyhttp/malibu","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinyhttp%2Fmalibu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinyhttp%2Fmalibu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinyhttp%2Fmalibu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinyhttp%2Fmalibu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tinyhttp","download_url":"https://codeload.github.com/tinyhttp/malibu/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinyhttp%2Fmalibu/sbom","scorecard":{"id":887532,"data":{"date":"2025-08-11","repo":{"name":"github.com/tinyhttp/malibu","commit":"eaaf32905a13b8262b49fd5624a44a2f9cc7f741"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Code-Review","score":1,"reason":"Found 2/18 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/tinyhttp/malibu/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/tinyhttp/malibu/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/tinyhttp/malibu/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:34: update your workflow using https://app.stepsecurity.io/secureworkflow/tinyhttp/malibu/ci.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 15 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"11 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-67mh-4wv8-2f99","Warn: Project is vulnerable to: GHSA-76c9-3jph-rj3q","Warn: Project is vulnerable to: GHSA-vg6x-rcgg-rjx6","Warn: Project is vulnerable to: GHSA-x574-m823-4x7w","Warn: Project is vulnerable to: GHSA-4r4m-qw57-chr8","Warn: Project is vulnerable to: GHSA-xcj6-pq6g-qj4x","Warn: Project is vulnerable to: GHSA-356w-63v5-8wf4","Warn: Project is vulnerable to: GHSA-859w-5945-r5v3","Warn: Project is vulnerable to: GHSA-9crc-q9x8-hgqq"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-24T10:33:35.116Z","repository_id":47167060,"created_at":"2025-08-24T10:33:35.116Z","updated_at":"2025-08-24T10:33:35.116Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274039396,"owners_count":25211901,"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","status":"online","status_checked_at":"2025-09-07T02:00:09.463Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["csrf","esm","http","middleware","nodejs","security","session","tinyhttp"],"created_at":"2024-08-01T20:01:01.989Z","updated_at":"2025-09-07T12:37:16.523Z","avatar_url":"https://github.com/tinyhttp.png","language":"TypeScript","readme":"\u003cdiv align=\"center\"\u003e\n\u003cbr /\u003e\u003cbr /\u003e\n\u003cimg align=\"center\" width=\"600px\" src=\"https://raw.githubusercontent.com/tinyhttp/malibu/master/logo.svg\" alt=\"Malibu\" /\u003e\n\u003cbr /\u003e\u003cbr /\u003e\n\n[![npm](https://img.shields.io/npm/v/malibu?style=for-the-badge\u0026logo=npm\u0026label=\u0026color=26B0A0)](https://npmjs.com/package/malibu) [![npm](https://img.shields.io/npm/dt/malibu?style=for-the-badge\u0026color=26B0A0)](https://npmjs.com/package/malibu) [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/tinyhttp/malibu/ci.yml?branch=master\u0026label=\u0026logo=github\u0026style=for-the-badge\u0026color=26B0A0)](https://github.com/tinyhttp/malibu/actions) [![Coveralls](https://img.shields.io/coveralls/github/tinyhttp/malibu?style=for-the-badge\u0026color=26B0A0)](https://coveralls.io/github/tinyhttp/malibu) [![Code Quality](https://img.shields.io/codefactor/grade/github/tinyhttp/malibu?style=for-the-badge\u0026color=26B0A0)](https://www.codefactor.io/repository/github/tinyhttp/malibu)\n\n\u003c/div\u003e\n\nThis middleware helps web developers fight [CSRF](https://en.wikipedia.org/wiki/Cross-site_request_forgery) attacks. Bear in mind, by solely using this middleware, we can't guarantee your app will be free from CSRF attacks. Refer to [CSRF Prevention Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html) and [pillarjs/understanding-csrf](https://github.com/pillarjs/understanding-csrf) for more details.\n\n* ⚡ Framework agnostic (works with Express, Tinyhttp, Polka, and more!)\n* ✨ Native ESM (No CommonJS support)\n* 🛠 Typescript typings out of the box\n* 🚀 No legacy dependencies\n\n## Install\n\n```\npnpm i malibu\n```\n\n## Usage\n\nLike all CSRF plugins, it depends on either Cookie Parser or Session middleware.\n\n```js\nimport { App } from '@tinyhttp/app'\nimport { cookieParser } from '@tinyhttp/cookie-parser'\nimport { csrf } from 'malibu'\n\nconst app = new App()\n\nconst csrfProtection = csrf()\napp.use(cookieParser())\n\n// this lets you acquire CSRF token on response body\n// you also have CSRF token on your cookies as _csrf\napp.get('/', csrfProtection, (req, res) =\u003e {\n  res.status(200).json({ token: req.csrfToken() })\n})\n\n// you may only access this if you give a previously acquired CSRF token\napp.post('/', csrfProtection, (req, res) =\u003e {\n  res.status(200).json({ message: 'hello' })\n})\n```\n\nFor signed cookies:\n\n```js\nconst app = new App()\n\nconst csrfProtection = csrf({ cookie: { signed: true } })\napp.use(cookieParser('secret key'))\n\n// this lets you acquire CSRF token on the response body\n// you also have a CSRF token on your cookies as _csrf\napp.get('/', csrfProtection, (req, res) =\u003e {\n  res.status(200).json({ token: req.csrfToken() })\n})\n\n// you may only access this if you give a previously acquired CSRF token\napp.post('/', csrfProtection, (req, res) =\u003e {\n  res.status(200).json({ message: 'hello' })\n})\n```\n\nWith [express-session](https://github.com/expressjs/session):\n\n```js\nimport { App } from '@tinyhttp/app'\nimport session from 'express-session'\nimport { csrf } from 'malibu'\n\nconst app = new App()\n\nconst csrfProtection = csrf({ middleware: 'session' })\napp.use(session({ secret: 'secret key', resave: false, saveUninitialized: false }))\n\n// this lets you acquire CSRF token on response body\napp.get('/', csrfProtection, (req, res) =\u003e {\n  res.status(200).json({ token: req.csrfToken() })\n})\n\n// you may only access this if you give a previously acquired CSRF token\napp.post('/', csrfProtection, (req, res) =\u003e {\n  res.status(200).json({ message: 'hello' })\n})\n```\n\nFor detailed example, please refer to [examples](https://github.com/tinyhttp/tinyhttp/tree/master/examples/csrf)\n\n## Options\n\n| Name         | Type                    | Default                                                                                                                                           | Description                                                                                                                                                                                                                                                                                    |\n| ------------ | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| middleware   | `string`                | `cookie`                                                                                                                                          | Specifies which middleware to look for. Available options are `cookie` and `session`                                                                                                                                                                                                           |\n| cookie       | `CookieOptions`         | `{ signed: false, key: '_csrf', path: '/' }`                                                                                                      | `signed` specifies whether the cookie is signed or unsigned, `key` specifies to the cookie key, `path` specifies the domain of the cookie. For other options please refer to [@tinyhttp/cookie serializer options](https://github.com/tinyhttp/tinyhttp/tree/master/packages/cookie#options-1) |\n| sessionKey   | `string`                | `session`                                                                                                                                         | Specifies session key name                                                                                                                                                                                                                                                                     |\n| value        | `(req: Request) =\u003e any` | `req.body._csrf, req.query._csrf, req.headers[\"csrf-token\"], req.headers[\"xsrf-token\"], req.headers[\"x-csrf-token\"], req.headers[\"x-xsrf-token\"]` | Specifies where to look for the CSRF token                                                                                                                                                                                                                                                     |\n| ignoreMethod | `Array\u003cHTTPMethod\u003e`     | `[\"GET\", \"HEAD\", \"OPTIONS\"]`                                                                                                                      | Specifies the HTTP Method in which CSRF protection will be disabled                                                                                                                                                                                                                            |\n| saltLength   | `number`                | `8`                                                                                                                                               | Specifies the salt length for CSRF token                                                                                                                                                                                                                                                       |\n| secretLength | `number`                | `18`                                                                                                                                              | Specifies the secret length for CSRF Token                                                                                                                                                                                                                                                     |\n\n## Why \"malibu\"?\n\nIt's one variation of a longboard used in surfing. It's a 60's style longboard, made with heavy glass, long parallel 50/50 rails, and a deep single fin. Made especially for trimming, (walking the board) and for noseriding. Not to mention, it looks cool.\n","funding_links":["https://ko-fi.com/aldy505","https://github.com/sponsors/aldy505"],"categories":["JavaScript","M","Packages","TypeScript"],"sub_categories":["Middleware"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinyhttp%2Fmalibu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftinyhttp%2Fmalibu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinyhttp%2Fmalibu/lists"}