How to avoid JavaScript Injection attack
See original GitHub issuewhen I use Js API like this:
abp.services.app.product.create({ name: $("[name = 'name']").val(), detail: $("[name = 'detail']").val() })
and in the text box, enter “<script>alert(" Hi “)”</script>”,This will not be Validated by API ,so If the page I want to display product information,the Script will be executed.
Do I need to validate it myself ? thanks much.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
The Essential Guide to Preventing JavaScript Injection
One of the most straightforward methods to protect your site from JavaScript injection attacks is by encoding the data entered by your users...
Read more >Preventing HTML and Script injections in Javascript
If you want to prevent HTML/JS injection, you either remove on encode HTML tags. It's simple as that. – JJJ. Dec 31, 2013...
Read more >Preventing JavaScript Injection Attacks (C#)
One easy method of preventing JavaScript injection attacks is to HTML encode any data entered by website users when you redisplay the data...
Read more >5 ways to prevent code injection in JavaScript and Node.js
5 ways to prevent code injection in JavaScript and Node.js · 1. Avoid eval() , setTimeout() , and setInterval() · 2. Avoid new...
Read more >Preventing JavaScript Injection Attacks: Best Practices and ...
One common method is to use the <script> tag in the HTML code to include the JavaScript file or code. Another method is...
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
OK. Thanks much. ABP can automatically generate Web API layer and also provide Dynamic Javascript Proxies . So I guessed it can avoid JavaScript Injection attack automatically like MVC:
[ValidateInput(true)]
before. If I submit forms rashly in this way ,there may have potential danger. So I take the liberty of thinking that ABP needs to provide this validation and open it by default 😃Hi,
We will consider this for the future but for now you need to handle it manually.