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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:47:47+00:00 2026-05-12T16:47:47+00:00

I receive input in the form of URL strings (aka controller/action?example=yes), and I’m wondering

  • 0

I receive input in the form of URL strings (aka controller/action?example=yes), and I’m wondering if I need to escape the content of the string for security.

For example, if I assign the param to a variable:

example = params[:example].to_s

do I need to escape anything? or do I only apply h() when I put the value of :example back in the view file?

  • 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-12T16:47:48+00:00Added an answer on May 12, 2026 at 4:47 pm

    It depends on what you are doing with it, if you are worried of SQL injections , then you can trust ActiveRecord, like doing:

    Examples.find_by_name params[:example]
    

    or

    Examples.find(:conditions=> ["name = ?", params[:example]])
    

    On the other side, the common strategy of filtering is on display side, so you save the input as is, and you filter on display(views) by using h().

    If you still want to save some HTML input from the user like when doing in rich editors, then you have to pay extra attention to XSS attacks, and so you have to filter the input. One great gem for filtering HTML is Sanitize, use it to save a modified filtered version of user input to use it in views.

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

Sidebar

Related Questions

I am new to ruby. I need to receive password as an input through
html in delete_define.php follows: <form action=delete_now.php onsubmit=my_funct();> <input type=submit name=my_submit class=my_submit value=submit/> </form> javascript
I am writing a POSIX shell script that may or may not receive input
I receive a dictionary as input, and would like to to return a dictionary
I'm coding an italian website where I need to validate some input data with
I have a form like this: <form id=cform> <label>folder name:</label> <input type=text name=Folder[name] />
I have following HTML form <form action=https://sandbox.paypal.com/cgi-bin/webscr method=post id=paypalpost name=paypalpost> <input type=hidden name=rm value=2/>
For some reason i cant receive any email from my submit form - is
I have a form with dynamically created input fields - upon submitting it I
I need to create a PHP script that receives XML input via an HTTP

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.