Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

120
Views
Removing JavaScript from HTML inside an object

Full disclosure: I inherited the code. I was tasked to fix it. After 9 hours, I am turning to you, the hive mind.

Inside an object (response) is response.Object Object contains HTML code.

$("doodah").html(response.Object)

Coverity doesn't like this. It's vulnerable to a DOM XSS attack. Coverity is complaining about how it is vulnerable to an arbitrary JavaScript statement that can taint respose.Object.

So I tried to REGEX it out. No good. .replace(RegEx_Clear_Scipt_Tags) didn't work. I added RegEx to clear Script tags and in-line JavaScript. Coverity does not like this either.

Fine, so I tried a function that puts the code in a DIV, strips out the Script tags through DOM functions and returns the innerHTML

No good. Coverity didn't like that either.

Does anyone have any suggestions?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!