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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:38:45+00:00 2026-05-22T18:38:45+00:00

Is it safe to use the ‘raw’ helper in a Rails app that may

  • 0

Is it safe to use the ‘raw’ helper in a Rails app that may have many users?

I will be integrating TinyMCE with my app, for users to add HTML content to some form of post. Is it a security issue to use ‘raw’ to display their content?

Or is there a more proper way of doing things?

Thanks!

  • 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-22T18:38:45+00:00Added an answer on May 22, 2026 at 6:38 pm

    From the fine manual:

    This method outputs without escaping a string. […] This is not recommended if the data is coming from the user’s input.

    So, yes, using raw can be bit of a security issue (for your users) unless you properly sanitize the HTML that comes in.

    You shouldn’t trust the client. Even if you’ve set up TinyMCE with a limited set of tags, you have no guarantee that the HTML that your server receives actually came from TinyMCE or that someone hasn’t worked around TinyMCE in some way.

    If you’re accepting HTML from users, then you need to whitelist both the tags and attributes before you store it.

    You can use Nokogiri to parse the incoming HTML tag by tag, if a tag is on your whitelist then let it through, if you aren’t explicitly allowing that tag (i.e. it isn’t on your whitelist) then throw it away. And, you’ll want to check the attributes on the tags you let through so that only attributes and attribute values that you want get through. Any tags, attributes, or attribute values that aren’t on your whitelists get thrown away. Once you’ve scrubbed the incoming HTML, you can store it and safely present it to your user’s using the raw helper.

    This added complexity is one reason that a lot of sites use Markdown, BB-Code, or some other markup language that generates HTML.

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

Sidebar

Related Questions

Is the June 2009 WPF Toolkit safe to use in applications that will be
Building a commercial product may use various open source libraries that have use of
I have unescaped data from users. So is it safe to use like this:
Though internal, I presumed that it is safe to use ConcurrentIdentityWeakKeyHashMap generally. However, the
MSDN states that gacutil.exe is not safe to use for production servers . Is
Is it safe to use __syncthreads() in a block where I have purposefully dropped
Is it safe to use Excel Interop inside MVC app?
Will the facebookId ever change? If not, Is it safe to use it in
I have some programs that use MapViewOfFile to share data, but I am getting
Is it safe to use the css property visibility? Will it work in all

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.