Uploaded image for project: 'Service Packs and Hot Fixes'
  1. Service Packs and Hot Fixes
  2. MNT-12196

Exception generated in “AccessAuditor” when length of custom property string in Javascript is bigger than 1024 in Postgres database

    Details

    • Type: Service Pack Request
    • Status: Closed (View Workflow)
    • Resolution: Fixed
    • Affects Version/s: 4.2.2
    • Fix Version/s: 4.2.4
    • Component/s: Auditing
    • Labels:
      None

      Description

      Exception generated in “AccessAuditor” when length of custom property string in Javascript is bigger than 1024 in Postgres database.

      This issue is similar to issues addressed in MNT-10611 and MNT-10171. However when javascript is used to fill the custom metadata value the exception is generated.

      Steps:

      1- Install a 4.2.2 instance using Postgres Database.

      2- Create a custom model with a property of type d:text:
      Example: rename "exampleModel.xml.sample" located under "\tomcat\shared\classes\alfresco\extension" path to "exampleModel.xml" and example-model-context.xml.sample to example-model-context.xml

      3- Activate audit in “alfresco-global.properties”. (Ensure model "my:sop" is added to the filter)

      audit.enabled=true
      audit.filter.alfresco-access.default.enabled=true
      audit.alfresco-access.enabled=true
      audit.filter.alfresco-access.transaction.action=~READ;.*
      audit.filter.alfresco-access.transaction.type=cm:folder;cm:content;st:site;my:sop;dl:todoList;dl:simpletask;dl:task;dl:contact;dl:issue;dl:event;dl:location;dl:meetingAgenda;dl:eventAgenda;dl:dataList;
      audit.filter.alfresco-access.transaction.user=~System;.*

      4- Add audit debug statements.
      Copy "\webapps\alfresco\WEB-INF\classes\log4j.properties" to "\tomcat\shared\classes\alfresco\extension\audit-log4j.properties" and add the following debug statements:

      log4j.appender.File.Threshold=debug
      log4j.logger.org.alfresco.repo.audit.access.AccessAuditor=debug
      log4j.logger.org.alfresco.repo.audit.inbound=DEBUG
      log4j.logger.org.alfresco.repo.audit.AuditComponentImpl=DEBUG

      5- Restart Alfresco

      6- Add a new content of type "cm:content" and copy its noderef.

      7- Run the following Javascript with the content's noderef in the first instruction:

      var doc = search.findNode("workspace://SpacesStore/4fb70c66-3da7-4fed-b606-8c4a13cd8270");

      doc.specializeType("my:sop");

      doc.properties["my:authorisedBy"] =
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789";
      doc.save();

      Expected Behaviour:
      1- Value should be properly audited.

      2- Content is trimmed to 1024 and/or display a message

      Observed behaviour:
      1- The exception is generated and value change is not audited properly.

      13:33:48,780 ERROR [org.alfresco.repo.transaction.AlfrescoTransactionSupport] [http-apr-8080-exec-16] After completion (committed) listener exception:
      listener: org.alfresco.repo.audit.access.AccessAuditor$AccessTransactionListener@42ee6bfc
      java.lang.IllegalArgumentException: Persisted string values for 'alf_prop_string_value' cannot be longer than 1024 characters. Increase the string column sizes and set property 'system.maximumStringLength' accordingly.
      at org.alfresco.repo.domain.propval.AbstractPropertyValueDAOImpl.getOrCreatePropertyStringValue (AbstractPropertyValueDAOImpl.java:499)
      ...

      2- Content is not trimmed to 1024.

      Analysis to date:

      • If this script is executed for out of the box metadata like cm:description, audit exception is not thrown however content is not trimmed and value will be updated successfully:

      var doc = search.findNode("workspace://SpacesStore/4fb70c66-3da7-4fed-b606-8c4a13cd8270");
      doc.properties["cm:description"] =
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" +
      "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789";
      doc.save();

        Attachments

          Issue Links

            Structure

              Activity

                People

                • Assignee:
                  closedbugs Closed Bugs
                  Reporter:
                  rabbaspour Rosa Abbaspour [X] (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  7 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Time Tracking

                    Estimated:
                    Original Estimate - Not Specified
                    Not Specified
                    Remaining:
                    Remaining Estimate - 0 minutes
                    0m
                    Logged:
                    Time Spent - 1 week, 1 day, 6 hours
                    1w 1d 6h

                      Structure Helper Panel