Uploaded image for project: 'EJBCA'
  1. EJBCA
  2. ECA-5411

Email Notification parameters containing $ sign causes error

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: EJBCA 6.6.0
    • Component/s: None
    • Labels:
      None

      Description

      Stack trace:

      08:33:05,841 ERROR
      > [org.ejbca.core.ejb.ra.EndEntityManagementSessionBean] (default task-24)
      > Error sending notification to user *x@y.com with email
      > x@y.com.:
      > java.lang.IllegalArgumentException: Illegal group reference*
      >
      > at java.util.regex.Matcher.appendReplacement(Matcher.java:857)
      >
      > at
      > org.ejbca.util.NotificationParamGen.interpolate(NotificationParamGen.java:103)
      >
      > at
      > org.ejbca.util.NotificationParamGen.interpolate(NotificationParamGen.java:85)

      Also noted:


      This has to do with the message itself. You can see from the code:

      at java.util.regex.Matcher.appendReplacement(Matcher.java:857)

      at
      org.ejbca.util.NotificationParamGen.interpolate(NotificationParamGen.java:103)

      at
      org.ejbca.util.NotificationParamGen.interpolate(NotificationParamGen.java:85)

      NotificationParamGen.java:103 is a regexp replacement:
      m.appendReplacement(sb, value);
      Where the pattern is:
      private final static Pattern PATTERN = Pattern.compile("\\$

      {(.+?)\\}

      ");

      Judging from this article it's likely that whatever "variable" they try
      to interpolate has some $ in it.
      http://stackoverflow.com/questions/11913709/why-does-replaceall-fail-with-illegal-group-reference

      So you should check what their message is, what parameters they are
      trying to interpolate, and what contains a $. I.e. if they have a $ in
      the user.DN and try to insert this in the email message, this could lead
      to failure (without me testing, this is my guess)

      Cheers,
      Tomas


      Curiously, I took a look at modules/ejbca-common/src/org/ejbca/util/passgen/AllPrintableCharPasswordGenerator.java and it shows the “$” in the character set. When a user selects an auto-generated password using “All printable English characters”, they can encounter the same issue?

      Thanks,
      Cuong Voong, Network Security Consultant | C2 Company


        Attachments

          Activity

            People

            Assignee:
            tomas Tomas Gustavsson
            Reporter:
            cuong@c2company.com Cuong Voong
            Verified by:
            Samuel Lidén Borell
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: