GuardAPI Assessment Functions

Use these CLI commands to add, delete and update Assessment Functions.

Use the following GuardAPI commands to:
  • Add, delete, update the Security Assessment definition
  • Add, delete a datasource from an existing Security Assessment
  • Add, delete tests from an existing Security Assessment

create_assessment

Use this GuardAPI command to add a security assessment.

Table 1. create_assessment
Parameter Value type Description
assessmentDescription string Required. Free text – unique - must ensure there is no previous assessment with the same description. If there is one, then ERROR.
fromDate   Valid date or relative date. Not mandatory. Default: NOW -1 DAY
toDate   Valid date or relative date. Not mandatory. Default: NOW
FilterClientIP   Valid IP address. Not mandatory. Default null.
FilterServerIP   Valid IP address. Not mandatory. Default null.

Action: If all parameters are validated created a new record in SECURITY_ASSESSMENT table (MODIFIED_FLAG leave default – 0)

Example

grdapi create_assessment assessmentDescription=Assess1 

add_assessment_datasource

Use this GuardAPI command to add a datasource to a security assessment.

Table 2. add_assessment_datasource
Parameter Value type Description
assessmentDescription string Required. Free text. Unique - must ensure there is no previous assessment with the same description. If there is one, then ERROR.
datasourceName string Required. Free Text: Must be the Name of an existing datasource, if such datasource not present, then ERROR

Action: If all parameters are validated then it adds a record to: ASSESSMENT_DATASOURCE using the ASSESSMENT ID and DATASOURCE ID for the assessment and datasource with the names provided.

Example

grdapi add_assessment_datasource assessmentDescription=Assess1 datasourceName=DS1

add_assessment_test

Use this GuardAPI command to add a test to an existing security assessment.

Parameter Value type Description
assessmentDescription string Required - Free text – unique - must ensure there is no previous assessment with the same description, if there is one, then ERROR
testDescription string Required - Free Text: Must match the TEST_DESC of an existing test in AVAILABLE_TEST , if such test not present, then ERROR
severity string Validates against SEVERITY_DESC table (using DESCRIPTION) – Not mandatory. The default value is INFO.
thresholdValue   If Threshold value required from available test = 0, then IGNORE this parameter.

Else (THRESHOLD) value required in available_test = 1, then parameter must be an integer

If the parameter is not provided, then use DEFAULT_THRESHOLD_VALUE from AVAILABLE_TEST.

exceptionsGroup   Check the value CAN_HAVE_EXCEPTIONS_GROUP in AVAILABLE_TEST.

The parameter is NOT mandatory.

If 0 then (exceptions group not supported for this test): If the parameter is provided, then ERROR (can not provide exception group for this test); If the parameter is NOT provided, then use -1 to populate.

Else  (Exception group supported for the test): If the parameter is NOT provided then use -1 to populate; IF the parameter is provided validate the group and use the group ID.

To validate the group select from GROUP_DESC where GROUP_DESCRIPTION = the description provided, and check whether the record exist and the GROUP_TYPE_ID

If there is not such group ERROR, then exception group does not exists.

If there is such group and the GROUP_TYPE_ID != 55, then ERROR: Exception group must be of the type “VA Exceptions”

If the group is present and the type = 55, then use the GROUP_ID.

Additional Validation: Check whether there is already a record in ASSESSMENT_TEST for the ASSESSMENT_ID and TEST_ID, if there is such record: ERROR, this test is already present in the assessment can not add it again.

Action: If all parameters validated then add a record to ASSESSMENT_TEST (note SEVERITY must be populated with the DESCRIPTION)

Example

grdapi add_assessment_test  assessmentDescription=Assess1 testDescription="The first test" 

delete_assessment

Use this GuardAPI command to delete a security assessment.

Parameter Value type Description
assessmentDescription string Required. Free text. Unique. Must ensure there is no previous assessment with the same description, if there is one, then ERROR

Additional Validation: Must ensure there are no results for the assessment to be deleted by:

