Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/google/safehtml
Safe HTML for Go
https://github.com/google/safehtml
Last synced: 3 months ago
JSON representation
Safe HTML for Go
- Host: GitHub
- URL: https://github.com/google/safehtml
- Owner: google
- License: bsd-3-clause
- Created: 2020-06-29T15:52:13.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-07-19T08:17:10.000Z (4 months ago)
- Last Synced: 2024-07-19T16:44:19.865Z (4 months ago)
- Language: Go
- Homepage:
- Size: 147 KB
- Stars: 347
- Watchers: 8
- Forks: 20
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- my-awesome - google/safehtml - 07 star:0.4k fork:0.0k Safe HTML for Go (Go)
- awesome - google/safehtml - Safe HTML for Go (Go)
README
# Safe HTML for Go
`safehtml` provides immutable string-like types that wrap web types such as
HTML, JavaScript and CSS. These wrappers are safe by construction against XSS
and similar web vulnerabilities, and they can only be interpolated in safe ways.
You can read more about our approach to web security in our
[whitepaper](https://static.googleusercontent.com/media/research.google.com/en//pubs/archive/42934.pdf),
or this [OWASP talk](https://www.youtube.com/watch?v=ccfEu-Jj0as).Additional subpackages provide APIs for managing exceptions to the
safety rules, and a template engine with a syntax and interface that closely
matches [`html/template`](https://golang.org/pkg/html/template/). You can refer
to the [godoc](https://pkg.go.dev/github.com/google/safehtml?tab=doc)
for each (sub)package for the API documentation and code examples.
More end-to-end demos are available in `example_test.go`.This is not an officially supported Google product.