Uploaded image for project: 'Alfresco'
  1. Alfresco
  2. ALF-12771

Groups names with line feeds ('\n') cause JSON errors for SOLR and other remote calls

    Details

    • Resource:
      External

      Description

      Using LDAP group sync, create group names with line feeds '\n' in the name.

      Index tracking fails because JSON encoding does not handle the line feed.

      SEVERE: Tracking failed
      org.json.JSONException: Unterminated string at character 1306290
      at org.json.JSONTokener.syntaxError(JSONTokener.java:413)
      ...
      at org.alfresco.solr.client.SOLRAPIClient.getNodesMetaData(SOLRAPIClient.java:725)

      Attempting to delete the group fails as well because the group name is not escaped:
      Exception from executeScript - redirecting to status template error: 01170003 Script url /api/groups/fihel-SQL-Reporting admins <NOTE: \n here>
      CNF:e4759fd0-2ad0-44ab-bca1-1c8e888ea2d3 does not map to a Web Script.

      Expected:
      Either disallow the line feeds, fix the JSON encoding or both

        Attachments

        1. ALF-12771.patch
          11 kB
        2. browse-groups.jpg
          browse-groups.jpg
          27 kB
        3. error.json
          1.80 MB
        4. stderr.log
          141 kB

          Issue Links

            Activity

            Hide
            ahind Andrew Hind added a comment -

            There is something wrong with JSON encoding of the meta data for a node - either there is some error or it is truncated.
            Please turn on the SOLR debug for the CoreTracker. This will identify the problem node.
            Then a screen shot of all this nodes properties(from the NodeBrowser) so the problem node can be recreated.

            You may be able to get the information by tracing the HTPP requests.

            Show
            ahind Andrew Hind added a comment - There is something wrong with JSON encoding of the meta data for a node - either there is some error or it is truncated. Please turn on the SOLR debug for the CoreTracker. This will identify the problem node. Then a screen shot of all this nodes properties(from the NodeBrowser) so the problem node can be recreated. You may be able to get the information by tracing the HTPP requests.
            Hide
            lightoze Vladimir Kulev added a comment -

            I've changed "org.alfresco.solr.tracker" level to FINEST and got the attached log. How can I identify the problem transaction number to find out the node?

            Show
            lightoze Vladimir Kulev added a comment - I've changed "org.alfresco.solr.tracker" level to FINEST and got the attached log. How can I identify the problem transaction number to find out the node?
            Hide
            sglover Steven Glover added a comment -

            Invalid (un-escaped newline) json in child assocs - character 452181.

            Show
            sglover Steven Glover added a comment - Invalid (un-escaped newline) json in child assocs - character 452181.
            Hide
            sglover Steven Glover added a comment -

            Vladimir, thanks for the detailed logs and information.

            Show
            sglover Steven Glover added a comment - Vladimir, thanks for the detailed logs and information.
            Hide
            lightoze Vladimir Kulev added a comment -

            I don't think that commit 34078 is a full fix for this issue, because it only fixes JSON serialization for SOLR (which is good), but \n in group name will still break Alfresco group management. It will be good to have also some escaping in LDAP synchronizer for both users and groups.

            Show
            lightoze Vladimir Kulev added a comment - I don't think that commit 34078 is a full fix for this issue, because it only fixes JSON serialization for SOLR (which is good), but \n in group name will still break Alfresco group management. It will be good to have also some escaping in LDAP synchronizer for both users and groups.
            Hide
            alfrescoqa Alfresco QA Team added a comment -

            Validated against 4.2.0 (r53312-b198) schema 6,030.

            Groups containing "\n" sequence are successfully synchronized, tracked by solr, searchable and can be actioned.

            However it's impossible to browse these groups via admin console:

            Show
            alfrescoqa Alfresco QA Team added a comment - Validated against 4.2.0 ( r53312 -b198) schema 6,030. Groups containing "\n" sequence are successfully synchronized, tracked by solr, searchable and can be actioned. However it's impossible to browse these groups via admin console:

              People

              • Assignee:
                closedissues Closed Issues
                Reporter:
                lightoze Vladimir Kulev
              • Votes:
                0 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Date of First Response:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 day, 1 hour
                  1d 1h