Ecosyste.ms: Funds

An open API service for providing issue and pull request metadata for open source projects.

https://github.com/microcosm-cc/bluemonday

allowlist go golang html owasp sanitization security xss

Last synced: about 1 hour ago

Repository metadata:

bluemonday: a fast golang HTML sanitizer (inspired by the OWASP Java HTML Sanitizer) to scrub user generated content of XSS


Owner metadata:


Committers metadata

Last synced: about 4 hours ago

Total Commits: 285
Total Committers: 40
Avg Commits per committer: 7.125
Development Distribution Score (DDS): 0.705

Commits in past year: 12
Committers in past year: 4
Avg Commits per committer in past year: 3.0
Development Distribution Score (DDS) in past year: 0.25

Name Email Commits
David Kitchen d****d@b****m 84
David Kitchen d****n@c****m 38
David Kitchen d****d@m****c 29
David Kitchen g****b@d****n 27
6543 6****3@o****e 17
David Kitchen d****n@g****m 10
Filippo Valsorda hi@f****o 9
Mark Smith m****k@a****k 6
buddhamagnet b****t@g****m 6
KN4CK3R a****n@o****e 5
Dmitri Shuralyov s****L@g****m 5
K z@k****i 4
Paul Nicholls p****n@l****m 3
Lunny Xiao x****n@g****m 3
Cody Lee c****e@d****m 3
CMogilko m****o@c****u 3
Andrew Thornton a****7@c****t 3
dependabot[bot] 4****] 3
Andy Hochhaus a****s@s****m 2
Martin Tournoij m****n@a****t 2
Steven gutzwiller s****r@s****m 2
Yewolf y****f@g****m 2
opennota o****a@g****m 2
Aidan Fewster f****a@g****m 1
StevenGutzwiller S****r 1
Sana b****a 1
Carlos Alexandro Becker c****0 1
EmmanuelMeinen E****n@t****m 1
Gusted w****7@h****m 1
John Graham-Cumming j****c@c****m 1
and 10 more...

Issue and Pull Request metadata

Last synced: about 1 hour ago


Package metadata

go: github.com/microcosm-cc/bluemonday

Package bluemonday provides a way of describing an allowlist of HTML elements and attributes as a policy, and for that policy to be applied to untrusted strings from users that may contain markup. All elements and attributes not on the allowlist will be stripped. The default bluemonday.UGCPolicy().Sanitize() turns this: Into the more harmless: And it turns this: Into this: Whilst still allowing this: To pass through mostly unaltered (it gained a rel="nofollow"): The primary purpose of bluemonday is to take potentially unsafe user generated content (from things like Markdown, HTML WYSIWYG tools, etc) and make it safe for you to put on your website. It protects sites against XSS (http://en.wikipedia.org/wiki/Cross-site_scripting) and other malicious content that a user interface may deliver. There are many vectors for an XSS attack (https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet) and the safest thing to do is to sanitize user input against a known safe list of HTML elements and attributes. Note: You should always run bluemonday after any other processing. If you use blackfriday (https://github.com/russross/blackfriday) or Pandoc (http://johnmacfarlane.net/pandoc/) then bluemonday should be run after these steps. This ensures that no insecure HTML is introduced later in your process. bluemonday is heavily inspired by both the OWASP Java HTML Sanitizer (https://code.google.com/p/owasp-java-html-sanitizer/) and the HTML Purifier (http://htmlpurifier.org/). We ship two default policies, one is bluemonday.StrictPolicy() and can be thought of as equivalent to stripping all HTML elements and their attributes as it has nothing on its allowlist. The other is bluemonday.UGCPolicy() and allows a broad selection of HTML elements and attributes that are safe for user generated content. Note that this policy does not allow iframes, object, embed, styles, script, etc. The essence of building a policy is to determine which HTML elements and attributes are considered safe for your scenario. OWASP provide an XSS prevention cheat sheet ( https://www.google.com/search?q=xss+prevention+cheat+sheet ) to help explain the risks, but essentially:

go: github.com/Microcosm-cc/bluemonday

Package bluemonday provides a way of describing a whitelist of HTML elements and attributes as a policy, and for that policy to be applied to untrusted strings from users that may contain markup. All elements and attributes not on the whitelist will be stripped. The default bluemonday.UGCPolicy().Sanitize() turns this: Into the more harmless: And it turns this: Into this: Whilst still allowing this: To pass through mostly unaltered (it gained a rel="nofollow"): The primary purpose of bluemonday is to take potentially unsafe user generated content (from things like Markdown, HTML WYSIWYG tools, etc) and make it safe for you to put on your website. It protects sites against XSS (http://en.wikipedia.org/wiki/Cross-site_scripting) and other malicious content that a user interface may deliver. There are many vectors for an XSS attack (https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet) and the safest thing to do is to sanitize user input against a known safe list of HTML elements and attributes. Note: You should always run bluemonday after any other processing. If you use blackfriday (https://github.com/russross/blackfriday) or Pandoc (http://johnmacfarlane.net/pandoc/) then bluemonday should be run after these steps. This ensures that no insecure HTML is introduced later in your process. bluemonday is heavily inspired by both the OWASP Java HTML Sanitizer (https://code.google.com/p/owasp-java-html-sanitizer/) and the HTML Purifier (http://htmlpurifier.org/). We ship two default policies, one is bluemonday.StrictPolicy() and can be thought of as equivalent to stripping all HTML elements and their attributes as it has nothing on its whitelist. The other is bluemonday.UGCPolicy() and allows a broad selection of HTML elements and attributes that are safe for user generated content. Note that this policy does not whitelist iframes, object, embed, styles, script, etc. The essence of building a policy is to determine which HTML elements and attributes are considered safe for your scenario. OWASP provide an XSS prevention cheat sheet ( https://www.google.com/search?q=xss+prevention+cheat+sheet ) to help explain the risks, but essentially:

  • Homepage: https://github.com/Microcosm-cc/bluemonday
  • Documentation: https://pkg.go.dev/github.com/Microcosm-cc/bluemonday#section-documentation
  • Licenses: BSD-3-Clause
  • Latest release: v1.0.26 (published about 1 year ago)
  • Last Synced: 2024-11-09T00:05:53.733Z (1 day ago)
  • Versions: 28
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent packages count: 7.486%
    • Average: 7.964%
    • Dependent repos count: 8.442%

Dependencies

go.mod go
  • github.com/aymerick/douceur v0.2.0
  • github.com/gorilla/css v1.0.0
  • golang.org/x/net v0.0.0-20210614182718-04defd469f4e
  • retract[v1.0.0, v1.0.18]
go.sum go
  • github.com/aymerick/douceur v0.2.0
  • github.com/gorilla/css v1.0.0
  • golang.org/x/net v0.0.0-20210614182718-04defd469f4e
.github/workflows/test.yml actions
  • actions/checkout v2 composite
  • actions/setup-go v2 composite