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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:18:49+00:00 2026-06-15T22:18:49+00:00

In my Rails 2 application, I found a security bug in routing. I am

  • 0

In my Rails 2 application, I found a security bug in routing. I am using Rails 2.3.8. Here is my implementation:

# routes.rb
map.connect 'sampleview', :controller => 'sample', :action => 'view'

For some condition, the URL in my comes like http://example.com/sampleview?view_url=http://test.com?s=2&code=15

In this case I have gone to test.com (this test.com is another domain which I have shown in my app) and the pages are placed in iframe tag.

The problem is suppose if I frame url:

http://example.com/sampleview?view_url=http://www.google.com

The Google landing page was placed in the iframe tag with in my application. This is not good.

If URL http://example.com/sampleview?view_url=http://www.google.com contains other than that test.com. I have to raise the message to user. This is not valid URL here.

How can modify my routes.rb to support this or any other solution. Please help.

  • 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-15T22:18:50+00:00Added an answer on June 15, 2026 at 10:18 pm

    I’m not sure you can do this in Rails 3.2 as the constraint option on route does not exists. I would suggest you to implement this in the controller, eventually with a before_filter. You can place it in the ApplicationController if you have to share it between different controllers.

    UPDATE: add example

    class ApplicationController
      before_filter :check_view_url
    
      private
    
      def check_view_url
        if params[:view_url] && params[:view_url] !~ %r{^http://test.com}
          raise "Trying to access invalid website"
        end
      end
    
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Recently I started using Sublime Text 2 for Rails application and I found it
I'm trying to implement a rails application with neo4j. For hosting I found that
In my rails application I have a rake task that reads emails using imap.
I have Rails application with mounted Engine. #{main_app}/config/routes.rb mount CommentIt::Engine => /talk, :as =>
I've found this a somewhat dated tutorial for developing a Rails application on Leopard
This is a helper method I found in the ruby on rails application spree
I am trying to deploy my rails application to a server using capistrano and
in my rails application I found folder called 'data' , I didn't create it
Im developing an Rails application, but I found a problem when accessing it with
One trick I have found very handy in rails application programming is that class_eval

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.