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 6599335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:28:41+00:00 2026-05-25T18:28:41+00:00

I save two versions of user input in the following sequence: Untrusted user enters

  • 0

I save two versions of user input in the following sequence:

  1. Untrusted user enters raw markdown.
  2. Raw markdown is stored in one table.
  3. A copy of the raw markdown is converted into HTML.
  4. HTML is sanitized and persisted, and is displayed upon request.
  5. The raw markdown version is only displayed when users edit a entry; it’s loaded into a textarea of a form.

Is there any risk in loading raw markdown (which could potentially contain unsafe HTML) into a textarea? It would never be displayed outside of a textarea.

I can’t sanitize the markdown because it would result in inconsistencies between the markdown and HTML versions I’m saving.

FYI: I always sanitize SQL, regardless of what I’m saving to the DB.

  • 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-05-25T18:28:42+00:00Added an answer on May 25, 2026 at 6:28 pm

    It depends how you’re “loading” it into the textarea. If you’re doing it server-side through simple string concatenation, e.g. in php,

    $output = '<textarea>' + $markdown + '</textarea>';
    

    …then there is absolutely a risk, because that markdown could very easily close out the textarea and embed whatever else it wants. If you’re using some sort of a component framework (e.g., ASP.NET), then you should be protected as long as you use a safe API method, such as MyTextArea.Value = markdown;.

    If you’re doing it client-side, it also depends on how you’re doing this. You would be safe if you used something like jQuery’s .val() setter, but could still expose yourself to XSS vulnerabilities through other approaches.

    In short, the general answer is yes, depending on how you’re actually creating and populating the textarea.

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

Sidebar

Related Questions

the database has two table,one is mb_user table and other is mb_comment table。A user
I have two tabitems. User will enter some data and save it on the
My app allows a user to edit data, but during save there are two
What is the best and simplets way to save two values from two different
in my app' i'm recieving data from serial port and save them into two
I have two buttons for my form - a Save changes button and a
I've got some questions about two ways to save settings in the web.config. Appsettings
suddenly we have to save kanji (Japanese) in a couple of columns of two
I have found only two methods (SaveFile, LoadFile) which save in a file. How
I have an excel spreadsheet that has two columns. When I choose to save

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.