BIG WARNING - validation controls appear to be ignored.

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default BIG WARNING - validation controls appear to be ignored.

    Hi,

    Although I have got to the bottom of this problem, it gave me quite a shock
    to discover how easy it is to write a very unsafe application with .Net
    validators.

    The scenario was this: we wrote and tested an application using validators,
    but when we deployed the app onto a different server, it accepted and
    processed invalid input from the user.

    Turns out that in testing the validators were running client-side. When a
    client-side validator blocks the input there is no postback and hence
    nothing happens on the server. However, if client-side validation is
    disabled for any reason, all control events fire on the server even if the
    page is invalid. If, like me, you were expecting the page processing to
    finish in the event of a validation faliure and not fire button clicks etc,
    you are sadly mistaken. If you use validators, you must check manually
    Page.IsValid in every "click" event.

    I realise this is probably in the documentation (section 34.4b(ii)
    subsection 2(i) sub-paragraph 23a.3.64) and many of you gurus will think
    this is obvious, but I'm sure that there must be hundreds of apps out there
    that are unwittingly relying on client-side validation.

    The moral is this: ALWAYS TEST THE APPLICATION WITH CLIENT SIDE VALIDATION
    DISABLED. the default configuration could lull you into a false sense of
    security and could lead to shipping an unsafe application.

    Andy


    Andy Fish Guest

  2. Similar Questions and Discussions

    1. Validation Between Controls
      I have a datagrid with several fields with textboxes and drop downs. I want to be able to validate the drop down field in one column to only be...
    2. Validation Controls
      Hello, I have placed many validation controls on an aspx webform and a user control that allows the visitor to enter a username and password and...
    3. Validation on custom controls
      Hi, I searched through NG's etc but could not find an answer to my problem..... I have a custom control that consists of 3 textboxes. I would...
    4. Validation Controls Postback
      I have a little problem while working with Validation Controls in extensive forms... When the user reaches the end, and something is wrong, it just...
    5. Dynamic Validation Controls in Netscape
      I am having a problem with dynamic validation controls. I have some code that uses an XSLT to transform an XMLDocument into HTML which creates...
  3. #2

    Default Re: BIG WARNING - validation controls appear to be ignored.

    Yes, we do consider this obvious. But I think all of us would also agree
    that we see questions with respect to this all too often. Having said that,
    remember that there's atleast two sides to every story (yours, mine and
    Kevin's Spe...err I mean the right way). If it behaved otherwise, someone
    would likely say "BIG WARNING - unable to manually control validation" and
    continue to claim that microsoft removed the flexibility of blah blah
    blah...so it depends how you look at it.

    anyways, thanks for the heads up, hopefully this message will help someone
    doing a google group search one day...

    Karl
    --
    MY ASP.Net tutorials
    [url]http://www.openmymind.net/[/url]


    "Andy Fish" <ajfish@blueyonder.co.uk> wrote in message
    news:OyahI6oGFHA.3472@TK2MSFTNGP09.phx.gbl...
    > Hi,
    >
    > Although I have got to the bottom of this problem, it gave me quite a
    shock
    > to discover how easy it is to write a very unsafe application with .Net
    > validators.
    >
    > The scenario was this: we wrote and tested an application using
    validators,
    > but when we deployed the app onto a different server, it accepted and
    > processed invalid input from the user.
    >
    > Turns out that in testing the validators were running client-side. When a
    > client-side validator blocks the input there is no postback and hence
    > nothing happens on the server. However, if client-side validation is
    > disabled for any reason, all control events fire on the server even if the
    > page is invalid. If, like me, you were expecting the page processing to
    > finish in the event of a validation faliure and not fire button clicks
    etc,
    > you are sadly mistaken. If you use validators, you must check manually
    > Page.IsValid in every "click" event.
    >
    > I realise this is probably in the documentation (section 34.4b(ii)
    > subsection 2(i) sub-paragraph 23a.3.64) and many of you gurus will think
    > this is obvious, but I'm sure that there must be hundreds of apps out
    there
    > that are unwittingly relying on client-side validation.
    >
    > The moral is this: ALWAYS TEST THE APPLICATION WITH CLIENT SIDE VALIDATION
    > DISABLED. the default configuration could lull you into a false sense of
    > security and could lead to shipping an unsafe application.
    >
    > Andy
    >
    >

    Karl Seguin Guest

  4. #3

    Default Re: BIG WARNING - validation controls appear to be ignored.

    On 24 Feb 2005, "Andy Fish" <ajfish@blueyonder.co.uk> postulated in
    news:OyahI6oGFHA.3472@TK2MSFTNGP09.phx.gbl:
    > Hi,
    >
    > Although I have got to the bottom of this problem, it gave me quite
    a shock
    > to discover how easy it is to write a very unsafe application with
    ..Net
    > validators.
    >
    > The scenario was this: we wrote and tested an application using
    validators,
    > but when we deployed the app onto a different server, it accepted
    and
    > processed invalid input from the user.
    >
    > Turns out that in testing the validators were running client-side.
    When a
    > client-side validator blocks the input there is no postback and
    hence
    > nothing happens on the server. However, if client-side validation
    is
    > disabled for any reason, all control events fire on the server even
    if the
    > page is invalid. If, like me, you were expecting the page
    processing to
    > finish in the event of a validation faliure and not fire button
    clicks etc,
    > you are sadly mistaken. If you use validators, you must check
    manually
    > Page.IsValid in every "click" event.
    >
    > I realise this is probably in the documentation (section 34.4b(ii)
    > subsection 2(i) sub-paragraph 23a.3.64) and many of you gurus will
    think
    > this is obvious, but I'm sure that there must be hundreds of apps
    out there
    > that are unwittingly relying on client-side validation.
    >
    > The moral is this: ALWAYS TEST THE APPLICATION WITH CLIENT SIDE
    VALIDATION
    > DISABLED. the default configuration could lull you into a false
    sense of
    > security and could lead to shipping an unsafe application.
    >
    > Andy
    >
    >
    Good point, Andy.

    No, this is not in the documentation, however, there are plenty of
    informative articles available on preventing SQL injection attacks.

    Testing is important, but a deliberate practice of defense in depth
    is advised to all who use the web as a data aggregator.

    I would suggest that if you don't already use parameterized queries,
    that you learn what they are and how they can help you prevent data
    content attacks against your server.


    -- ipgrunt
    IPGrunt Guest

  5. #4

    Default Re: BIG WARNING - validation controls appear to be ignored.

    Just like any client-side checking using vbscript/javascript, they can
    always be overrided.

    So never just do client-side checking of data, do server-side checking on
    the received data as well.

    This may seem redundant, but client-side check enables quicker response and
    fewer postbacks, while server-side check makes your data safer.

    "Andy Fish" <ajfish@blueyonder.co.uk> ¦b¶l¥ó
    news:OyahI6oGFHA.3472@TK2MSFTNGP09.phx.gbl ¤¤¼¶¼g...
    > Hi,
    >
    > Although I have got to the bottom of this problem, it gave me quite a
    shock
    > to discover how easy it is to write a very unsafe application with .Net
    > validators.
    >
    > The scenario was this: we wrote and tested an application using
    validators,
    > but when we deployed the app onto a different server, it accepted and
    > processed invalid input from the user.
    >
    > Turns out that in testing the validators were running client-side. When a
    > client-side validator blocks the input there is no postback and hence
    > nothing happens on the server. However, if client-side validation is
    > disabled for any reason, all control events fire on the server even if the
    > page is invalid. If, like me, you were expecting the page processing to
    > finish in the event of a validation faliure and not fire button clicks
    etc,
    > you are sadly mistaken. If you use validators, you must check manually
    > Page.IsValid in every "click" event.
    >
    > I realise this is probably in the documentation (section 34.4b(ii)
    > subsection 2(i) sub-paragraph 23a.3.64) and many of you gurus will think
    > this is obvious, but I'm sure that there must be hundreds of apps out
    there
    > that are unwittingly relying on client-side validation.
    >
    > The moral is this: ALWAYS TEST THE APPLICATION WITH CLIENT SIDE VALIDATION
    > DISABLED. the default configuration could lull you into a false sense of
    > security and could lead to shipping an unsafe application.
    >
    > Andy
    >
    >

    Lau Lei Cheong Guest

  6. #5

    Default Re: BIG WARNING - validation controls appear to be ignored.

    > No, this is not in the documentation, however, there are plenty of
    > informative articles available on preventing SQL injection attacks.
    Is it not in the docs ? You better read it more carefully, what the h do you
    think the webuivalidation.js is ???

    Come on, dont blaim MS because you are bad programmers.

    PL.


    PL Guest

  7. #6

    Default Re: BIG WARNING - validation controls appear to be ignored.

    > I realise this is probably in the documentation (section 34.4b(ii) subsection 2(i) sub-paragraph 23a.3.64) and many of you gurus
    > will think this is obvious, but I'm sure that there must be hundreds of apps out there that are unwittingly relying on client-side
    > validation.
    Try reading:
    ms-help://MS.NETFrameworkSDKv1.1/cpguidenf/html/cpconClient-SideValidation.htm

    PL.


    PL Guest

  8. #7

    Default Re: BIG WARNING - validation controls appear to be ignored.

    On 24 Feb 2005, "PL" <pblse2@yahoo.se> postulated in
    news:e4M6KwvGFHA.560@TK2MSFTNGP12.phx.gbl:
    > Subject: Re: BIG WARNING - validation controls appear to be ignored.
    > From: "PL" <pblse2@yahoo.se>
    > Newsgroups:
    microsoft.public.dotnet.framework.aspnet,microsoft .public.dotnet.framew
    ork.aspnet.security
    >
    >> No, this is not in the documentation, however, there are plenty of
    >> informative articles available on preventing SQL injection attacks.
    >
    > Is it not in the docs ? You better read it more carefully, what the h
    do you
    > think the webuivalidation.js is ???
    >
    > Come on, dont blaim MS because you are bad programmers.
    >
    > PL.
    >
    >
    >

    You miss the point of his comment, which has nothing to do with the
    docs, and everything to do with not depending on validators to protect
    your backend data.

    That's called defense in depth, and is the practice of good
    programmers.

    And don't blame M$ because you're a bad speller.

    -- ipgrunt
    IPGrunt Guest

  9. #8

    Default Re: BIG WARNING - validation controls appear to be ignored.

    >
    > You miss the point of his comment, which has nothing to do with the
    > docs, and everything to do with not depending on validators to protect
    > your backend data.
    >
    > That's called defense in depth, and is the practice of good
    > programmers.
    >
    Just as a follow-up, the point of my original comment was not really
    about relying on client-side validation. no programmer worth his salt
    would ever do that deliberately.

    My point was that the system as a whole (the framework and development
    environment) did not "fail-safe". Without reading every word of the
    documentation, I wrote and tested an application making what I
    beleived to be a reasonable assumption about how it would work. When I
    deployed it I found out by accident that it was relying on client side
    validation. IMHO this would be worth a big caveat on every page
    relating to the valiation, not just a single note.

    Better still, I would have click-type events only fire if the form is
    valid, unless the developer specifically overrides this behaviour.
    Andy Fish Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139