ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 19th, 2011, 10:48 AM
BowlerDo0d BowlerDo0d is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2011
Posts: 27 BowlerDo0d User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 41 m 25 sec
Reputation Power: 0
Data truncation and maxlength

We recently rolled out a new website and we keep getting errors that are impossible to re-create.

Form fields throughout the application all have the maxlength attribute on them. When submitted, JavaScript double checks the length values and ColdFusion code does as well. Also, we use cfqueryparams with a maxlength as well. Low and behold, there are STILL some users generating errors saying "Data will be truncated. Length of passed string is too long."

Any ideas? I thought we covered all bases on the length of passed data yet they are still coming through.

Additionally, on these same forms, we check for empty fields as well with JavaScript as well as ColdFusion checks yet we are getting some users to submit blank and empty forms.

Naturally, when we try to recreate the errors, everything works for us. Much appreciated on any insight.

Thanks!

Reply With Quote
  #2  
Old December 19th, 2011, 11:09 AM
kiteless kiteless is offline
Moderator
Dev Shed God (5000 - 5499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 5,100 kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 2 Weeks 5 Days 4 h 29 m 54 sec
Reputation Power: 966
Without a reproducible test case it's very hard to say. I would try setting up error handling that catches errors like this and writes the contents of the form scope AND the values actually being passed to the query (in case they are somehow different) to a text file or something. That way you should be able to see exactly what the values are and test using those.

Reply With Quote
  #3  
Old December 19th, 2011, 01:00 PM
BowlerDo0d BowlerDo0d is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2011
Posts: 27 BowlerDo0d User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 41 m 25 sec
Reputation Power: 0
Already ahead of you. We have the application cfc set up with the onError function emailing us with all the errors. That is how we figured out that people were still passing in blank forms and such. We have fields set up and checked 3 times for say a 25 character length and we are still getting errors on strings that are around 30+. No one understands how these are getting through and we don't know what else to do to attempt to stop the errors.

Also, we have been getting some errors on empty session variables from pages that you cannot access unless you are logged in and if you are on any page in that directory, the first thing it does is check if your login session var exists or kicks you out to the login page. Again, not sure how people are getting to pages with all these checks in place. We've tried numerous ways ourselves and nothing can be re-created for us. VERY annoying.

Reply With Quote
  #4  
Old December 19th, 2011, 01:45 PM
kiteless kiteless is offline
Moderator
Dev Shed God (5000 - 5499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 5,100 kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 2 Weeks 5 Days 4 h 29 m 54 sec
Reputation Power: 966
Yeah not sure but I can tell you that I've worked on lots of CF apps that do these things (security enforced, client and server-side validation, etc.) and they do work fine. So I think it has to be something specific to your app. I know that probably doesn't help much but at least be aware that this SHOULD work, so something else must be going on.

Reply With Quote
  #5  
Old December 19th, 2011, 02:46 PM
BowlerDo0d BowlerDo0d is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2011
Posts: 27 BowlerDo0d User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 41 m 25 sec
Reputation Power: 0
Yea I have at least come up with that much of an answer. Almost everything we do in CF SHOULD work haha. I was just asking for anyone who may have worked with this before and had any more information to go off of. Clearly we have nothing further to help investigate and not sure which angle we might be missing. Thanks though.

Reply With Quote
  #6  
Old December 19th, 2011, 04:24 PM
kiteless kiteless is offline
Moderator
Dev Shed God (5000 - 5499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 5,100 kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 2 Weeks 5 Days 4 h 29 m 54 sec
Reputation Power: 966
Well what happens if you take the exact values used when the error happens and run your own unit test?

Reply With Quote
  #7  
Old December 21st, 2011, 10:06 AM
BowlerDo0d BowlerDo0d is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2011
Posts: 27 BowlerDo0d User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 41 m 25 sec
Reputation Power: 0
We can't use the exact values entered. The form fields cut the values off at the proper lengths. Try typing them in and it stops you. Try pasting them in, and it cuts it off. Not sure what the user did and how they got around that. Everything we have set up works for us and we are at a loss. Even if you turn off JS the field maxlength should still work and the CF will definitely catch it. Clueless.

Reply With Quote
  #8  
Old December 21st, 2011, 11:22 AM
kiteless kiteless is offline
Moderator
Dev Shed God (5000 - 5499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 5,100 kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 2 Weeks 5 Days 4 h 29 m 54 sec
Reputation Power: 966
Right, JavaScript can be disabled, form field max length can be disabled, and one can even submit data to a form handling page directly, without using the form. Could they be doing this somehow?

Basically I would worry less about what they are doing in the browser and more about making sure you check everything and that it all works on the server side. Client side validation is a useful way to shepherd the user but at the end of the day you must treat all user-supplied data as potentially invalid and do all definitive validation on the server. That's the case for ANY web application (CF, PHP, Flex, Rails, etc.).

Reply With Quote
  #9  
Old December 21st, 2011, 11:59 AM
BowlerDo0d BowlerDo0d is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2011
Posts: 27 BowlerDo0d User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 41 m 25 sec
Reputation Power: 0
We do check it on the server. I submit the forms into a CF page that handles the data and it's still erroring on the cfqueryparams when inserting into queries and such. They are somehow getting around everything!

Reply With Quote
  #10  
Old December 21st, 2011, 04:14 PM
kiteless kiteless is offline
Moderator
Dev Shed God (5000 - 5499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 5,100 kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 2 Weeks 5 Days 4 h 29 m 54 sec
Reputation Power: 966
OK then, to be clear, you're saying:

If you take the EXACT value they submitted to the server, which would also be the EXACT value actually entered into the database if the insert went through...

And feed that value to the query yourself, then it does NOT go through? It's impossible that the exact same value could both pass and fail your cfqueryparam maxLength check. So if it doesn't work for you but they can still make it go through, the only possible options are that you are not in fact using the same exact value for testing, that there is some other avenue to execute the query that you aren't using or aren't testing, or that there is a bug in cfqueryparam.

What version of CF is this?

Reply With Quote
  #11  
Old December 30th, 2011, 10:51 AM
BowlerDo0d BowlerDo0d is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2011
Posts: 27 BowlerDo0d User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 41 m 25 sec
Reputation Power: 0
I don't think you understand what I'm asking and/or I don't know how to word it. Thanks tho, nvm.

Reply With Quote
  #12  
Old December 30th, 2011, 10:59 PM
kiteless kiteless is offline
Moderator
Dev Shed God (5000 - 5499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 5,100 kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 2 Weeks 5 Days 4 h 29 m 54 sec
Reputation Power: 966
Sure. What I'm saying is pretty straightforward (simply testing the exact values directly against the query), so I think something is getting lost in your explanation of either what's happening or what you've done to actually test the behavior.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Data truncation and maxlength

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap