Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-64439

"positive-number" field validator accepts non valid java numbers

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: core
    • Labels:
      None
    • Similar Issues:
    • Released As:
      Jenkins 2.274 - released 5 Jan 2021 and 2.277.1

      Description

      if you have a field that is using `<f:number clazz="positive-number" min="1" step="1" />` you can submit a garbage number as far as java is concerned without any formvalidation warning.

      this is because javascript validation treats `e` as the matmatical constant e (2.7182......)

      so you can enter `e` `3e` or lots of this.

      however Jenkins will then parse this usign standard java terms and well - `e` is not valid here, so you get a number format exception.

      For example create a job and select "Discard old builds" and enter "e" as the "days to keep builds.
      observe there are no formvalidation errors and save the form
      reconfigure the job and not that the value is missing.

        Attachments

          Issue Links

            Activity

            teilo James Nord created issue -
            benebsiny Benny Cheng made changes -
            Field Original Value New Value
            Assignee Benny Cheng [ benebsiny ]
            oleg_nenashev Oleg Nenashev made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            oleg_nenashev Oleg Nenashev made changes -
            Status In Progress [ 3 ] In Review [ 10005 ]
            markewaite Mark Waite made changes -
            Released As Jenkins 2.274 - released 5 Jan 2021
            Resolution Fixed [ 1 ]
            Status In Review [ 10005 ] Closed [ 6 ]
            oleg_nenashev Oleg Nenashev made changes -
            Link This issue relates to JENKINS-64651 [ JENKINS-64651 ]
            markewaite Mark Waite made changes -
            Released As Jenkins 2.274 - released 5 Jan 2021 Jenkins 2.274 - released 5 Jan 2021 and 2.277.1

              People

              Assignee:
              benebsiny Benny Cheng
              Reporter:
              teilo James Nord
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: