SecureChange Custom Scripts

Overview

Custom scripts are files of code containing business logic that can run at various stages of the SecureChange ticket lifecycle. The scripts can be written by any programmer with the required skills; alternatively, they can be provided by Tufin Professional Services. For a quotation, contact your account manager. The scripts receive the ticket details from SecureChange, which they can use to run TOS APIs and/or pass information to external systems; they have no format requirements. Any number of custom scripts can be integrated into workflows.

Custom scripts can be written in any programming language, and must be installed on the TOS Aurora host outside the cluster or on an external host.

Custom scripts can be invoked following a specific workflow event such as closing a ticket or moving from one ticket step to the next. These events are called triggers.

Every custom script requires a matching mediator script, the purpose of which is to communicate between SecureChange and the custom script. The mediator script contains no business logic, must be written in a fixed format, and must be uploaded to TOS Aurora. SecureChange calls the mediator script, which sends an XML payload to the web server. This payload is used as input to the custom script.

Mediator Scripts

The mediator script must be uploaded to TOS using the command sudo tos scripts sc push. When triggered by a SecureChange event, it sends a request to the web server to run its matching custom script. You must create a unique mediator script for every custom script.

Mediator Script Types

There are different types of mediator scripts - each with a different syntax.

Type

Expects Return Code

Expects XML Script

Workflow event triggers, as configured in Settings > SecureChange API check mark  
External risk analysis check mark  
Ticket validation script check mark  
Assignment mode: Skip assignment step   check mark
Dynamic assignment   check mark
Assignment mode: Pre-assignment scripts   check mark

Workflow Event Triggers

A script can run after a workflow event occurs. These events include:

Trigger

Action

Advance

Runs a script when a handled ticket has advanced to a new step on the specified workflow.

Automatic step failed

Runs a script when an automatic step has failed in a ticket.

Create

Runs a script when a ticket is created.

Close

Runs a script when a ticket is closed.

Cancel

Runs a script when a ticket is canceled.

Redo

Runs a script when a handler of a ticket has returned to an earlier step on a specified workflow.

Reject

Runs a script when a ticket is rejected.

Reopen

Runs a script when the requester reopens a ticket after the handlers have completed their tasks.

Resolve

Runs a script when all handlers have completed their tasks and is pending confirmation by the requester.

Resubmit

Runs a script when an expired ticket is resubmitted.

XML Input to the Custom Script

When invoked, SecureChange passes ticket information to the mediator script in XML format containing the following attributes:

  • completion_step_id
  • completion_step_name
  • createDate
  • current_stage_id
  • current_stage_name
  • id
  • open_request_id
  • open_request_name
  • subject
  • updateDate
 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ticket_info>
  <id>64</id>
  <subject>test_mediator_tutorial</subject>
  <priority>
    <id>3</id>
    <name>Normal</name>
  </priority>
  <createDate>1704707276656</createDate>
  <updateDate>1704707524268</updateDate>
  <requester>
    <id>4</id>
    <login>api</login>
    <display_name>api api</display_name>
  </requester>
  <current_stage>
    <id>253</id>
    <name>test_mediator</name>
    <ticket_task>
      <id>253</id>
      <name>Default</name>
      <handler>
        <id>4</id>
        <login>api</login>
        <display_name>api api</display_name>
      </handler>
    </ticket_task>
  </current_stage>
  <open_request_stage>
    <id>252</id>
    <name>Open request</name>
    <ticket_task>
      <id>252</id>
      <name>Default</name>
      <handler>
        <id>4</id>
        <login>api</login>
        <display_name>api api</display_name>
      </handler>
    </ticket_task>
  </open_request_stage>
  <comment xsi:type="RedoCommentType" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <content>test</content>
    <user>
      <id>4</id>
      <login>api</login>
      <display_name>api api</display_name>
    </user>
  </comment>
</ticket_info>

Implementing your Custom Script

These are the steps to implement a mediator script. Each step includes sample code.

  1. Create the web server that will be used to run your custom scripts (see Custom Scripting Solution).

Resources

How do I Get Here?

SecureChange > Settings > SecureChange API