question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to avoid JavaScript Injection attack

See original GitHub issue

when 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:open
  • Created 6 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
Wddzhtcommented, Aug 14, 2017

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 😃

0reactions
ismcagdascommented, Aug 29, 2017

Hi,

We will consider this for the future but for now you need to handle it manually.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found