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

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

        Issue Links

          Activity

          Hide
          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
          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
          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
          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
          Steven Glover added a comment -

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

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

          Vladimir, thanks for the detailed logs and information.

          Show
          Steven Glover added a comment - Vladimir, thanks for the detailed logs and information.
          Hide
          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
          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
          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
          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:
              Closed Issues
              Reporter:
              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