{"id":15724984,"url":"https://github.com/ecto/bleach","last_synced_at":"2025-10-28T11:05:36.469Z","repository":{"id":1710428,"uuid":"2439967","full_name":"ecto/bleach","owner":"ecto","description":":no_entry_sign: minimalistic HTML sanitizer for node.js","archived":false,"fork":false,"pushed_at":"2015-05-26T10:33:06.000Z","size":231,"stargazers_count":121,"open_issues_count":6,"forks_count":18,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-10-28T11:02:56.580Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/ecto.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}},"created_at":"2011-09-22T20:43:16.000Z","updated_at":"2025-03-13T13:46:47.000Z","dependencies_parsed_at":"2022-09-03T07:53:51.498Z","dependency_job_id":null,"html_url":"https://github.com/ecto/bleach","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ecto/bleach","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecto%2Fbleach","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecto%2Fbleach/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecto%2Fbleach/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecto%2Fbleach/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ecto","download_url":"https://codeload.github.com/ecto/bleach/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecto%2Fbleach/sbom","scorecard":{"id":365863,"data":{"date":"2025-08-11","repo":{"name":"github.com/ecto/bleach","commit":"b77ff9f7833dd08449a03c6e2293ccd669337afc"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.9,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","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":"Code-Review","score":2,"reason":"Found 6/23 approved changesets -- score normalized to 2","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":"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":"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":"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":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"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":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"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":"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":"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":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"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":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 13 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"}}]},"last_synced_at":"2025-08-18T11:49:32.508Z","repository_id":1710428,"created_at":"2025-08-18T11:49:32.508Z","updated_at":"2025-08-18T11:49:32.508Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281425551,"owners_count":26499031,"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-10-28T02:00:06.022Z","response_time":60,"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":[],"created_at":"2024-10-03T22:18:41.929Z","updated_at":"2025-10-28T11:05:36.441Z","avatar_url":"https://github.com/ecto.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bleach\n\nSanitize your HTML the easy way!\n\n![bleach](http://i.imgur.com/9qSfd.png)\n\n## install\n\n    npm install bleach\n\n## test\n\n    vows --spec test/*\n\n## example\n\nBasic:\n\n````javascript\n\nvar bleach = require('bleach');\n\nvar html = bleach.sanitize(aBunchOfHTML);\n\nconsole.log(html);\n````\n\nAdvanced:\n\n````javascript\n\nvar bleach = require('bleach');\n\nvar whitelist = [\n  'a',\n  'b',\n  'i',\n  'em',\n  'strong'\n]\n\nvar options = {\n  mode: 'white',\n  list: whitelist\n}\n\nvar html = bleach.sanitize(aBunchOfHTML, options);\n\nconsole.log(html);\n````\n\n## usage\n\n### bleach.sanitize(html, options)\n\nRuns HTML through sanitizer and returns sanitized HTML as string.\n\n`options` may contain the following optional attributes:\n\n*   `mode` may be set to `'white'` or `'black'`\n*   `list` is an array containing tags to match against\n\n`white`mode will remove all tags from `html`, excluding those in `list`\n\n`black`mode will remove all tags found in `list` that are found in `html`\n\n### bleach.analyze(html)\n\nWill extract all tags from HTML and return an array of JSON objects. Example return:\n\n````javascript\n[\n  {\n    full: '\u003cdiv id=\"post-119477\"\u003e',\n    name: 'div',\n    attr: [\n      \"id\": \"post-119477\"\n    ]\n  },\n  ...\n]\n````\n\n### bleach.filter(html, filters)\n\nSEXY FUN TIME\n\n````javascript\n\nvar nyanFilter = function(input){\n  return input.replace('cats', 'nyannyannyan');\n}\n\nconsole.log(\n  bleach.filter('cats', nyanFilter)\n);\n\n// nyannyannyan\n\n````\n\n````javascript\n\nvar cutFilter = function(input){\n  return input.slice(0, 3);\n}\n\nconsole.log(\n  bleach.filter('cats', [\n    nyanFilter,\n    cutFilter\n  ])\n);\n\n// nyan\n\n````\n\nYou may also define longer filters and include them in the ./node_modules/bleach/filters directory.\nA sample filter is included to convert YouTube flash embed objects to iDevice-compatible YouTube iframes.\n\n````javascript\n\nvar html = '\u003cobject classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" width=\"420\" height=\"315\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0\"\u003e\u003cparam name=\"allowFullScreen\" value=\"true\"\u003e\u003cparam name=\"allowscriptaccess\" value=\"always\"\u003e\u003cparam name=\"src\" value=\"http://www.youtube.com/v/aU079Mdkenw?version=3\u0026amp;hl=en_US\"\u003e\u003cparam name=\"allowfullscreen\" value=\"true\"\u003e\u003cembed type=\"application/x-shockwave-flash\" width=\"420\" height=\"315\" src=\"http://www.youtube.com/v/aU079Mdkenw?version=3\u0026amp;hl=en_US\" allowscriptaccess=\"always\" allowfullscreen=\"true\" id=\"s_media_1_0\" name=\"s_media_1_0\"\u003e\u003c/object\u003e';\n\nconsole.log(\n  bleach.filter(html, 'youtube')\n);\n\n// \u003ciframe type=\"text/html\" frameborder=\"0\" scrolling=\"no\" allowfullscreen src=\"http://youtube.com/embed/aU079Mdkenw\"\u003e\u003c/iframe\u003e\n\n````\n\nRefer to the filters directory for the template.\n\n## disclaimer\n\nThis is not a port of the Python **bleach** library - in fact their implementations are very different.\n\n## license\n\n(The MIT License)\n\nCopyright (c) 2011 Cam Pedersen \u003ccam@onswipe.com\u003e\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fecto%2Fbleach","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fecto%2Fbleach","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fecto%2Fbleach/lists"}