Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8017609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:53:43+00:00 2026-06-04T20:53:43+00:00

I have a textarea setup with CKEditor (a WYSIWIG) in which the user is

  • 0

I have a textarea setup with CKEditor (a WYSIWIG) in which the user is allowed to enter information with a few markup options. However I need to stop potential hackers exploiting this feature and entering malicious code.

I can strip out the tags I don’t want using PHPs strip_tags() using an array of allowed tags: http://php.net/manual/en/function.strip-tags.php

However the possibility still remains that an attacker could simply add onload or onclick etc to any HTML tag that is on the allowed list.

So what would be my best option to check for this type of issue?

My initial thought is to create a blacklist array of these JavaScript functions and then see if any of them occur within the entered data.

Does that sound like a good way to do it or are there better alternatives?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T20:53:44+00:00Added an answer on June 4, 2026 at 8:53 pm

    Use more robust tool like http://htmlpurifier.org/

    It allows you sanitize input, add allowed attributes, tags. You will have more control.

    I highly recommend you create whitelist, instead of blacklist. With blacklist you may skip some dangerous attributes, while with whitelist you allow what you want.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have textarea in my site(link shortening site) i want to user enter some
I have this following setup, a textarea named with some data in it that
i have the following setup <div class=article-content> <div class='editors' id=mine> <h2>My Text</h2> <textarea name=my_text
I have a textarea, which stretches (makes height bigger) smoothly: <style type=text/css> textarea {
I have a textarea. After the user types X number of characters in the
I have a simple textarea which works in all browsers i.e. I can click
I have the following Javascript to copy the user's textarea input in this iPhone
I presently have CKeditor setup on a webpage, but strange things are happening when
I have a textarea inside a form (form action=post) and a link under this
I have a TextArea() control in my View implemented using Razor Engine. @Html.TextArea(EventNature,new {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.