Skip to content

/AWS1/IF_SAG=>CREATETHREAT()

About CreateThreat

Creates a new threat under a threat model job.

Method Signature

METHODS /AWS1/IF_SAG~CREATETHREAT
  IMPORTING
    !IV_AGENTSPACEID TYPE /AWS1/SAGSTRING OPTIONAL
    !IV_THREATJOBID TYPE /AWS1/SAGSTRING OPTIONAL
    !IV_TITLE TYPE /AWS1/SAGSTRING OPTIONAL
    !IV_STATEMENT TYPE /AWS1/SAGSTRING OPTIONAL
    !IV_SEVERITY TYPE /AWS1/SAGTHREATSEVERITY OPTIONAL
    !IV_COMMENTS TYPE /AWS1/SAGSTRING OPTIONAL
    !IT_STRIDE TYPE /AWS1/CL_SAGSTRIDECATLIST_W=>TT_STRIDECATEGORYLIST OPTIONAL
    !IV_THREATSOURCE TYPE /AWS1/SAGSTRING OPTIONAL
    !IV_PREREQUISITES TYPE /AWS1/SAGSTRING OPTIONAL
    !IV_THREATACTION TYPE /AWS1/SAGSTRING OPTIONAL
    !IV_THREATIMPACT TYPE /AWS1/SAGSTRING OPTIONAL
    !IT_IMPACTEDGOAL TYPE /AWS1/CL_SAGSTRINGLIST_W=>TT_STRINGLIST OPTIONAL
    !IT_IMPACTEDASSETS TYPE /AWS1/CL_SAGSTRINGLIST_W=>TT_STRINGLIST OPTIONAL
    !IO_ANCHOR TYPE REF TO /AWS1/CL_SAGTHREATANCHORSHAPE OPTIONAL
    !IT_EVIDENCE TYPE /AWS1/CL_SAGTHRTEVIDENCESHAPE=>TT_THREATEVIDENCELIST OPTIONAL
    !IV_RECOMMENDATION TYPE /AWS1/SAGSTRING OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_sagcreatethreatoutput
  RAISING
    /AWS1/CX_SAGCLIENTEXC
    /AWS1/CX_SAGSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_agentspaceid TYPE /AWS1/SAGSTRING /AWS1/SAGSTRING

The unique identifier of the agent space.

iv_threatjobid TYPE /AWS1/SAGSTRING /AWS1/SAGSTRING

The unique identifier of the threat model job the threat belongs to.

Optional arguments:

iv_title TYPE /AWS1/SAGSTRING /AWS1/SAGSTRING

A short title summarizing the threat.

iv_statement TYPE /AWS1/SAGSTRING /AWS1/SAGSTRING

The natural-language threat statement.

iv_severity TYPE /AWS1/SAGTHREATSEVERITY /AWS1/SAGTHREATSEVERITY

The severity level of the threat.

iv_comments TYPE /AWS1/SAGSTRING /AWS1/SAGSTRING

Optional customer comment on the threat.

it_stride TYPE /AWS1/CL_SAGSTRIDECATLIST_W=>TT_STRIDECATEGORYLIST TT_STRIDECATEGORYLIST

The STRIDE categories applicable to this threat.

iv_threatsource TYPE /AWS1/SAGSTRING /AWS1/SAGSTRING

The actor or origin of the threat.

iv_prerequisites TYPE /AWS1/SAGSTRING /AWS1/SAGSTRING

The conditions required for the threat to be exploitable.

iv_threataction TYPE /AWS1/SAGSTRING /AWS1/SAGSTRING

What the threat source can do.

iv_threatimpact TYPE /AWS1/SAGSTRING /AWS1/SAGSTRING

The direct consequence of the threat action.

it_impactedgoal TYPE /AWS1/CL_SAGSTRINGLIST_W=>TT_STRINGLIST TT_STRINGLIST

The security goals affected by the threat.

it_impactedassets TYPE /AWS1/CL_SAGSTRINGLIST_W=>TT_STRINGLIST TT_STRINGLIST

The specific assets affected by the threat.

io_anchor TYPE REF TO /AWS1/CL_SAGTHREATANCHORSHAPE /AWS1/CL_SAGTHREATANCHORSHAPE

The DFD element this threat is anchored to.

