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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:03:16+00:00 2026-06-01T14:03:16+00:00

I am building a webform which I want to prepopulate with data from an

  • 0

I am building a webform which I want to prepopulate with data from an external oracle database. We are using the rails OCI8 plug in.

I want to ensure that I am not leaving myself open to injection by using the URL parameters directly in the query.

For example in the controller:

  def new
    if params[:provider] && u = findByUserName(params[:provider])
        monkey = {
            :employeeEmail => u['EMAIL_ADDRESS'],
            :employeeFirst => u['FIRST_NAME'],
            :employeeLast => u['LAST_NAME'],
            :userID => u['LOGIN_ID'],
            :supervisorUserID => u['SUPERVISOR_ID'],
            :supervisorName => u['SUPERVISOR_NAME'],
            :supervisorEmail => u['SUPERVISOR_EMAIL']
        }
        @service = Service.new(monkey)
    else
        @service = Service.new
    end
  end

As you can see the params[:provider] is passed directly to the OCI8 query:

def findByUserName(id)
    if id
        cursor = cursor_exec("SELECT DISTINCT 
                    <QUERY INFO HERE>
            AND external_user = :id
            ORDER BY last_name, first_name", id)
        collection = cursor.fetch_hash()
        cursor.close
        logoff
        collection
    end
end

Cursor_exec function

def cursor_exec(sql, *params)
  @conn = OCI8.new('user','pass','server')
  if params.length > 0
    cursor = @conn.exec(sql, *params)
  else
    cursor = @conn.exec(sql)
  end 
end

Will OCI8 properly sanitize the parameter through the bind or is there a method I can use to be more safe?

  • 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-01T14:03:17+00:00Added an answer on June 1, 2026 at 2:03 pm

    Since you are internally calling OCI8#exec(), the second parameter passed to it will be bound as a parameter to the query, you needn’t worry about additional escaping. It should be protected internally by the exec() call.

    From the docs:

    exec(sql, *bindvars)

    execute the sql statement. The type of return value depends on the type of sql statement: select; insert, update and delete; create, alter and drop; and PL/SQL.

    When bindvars are specified, they are bound as bind variables before execution.

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

Sidebar

Related Questions

Until I started building MVC sites, I always built WebForm web sites using Visual
I'm currently building a web form using APEX that is losely modelled after a
building a site using PHP and MySQL that needs to store a lot of
I'm building a CMS using WebForms on .NET 4.0 and have the following route
Building decent RIA data-intensive crud-like application is still hard. In spite of existence tons
I'm building a web form that populates dynamically from a stored procedure. It is
I am using the twitter bootstrap css toolkit for building master page for an
I am building a hybrid MVC/Webforms application where my MVC views are using an
i have been building websites using vs 2008 (mostly asp.net mvc, jquery and webforms).
building on my last question jQuery getting values from multiple selects together I have

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.