Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. Apostrophe's to the rescue

Apostrophe's to the rescue

Scheduled Pinned Locked Moved The Weird and The Wonderful
databasesharepointcomsecurityquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Sander RosselS Offline
    Sander RosselS Offline
    Sander Rossel
    wrote on last edited by
    #1

    Just read this story in the lounge[^]. Reminds me of a true shame... Our 'senior', SQL expert recently wrote some dynamic SQL SP recently. He is fully aware of SQL injection and actually went about it keeping security in the back of his head. This is what he came up with (just his idea, not the query)...

    sql_statement = 'select '''@param''' from someTable'

    I took a look at the query and asked him what in the hell all those apostrophes where doing there (the thing was full of it, lots of magic going on there!). He said that was to prevent SQL injection. Can you imagine my reaction? I broke it with a single search for "D'artagnan" ;p It was then and there that I (a SQL rookie) thaught him about quotename[^]... :wtf:

    It's an OO world.

    modified on Tuesday, August 30, 2011 10:23 AM

    J 1 Reply Last reply
    0
    • Sander RosselS Sander Rossel

      Just read this story in the lounge[^]. Reminds me of a true shame... Our 'senior', SQL expert recently wrote some dynamic SQL SP recently. He is fully aware of SQL injection and actually went about it keeping security in the back of his head. This is what he came up with (just his idea, not the query)...

      sql_statement = 'select '''@param''' from someTable'

      I took a look at the query and asked him what in the hell all those apostrophes where doing there (the thing was full of it, lots of magic going on there!). He said that was to prevent SQL injection. Can you imagine my reaction? I broke it with a single search for "D'artagnan" ;p It was then and there that I (a SQL rookie) thaught him about quotename[^]... :wtf:

      It's an OO world.

      modified on Tuesday, August 30, 2011 10:23 AM

      J Offline
      J Offline
      jocstar
      wrote on last edited by
      #2

      Now can you get someone to teach you both about bound parameters :)

      Sander RosselS 1 Reply Last reply
      0
      • J jocstar

        Now can you get someone to teach you both about bound parameters :)

        Sander RosselS Offline
        Sander RosselS Offline
        Sander Rossel
        wrote on last edited by
        #3

        Very true indeed! I was not aware of them (or perhaps I am, but not of the name). However, I'm not the SQL expert :)

        It's an OO world.

        V 1 Reply Last reply
        0
        • Sander RosselS Sander Rossel

          Very true indeed! I was not aware of them (or perhaps I am, but not of the name). However, I'm not the SQL expert :)

          It's an OO world.

          V Offline
          V Offline
          VallarasuS
          wrote on last edited by
          #4

          Parameterized queries are safe in this context! Well there are those 'Xperts' and 'Seniors! everywhere :laugh: Try this[^]

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups