znuny / Znuny

Znuny/Znuny LTS is a fork of the ((OTRS)) Community Edition, one of the most flexible web-based ticketing systems used for Customer Service, Help Desk, IT Service Management.
https://www.znuny.org
GNU General Public License v3.0
333 stars 82 forks source link

Bug - Problems in WebHooks prevent GenericAgents #511

Closed HiS3 closed 7 months ago

HiS3 commented 7 months ago

Environment

Expected behaviour

Actual behaviour

This is also the case if the customer does not have a SMIME certificate.

But if the Customer does have a SMIME certificate it runs in trouble. We use for our Customer a LDAP incl. SMIME-Certificate (integreated via Kenerl/Config.pm) in binaire-Form. It is also suitable for SMIME e-mail communication. as long as the customer isn´t in our LDAP incl. SMIME-Certificate

But when the json file for the webhook is first sent to Mattermost, the binary is not converted or ignored, resulting in the following error message.

[Mon Nov 13 09:14:36 2023] -e: Malformed UTF-8 character: \xf7\x0d\x01\x01 (unexpected non-continuation byte 0x0d, immediately after start byte 0xf7; need 4 bytes, got 1) in substitution (s///) at /Kernel/System/DB/mysql.pm line 128. [Mon Nov 13 09:14:36 2023] -e: (in cleanup) Malformed UTF-8 character (fatal) at /Kernel/System/DB/mysql.pm line 128. [Mon Nov 13 09:14:36 2023] -e: (in cleanup) Can't call method "Get" on an undefined value at /Kernel/System/AuthSession/DB.pm line 553. [Mon Nov 13 09:14:36 2023] -e: (in cleanup) Can't call method "Get" on an undefined value at /Kernel/System/EventHandler.pm line 166.

The event handler crashes and neither the webhook is sent nor the GernercAgents are executed!

Current solution --> Webhooks deactivated :-1:

How to reproduce

Steps to reproduce the behavior:

  1. Set up webhook for Mattermost and activate/set up ticket notification for e.g. TicketQueueUpdate
  2. Set up generic agent for TicketQueueUpdate e.g. change Owner
  3. Check: TicketQueueUpdate of an Ticket--> Everything should work
  4. Integration of the customer database incl. SMIME certificate
  5. Select Customer with an SMIME-Zertifikat in the Ticket
  6. Check: TicketQueueUpdate of this Ticket --> Error ... take a look in the error.log

Additional information

Screenshots

Example of the SMIME-Format in the Json-File under CustomerUser UserSMIMECertificate

rkaldung commented 7 months ago

@HiS3 You're probably right that the binary data is the root cause. There are two options how to deal with this:

  1. Remove the fields from the data passed to the invoker. Ths system configuration GenericInterface::Invoker::Ticket::Generic::PrepareRequest::OmittedFields needs to be configured for this.
  2. If you need the data it can be base64 encoded. GenericInterface::Invoker::Ticket::Generic::PrepareRequest::Base64EncodedFields is the required configuration setting.

Both settings affect all requesters.

HiS3 commented 7 months ago

Hey @rkaldung thanks for the quick help. I had initially tested the Base64Encoded variant. But this resulted in the next error -e Wide Character ....

However, the OmittedFields variant worked all the better :). With this config, only the SMIME certificates are removed from the Json. OmittedFields

Many thanks again. With this I close the bug.