it_evidence TYPE /AWS1/CL_SAGTHRTEVIDENCESHAPE=>TT_THREATEVIDENCELIST TT_THREATEVIDENCELIST

The source code files supporting the threat.

iv_recommendation TYPE /AWS1/SAGSTRING /AWS1/SAGSTRING

The recommended mitigation guidance for this threat.

RETURNING

oo_output TYPE REF TO /aws1/cl_sagcreatethreatoutput /AWS1/CL_SAGCREATETHREATOUTPUT

Examples

Syntax Example

This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.

DATA(lo_result) = lo_client->createthreat(
  io_anchor = new /aws1/cl_sagthreatanchorshape(
    iv_id = |string|
    iv_kind = |string|
    iv_packageid = |string|
  )
  it_evidence = VALUE /aws1/cl_sagthrtevidenceshape=>tt_threatevidencelist(
    (
      new /aws1/cl_sagthrtevidenceshape(
        iv_packageid = |string|
        iv_path = |string|
      )
    )
  )
  it_impactedassets = VALUE /aws1/cl_sagstringlist_w=>tt_stringlist(
    ( new /aws1/cl_sagstringlist_w( |string| ) )
  )
  it_impactedgoal = VALUE /aws1/cl_sagstringlist_w=>tt_stringlist(
    ( new /aws1/cl_sagstringlist_w( |string| ) )
  )
  it_stride = VALUE /aws1/cl_sagstridecatlist_w=>tt_stridecategorylist(
    ( new /aws1/cl_sagstridecatlist_w( |string| ) )
  )
  iv_agentspaceid = |string|
  iv_comments = |string|
  iv_prerequisites = |string|
  iv_recommendation = |string|
  iv_severity = |string|
  iv_statement = |string|
  iv_threataction = |string|
  iv_threatimpact = |string|
  iv_threatjobid = |string|
  iv_threatsource = |string|
  iv_title = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lv_string = lo_result->get_threatid( ).
  lv_string = lo_result->get_threatjobid( ).
  lv_string = lo_result->get_title( ).
  lv_string = lo_result->get_statement( ).
  lv_threatseverity = lo_result->get_severity( ).
  lv_threatstatus = lo_result->get_status( ).
  lv_string = lo_result->get_comments( ).
  LOOP AT lo_result->get_stride( ) into lo_row.
    lo_row_1 = lo_row.
    IF lo_row_1 IS NOT INITIAL.
      lv_stridecategory = lo_row_1->get_value( ).
    ENDIF.
  ENDLOOP.
  lv_string = lo_result->get_threatsource( ).
  lv_string = lo_result->get_prerequisites( ).
  lv_string = lo_result->get_threataction( ).
  lv_string = lo_result->get_threatimpact( ).
  LOOP AT lo_result->get_impactedgoal( ) into lo_row_2.
    lo_row_3 = lo_row_2.
    IF lo_row_3 IS NOT INITIAL.
      lv_string = lo_row_3->get_value( ).
    ENDIF.
  ENDLOOP.
  LOOP AT lo_result->get_impactedassets( ) into lo_row_2.
    lo_row_3 = lo_row_2.
    IF lo_row_3 IS NOT INITIAL.
      lv_string = lo_row_3->get_value( ).
    ENDIF.
  ENDLOOP.
  lo_threatanchorshape = lo_result->get_anchor( ).
  IF lo_threatanchorshape IS NOT INITIAL.
    lv_string = lo_threatanchorshape->get_kind( ).
    lv_string = lo_threatanchorshape->get_id( ).
    lv_string = lo_threatanchorshape->get_packageid( ).
  ENDIF.
  LOOP AT lo_result->get_evidence( ) into lo_row_4.
    lo_row_5 = lo_row_4.
    IF lo_row_5 IS NOT INITIAL.
      lv_string = lo_row_5->get_packageid( ).
      lv_string = lo_row_5->get_path( ).
    ENDIF.
  ENDLOOP.
  lv_string = lo_result->get_recommendation( ).
  lv_threatactor = lo_result->get_createdby( ).
  lv_threatactor = lo_result->get_updatedby( ).
  lv_timestamp = lo_result->get_createdat( ).
  lv_timestamp = lo_result->get_updatedat( ).
ENDIF.