IBM QRadar SOAR

IBM QRadar SOAR

Join this online user group to communicate across Security product users and IBM experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Refusing import of specific attachment file-types

    Posted Fri February 09, 2024 04:53 AM

    Hi,

    Is there a possibility (in Python3 scripts preferably) to disallow or block adding attachments of specific file types (e.g. ".png") to an incident or task? I experimented with the following, which does "run" without any problem - triggered by a rule on "attachment is created", but it does not "delete" the attachment.

    Script on object type "attachment"

    # Do not allow attachments  .png extensions are discarded
    name = str(attachment.name)
    alen = len(name)
    extension = name[alen-3:alen]

    if extension == "png":
        attachment.created == False
        log.error("deleted png")
    else:
        log.error("no png")



    ------------------------------
    Guido Janssens
    CERT - Information Risk Officer
    KBC Group NV
    ------------------------------


  • 2.  RE: Refusing import of specific attachment file-types

    Posted Fri February 09, 2024 02:04 PM

    Hi Guido,

    I've followed up with the team to see if there is a way to essentially "delete" an attachment.

    In the meantime, is there a specific script or playbook that is adding these .png files as attachments when the case gets created? Or a script or playbook that is enriching the case with these attachments? If there is an existing script or playbook that is actually adding these attachments to begin with, you may find it easier to add a condition in there to check if the incoming attachment type is .png and, if so, skip the process of adding the attachment in the first place.

    Hope this helps.



    ------------------------------
    Priya Sapra
    ------------------------------



  • 3.  RE: Refusing import of specific attachment file-types
    Best Answer

    Posted Fri February 09, 2024 02:35 PM

    Hi Guido,

    There is no way to "delete" attachments from a script the way that you have described. Additionally, you may have meant to use `attachment.created = False` instead of `==` to try to set that value to be False, but this will still fail because attachment.created is a timestamp and read-only.

    The best course of action for you may be to identify which script is creating or enriching the case with these attachments in the first place and filter out the `.png` files there.

    Hope this helps.



    ------------------------------
    Priya Sapra
    ------------------------------



  • 4.  RE: Refusing import of specific attachment file-types

    Posted Thu August 22, 2024 04:54 AM

    Hi - Sorry for the late reply.

    Thanks for you input. The attachments are not created by a script. We wanted to avoid users being able to add (manually) .png attachments. 
    I understand that there is no solution to this issue now.



    ------------------------------
    Guido Janssens
    CERT - Information Risk Officer
    KBC Group NV
    ------------------------------



  • 5.  RE: Refusing import of specific attachment file-types

    Posted Thu August 22, 2024 07:28 AM

    what come to my mind is helper.fail , you can try that in your if statement.

    let me know if it works please

    Helper operations - IBM Documentation



    ------------------------------
    mohamad islam hamadieh
    ------------------------------