Select count (*) from ASSESSSMENT_RESULT_HEADER where ASSESSMENT_ID = TheIdToRemve

IF the select returns > 0 then do not remove, ERROR

Action: If the parameter is validated (identifies the security assessment record, and there are no results for the assessment) delete the SECURITY_ASSESSMENT records, THE ASSESSMENT_TEST records and the ASSESSMENT_DATASOURCE records (all three deletes using the ASSESSMENT_ID)

Example

grdapi delete_asssessment assessmentDescription=Assess1

delete_assessment_datasource

Use this GuardAPI command to delete a datasource from a security assessment.

Parameter Value type Description
assessmentDescription string Required. Free text – unique - must ensure there is no previous assessment with the same description. If there is one, then ERROR.
datasourceName string Required. Free Text: Must be the Name of an existing data-source, if such datasource not present, then ERROR

Action: If all parameters validated, then check whether there is a record in ASSESSMENT_DATASOURCE for the assessment and datasource provided. If no such record Error, otherwise delete the record.

Example

grdapi delete_asssessment_datasource assessmentDescription=Assess1 datasourceName=DS1

delete_assessment_test

Use this GuardAPI command to delete a test from an existing security assessment

Parameter Value type Description
assessmentDescription string Required. Free text – unique - must ensure there is no previous assessment with the same description, if there is one then ERROR
testDescription string Free Text: Must match the TEST_DESC of an existing test in AVAILABLE_TEST , if such test not present, then ERROR

Additional Validation: Check whether there is a record in ASSESSMENT_TES for the ASSESSMENT_ID and TEST_ID, if there is no such record: ERROR, this test is not present in the assessment

Action: If all parameters validated then delete the record from ASSESSMENT_TEST.

Example

grdapi delete_asssessment_test assessmentDescription=Assess1

list_assessments

Use this GuardAPI command to list the security assessments.

Parameter Value type Description
assessmentDescription string Required. Free text – unique - must ensure there is no previous assessment with the same description, if there is one then ERROR

Example

grdapi list_assessments

list_assessment_tests

Use this GuardAPI command to show the list of tests for the security assessment.

The output of list_available_tests is in the following format: TEST=[<test description>], DS_TYPE=[<datasource type>] (The actual values are encapsulated within the brackets)

The output of list_assessment_tests is in the following format: TEST_DESC=[<available test description>], DS_TYPE=[<datasourcetype>]

The parameters of list_assessment_tests API command are non-mandatory and support filtering.

Parameter Value type Validation
assessmentDescription   The API will:
  • Validate the description is ONE valid assessment description and will retrieve the ID of the assessment. (if there is no assessment, then error)
  • Show the list of tests for the assessment (and the datasource type).
Select AVAILABLE_TEST.TEST_DESC, DATASOURCE_TYPE.NAME from ASSESSMENT_TEST, DATASOURCE_TYPE, AVAILABLE_TEST, SECURITY_ASSESSMENT  where AVAILABLE_TEST.DATASOURCE_TYPE_ID = DATASOURCE_TYPE.DATASOURCE_TYPE_ID  and ASSESSMENT_TEST.ASSESSMENT_ID = SECURITY_ASSESSMENT.ASSESSMENT_ID  and SECURITY_ASSESSMENT.ASSESSMENT_DESC like “Your Param”

Example

grdapi list_assessment_tests

update_assessment

Use this GuardAPI command to update the record of the security assessment.

Parameter Value type Description
assessmentDescription string Must match an existing record in SECURITY_ASSESSMENT
newAssessmentDescription string Free Text – IF empty, means do not update the description, use the value from the previous parameter, otherwise: unique must ensure there is no previous assessment with the same description, if there is one then ERROR.
fromDate string Valid date or relative date
toDate string Valid date or relative date
filterContentIP string Valid IP address
filterServerIP string Valid IP address

Action: If all parameters validated (and there it identified a SECURITY_ASSESSMENT record with the description provided, then update the record with the values provided)

Example

grdapi update_assessment assessmentDescription=Assess1 filterClientIP=192.168.1.1.