Encoding as HTML Entities to avoid code injection
See original GitHub issueIf the output is for a browser, then it can be a security issue (code injection, etc.) if the values are simply dumped straight into the output - rather, they should be encoded as HTML entities. To that end, it’s annoying doing it oneself before passing data to the templating engine. Is it planned to add support for this directly to pupa?
e.g. Maybe single braces {}
means do it normally, and double braces ({{}}
) could mean “escape it too please”? Or even the other way around.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Cross Site Scripting Prevention - OWASP Cheat Sheet Series
Output Encoding is recommended when you need to safely display data exactly as a user typed it in. Variables should not be interpreted...
Read more >Is htmlencoding a suitable solution to avoiding SQL injection ...
You should prevent sql injection by using parameter bindings (eg. never concatenate your sql strings with user input, but use place holders ...
Read more >C4: Encode and Escape Data
Encoding and escaping are defensive techniques meant to stop injection attacks. Encoding (commonly called “Output Encoding”) involves translating special ...
Read more >Using HTML Entity Encode to mitigate XSS vulnerability, then ...
HTML Entity Encode (HTML Encoding) is a commonly deployed escaping/encoding method to mitigate XSS vulnerability as consciousness of XSS is ...
Read more >The purpose of escaping html entities
You should also then add HTML Encoding when displaying the information on your User Interface. ... That way you prevent SQL injections.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I never considered that type of usage, but sure. Double-braces would be a good syntax for that.
Awesome, thanks 🎆