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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:16:09+00:00 2026-05-28T01:16:09+00:00

I am using Ruby on Rails 3.1.0 and I would like to focus on

  • 0

I am using Ruby on Rails 3.1.0 and I would like to focus on security on using the I18n gem for internationalization purposes.

At this time I have:

# in .yml file
key_1_html: "%{var_1} is just a test"

# in view, controller and model files
I18n.t('key_1_html', :var_1 => 'Test variable')

The Test variable is/represent an input from users so I should consider that as a potential hacking.

What could/should I do to care about security in my case?

  • 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-28T01:16:10+00:00Added an answer on May 28, 2026 at 1:16 am

    Under normal Rails (3.x) usage, you don’t have to do anything.

    Even if some HTML code or javascript gets into the string returned from i18n, if you are outputting strings returned from i18n in ordinary ways, any HTML in them (whether from the template or the variable) will be escaped and show up as literal source in the webpage.

    You’d have to manually mark a string returned by i18n as .html_safe to get it to be delivered as html source.

    So don’t do that.

    Try it yourself, and see.

    I18n.t('key_1_html', :var_1 => '/<script>danger!</script>')
    

    Now output that in an ERB template, see what happens.

    If you’re doing something odd with i18n other than outputting it through typical Rails templates to the browser, then you’ll need to say what, and what your concern is.

    I think maybe this guide is what you’re looking for, for an overview of Rails security issues:

    http://guides.rubyonrails.org/security.html

    See Section 8 on “Injection”.

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

Sidebar

Related Questions

I am using Ruby on Rails 3.1 and I would like to have an
I would like to create something like this using ruby on rails. Im not
I'm using Authlogic with my Ruby on Rails App. I would like user to
I am using Ruby on Rails 3.1.0 and I would like to properly generate
I am using Ruby on Rails 3.0.7 and I would like to document my
I am using Ruby on Rails 3.0.10 and I would like to build an
I am building web applications using Ruby on Rails and I would like to
I am using Ruby on Rails 3 and I would like to retrieve a
I am using Ruby on Rails 3.0.7 and I would like to install and
I am using Ruby on Rails 3.0.7 and I would like to know how

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.