ICEfaces
  1. ICEfaces
  2. ICE-5392

Malformed viewNumber echoed to client

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 1.8.2a
    • Fix Version/s: 1.8.2-EE-GA_P01, 1.8.3
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      ICEfaces
    • Assignee Priority:
      P2

      Description



      Using the ice.session extracted from the page:

       curl --cookie /tmp/cookies.txt --cookie-jar /tmp/cookies.txt --data "ice.view=<SCrIPT>alert("SIdg96pCgjo1SnsmlAeEF50N6fkZGG")</SCrIPT>&ice.session=XQWAa3fjHI0pQN5VhZIfSw" http://localhost:8080/auctionMonitor/block/send-receive-updates

      we see the malformed viewNumber echoed in the response:

      <reload view="<SCrIPT>alert(SIdg96pCgjo1SnsmlAeEF50N6fkZGG)</SCrIPT>"/>

        Activity

        Hide
        Ted Goddard added a comment -

        Candidate fix:

        Index: core/src/com/icesoft/faces/webapp/http/core/ReceiveSendUpdates.java
        ===================================================================
        — core/src/com/icesoft/faces/webapp/http/core/ReceiveSendUpdates.java (revision 20655)
        +++ core/src/com/icesoft/faces/webapp/http/core/ReceiveSendUpdates.java (working copy)
        @@ -61,7 +61,13 @@
        } else {
        View view = (View) views.get(viewNumber);
        if (view == null) {

        • request.respondWith(new ReloadResponse(viewNumber));
          + try { + Integer.parseInt(viewNumber); + request.respondWith(new ReloadResponse(viewNumber)); + }

          catch (NumberFormatException e)

          { + LOG.warn("Malformed viewNumber " + viewNumber); + request.respondWith(SessionExpiredResponse.Handler); + }

          } else {
          try {
          view.processPostback(request);

        Show
        Ted Goddard added a comment - Candidate fix: Index: core/src/com/icesoft/faces/webapp/http/core/ReceiveSendUpdates.java =================================================================== — core/src/com/icesoft/faces/webapp/http/core/ReceiveSendUpdates.java (revision 20655) +++ core/src/com/icesoft/faces/webapp/http/core/ReceiveSendUpdates.java (working copy) @@ -61,7 +61,13 @@ } else { View view = (View) views.get(viewNumber); if (view == null) { request.respondWith(new ReloadResponse(viewNumber)); + try { + Integer.parseInt(viewNumber); + request.respondWith(new ReloadResponse(viewNumber)); + } catch (NumberFormatException e) { + LOG.warn("Malformed viewNumber " + viewNumber); + request.respondWith(SessionExpiredResponse.Handler); + } } else { try { view.processPostback(request);
        Hide
        Ted Goddard added a comment -

        To create fake ICEfaces requests using curl:

        curl --cookie /tmp/cookies.txt --cookie-jar /tmp/cookies.txt http://localhost:8080/auctionMonitor/auctionMonitor.iface | fgrep session

        Then extract the "session:" parameter and use in the request above for "ice.session".

        Show
        Ted Goddard added a comment - To create fake ICEfaces requests using curl: curl --cookie /tmp/cookies.txt --cookie-jar /tmp/cookies.txt http://localhost:8080/auctionMonitor/auctionMonitor.iface | fgrep session Then extract the "session:" parameter and use in the request above for "ice.session".
        Hide
        Deryk Sinotte added a comment -

        Assigning to Mircea to review Ted's suggested fix and apply or adjust as required.

        Show
        Deryk Sinotte added a comment - Assigning to Mircea to review Ted's suggested fix and apply or adjust as required.
        Hide
        Mircea Toma added a comment -

        The view number is already checked at line 62 in ReceiveSendUpdates.java file. It was implemented already for ICE-5181. Were the fixes for ICE-5181 not working all this time?

        Sending back a session expired when view number is not correct is a bit misleading. A 500 error is more appropriate since it describes more appropriately the problem, also the response will shutdown only the bridge instance (window) that made the erroneous request while a session expired message will shutdown all the windows.

        Show
        Mircea Toma added a comment - The view number is already checked at line 62 in ReceiveSendUpdates.java file. It was implemented already for ICE-5181. Were the fixes for ICE-5181 not working all this time? Sending back a session expired when view number is not correct is a bit misleading. A 500 error is more appropriate since it describes more appropriately the problem, also the response will shutdown only the bridge instance (window) that made the erroneous request while a session expired message will shutdown all the windows.
        Hide
        Ted Goddard added a comment -

        As Mircea pointed out, this was already fixed in the trunk but was reported by the customer since the fix was not present in ICEfaces 1.8.2. The change has been reverted.

        Show
        Ted Goddard added a comment - As Mircea pointed out, this was already fixed in the trunk but was reported by the customer since the fix was not present in ICEfaces 1.8.2. The change has been reverted.
        Hide
        Ted Goddard added a comment -

        Duplicate of ICE-5181.

        Show
        Ted Goddard added a comment - Duplicate of ICE-5181.

          People

          • Assignee:
            Mircea Toma
            Reporter:
            Ted Goddard
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: